kosarev created this revision. kosarev added a project: clang. Prepared on top of https://reviews.llvm.org/D38733.
Repository: rL LLVM https://reviews.llvm.org/D38788 Files: CodeGen/CGClass.cpp CodeGen/CGExpr.cpp CodeGen/CodeGenFunction.h Index: CodeGen/CodeGenFunction.h =================================================================== --- CodeGen/CodeGenFunction.h +++ CodeGen/CodeGenFunction.h @@ -3327,7 +3327,8 @@ Address EmitCXXMemberDataPointerAddress(const Expr *E, Address base, llvm::Value *memberPtr, const MemberPointerType *memberPtrType, - LValueBaseInfo *BaseInfo = nullptr); + LValueBaseInfo *BaseInfo = nullptr, + TBAAAccessInfo *TBAAInfo = nullptr); RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E, ReturnValueSlot ReturnValue); Index: CodeGen/CGExpr.cpp =================================================================== --- CodeGen/CGExpr.cpp +++ CodeGen/CGExpr.cpp @@ -4571,11 +4571,12 @@ = E->getRHS()->getType()->getAs<MemberPointerType>(); LValueBaseInfo BaseInfo; + TBAAAccessInfo TBAAInfo; Address MemberAddr = - EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo); + EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo, + &TBAAInfo); - return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo, - CGM.getTBAAAccessInfo(MPT->getPointeeType())); + return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo, TBAAInfo); } /// Given the address of a temporary variable, produce an r-value of Index: CodeGen/CGClass.cpp =================================================================== --- CodeGen/CGClass.cpp +++ CodeGen/CGClass.cpp @@ -129,13 +129,16 @@ CodeGenFunction::EmitCXXMemberDataPointerAddress(const Expr *E, Address base, llvm::Value *memberPtr, const MemberPointerType *memberPtrType, - LValueBaseInfo *BaseInfo) { + LValueBaseInfo *BaseInfo, + TBAAAccessInfo *TBAAInfo) { // Ask the ABI to compute the actual address. llvm::Value *ptr = CGM.getCXXABI().EmitMemberDataPointerAddress(*this, E, base, memberPtr, memberPtrType); QualType memberType = memberPtrType->getPointeeType(); + if (TBAAInfo) + *TBAAInfo = CGM.getTBAAAccessInfo(memberType); CharUnits memberAlign = getNaturalTypeAlignment(memberType, BaseInfo); memberAlign = CGM.getDynamicOffsetAlignment(base.getAlignment(),
Index: CodeGen/CodeGenFunction.h =================================================================== --- CodeGen/CodeGenFunction.h +++ CodeGen/CodeGenFunction.h @@ -3327,7 +3327,8 @@ Address EmitCXXMemberDataPointerAddress(const Expr *E, Address base, llvm::Value *memberPtr, const MemberPointerType *memberPtrType, - LValueBaseInfo *BaseInfo = nullptr); + LValueBaseInfo *BaseInfo = nullptr, + TBAAAccessInfo *TBAAInfo = nullptr); RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E, ReturnValueSlot ReturnValue); Index: CodeGen/CGExpr.cpp =================================================================== --- CodeGen/CGExpr.cpp +++ CodeGen/CGExpr.cpp @@ -4571,11 +4571,12 @@ = E->getRHS()->getType()->getAs<MemberPointerType>(); LValueBaseInfo BaseInfo; + TBAAAccessInfo TBAAInfo; Address MemberAddr = - EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo); + EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo, + &TBAAInfo); - return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo, - CGM.getTBAAAccessInfo(MPT->getPointeeType())); + return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo, TBAAInfo); } /// Given the address of a temporary variable, produce an r-value of Index: CodeGen/CGClass.cpp =================================================================== --- CodeGen/CGClass.cpp +++ CodeGen/CGClass.cpp @@ -129,13 +129,16 @@ CodeGenFunction::EmitCXXMemberDataPointerAddress(const Expr *E, Address base, llvm::Value *memberPtr, const MemberPointerType *memberPtrType, - LValueBaseInfo *BaseInfo) { + LValueBaseInfo *BaseInfo, + TBAAAccessInfo *TBAAInfo) { // Ask the ABI to compute the actual address. llvm::Value *ptr = CGM.getCXXABI().EmitMemberDataPointerAddress(*this, E, base, memberPtr, memberPtrType); QualType memberType = memberPtrType->getPointeeType(); + if (TBAAInfo) + *TBAAInfo = CGM.getTBAAAccessInfo(memberType); CharUnits memberAlign = getNaturalTypeAlignment(memberType, BaseInfo); memberAlign = CGM.getDynamicOffsetAlignment(base.getAlignment(),
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits