diff options
| author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-13 16:58:30 +0000 |
|---|---|---|
| committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-13 16:58:30 +0000 |
| commit | 8ebf4572cb0d7d66ad53b85ef8f53483b474fcbb (patch) | |
| tree | d386ef860d8131dd5a0f68b39001f6f7639ebd46 /lib/CodeGen/CodeGenFunction.cpp | |
| parent | 46d6052cd771f3bd99d3e5a8d259114f1cc5f929 (diff) | |
| download | clang-8ebf4572cb0d7d66ad53b85ef8f53483b474fcbb.tar.gz | |
[CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info
This patch should not bring in any functional changes.
Differential Revision: https://reviews.llvm.org/D38794
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index a07d4849d8..26df45f535 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -120,12 +120,17 @@ CodeGenFunction::~CodeGenFunction() { CharUnits CodeGenFunction::getNaturalPointeeTypeAlignment(QualType T, LValueBaseInfo *BaseInfo) { return getNaturalTypeAlignment(T->getPointeeType(), BaseInfo, - /*forPointee*/ true); + /* TBAAInfo= */ nullptr, + /* forPointeeType= */ true); } CharUnits CodeGenFunction::getNaturalTypeAlignment(QualType T, LValueBaseInfo *BaseInfo, + TBAAAccessInfo *TBAAInfo, bool forPointeeType) { + if (TBAAInfo) + *TBAAInfo = CGM.getTBAAAccessInfo(T); + // Honor alignment typedef attributes even on incomplete types. // We also honor them straight for C++ class types, even as pointees; // there's an expressivity gap here. @@ -169,9 +174,10 @@ CharUnits CodeGenFunction::getNaturalTypeAlignment(QualType T, LValue CodeGenFunction::MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T) { LValueBaseInfo BaseInfo; - CharUnits Alignment = getNaturalTypeAlignment(T, &BaseInfo); + TBAAAccessInfo TBAAInfo; + CharUnits Alignment = getNaturalTypeAlignment(T, &BaseInfo, &TBAAInfo); return LValue::MakeAddr(Address(V, Alignment), T, getContext(), BaseInfo, - CGM.getTBAAAccessInfo(T)); + TBAAInfo); } /// Given a value of type T* that may not be to a complete object, @@ -179,9 +185,10 @@ LValue CodeGenFunction::MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T) { LValue CodeGenFunction::MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T) { LValueBaseInfo BaseInfo; - CharUnits Align = getNaturalTypeAlignment(T, &BaseInfo, /*pointee*/ true); - return MakeAddrLValue(Address(V, Align), T, BaseInfo, - CGM.getTBAAAccessInfo(T)); + TBAAAccessInfo TBAAInfo; + CharUnits Align = getNaturalTypeAlignment(T, &BaseInfo, &TBAAInfo, + /* forPointeeType= */ true); + return MakeAddrLValue(Address(V, Align), T, BaseInfo, TBAAInfo); } |
