diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 12 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index ec1f30084e8..bb2e8550bd2 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2165,7 +2165,11 @@ LValue CodeGenFunction::EmitLoadOfReferenceLValue(Address RefAddr, Address CodeGenFunction::EmitLoadOfPointer(Address Ptr, const PointerType *PtrTy, - LValueBaseInfo *BaseInfo) { + LValueBaseInfo *BaseInfo, + TBAAAccessInfo *TBAAInfo) { + if (TBAAInfo) + *TBAAInfo = CGM.getTBAAAccessInfo(PtrTy->getPointeeType()); + llvm::Value *Addr = Builder.CreateLoad(Ptr); return Address(Addr, getNaturalTypeAlignment(PtrTy->getPointeeType(), BaseInfo, @@ -2175,9 +2179,9 @@ Address CodeGenFunction::EmitLoadOfPointer(Address Ptr, LValue CodeGenFunction::EmitLoadOfPointerLValue(Address PtrAddr, const PointerType *PtrTy) { LValueBaseInfo BaseInfo; - Address Addr = EmitLoadOfPointer(PtrAddr, PtrTy, &BaseInfo); - return MakeAddrLValue(Addr, PtrTy->getPointeeType(), BaseInfo, - CGM.getTBAAAccessInfo(PtrTy->getPointeeType())); + TBAAAccessInfo TBAAInfo; + Address Addr = EmitLoadOfPointer(PtrAddr, PtrTy, &BaseInfo, &TBAAInfo); + return MakeAddrLValue(Addr, PtrTy->getPointeeType(), BaseInfo, TBAAInfo); } static LValue EmitGlobalVarDeclLValue(CodeGenFunction &CGF, diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 71adc4a9dee..2b8720a5dee 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1948,7 +1948,8 @@ public: LValue EmitLoadOfReferenceLValue(Address Ref, const ReferenceType *RefTy); Address EmitLoadOfPointer(Address Ptr, const PointerType *PtrTy, - LValueBaseInfo *BaseInfo = nullptr); + LValueBaseInfo *BaseInfo = nullptr, + TBAAAccessInfo *TBAAInfo = nullptr); LValue EmitLoadOfPointerLValue(Address Ptr, const PointerType *PtrTy); /// CreateTempAlloca - This creates an alloca and inserts it into the entry |