diff options
author | Alex Richardson <alexrichardson@google.com> | 2022-11-18 12:14:00 +0000 |
---|---|---|
committer | Alex Richardson <alexrichardson@google.com> | 2022-11-30 20:24:01 +0000 |
commit | a602f76a2406cc3edd6b297ede3583b26513a34c (patch) | |
tree | ff026455684f7aeff22923436910e84965cbdbfe /clang/lib/CodeGen/CGObjCMac.cpp | |
parent | 57b1c0250d5da6ac5342f10cd8f046412a46f153 (diff) | |
download | llvm-a602f76a2406cc3edd6b297ede3583b26513a34c.zip llvm-a602f76a2406cc3edd6b297ede3583b26513a34c.tar.gz llvm-a602f76a2406cc3edd6b297ede3583b26513a34c.tar.bz2 |
[clang][TargetInfo] Use LangAS for getPointer{Width,Align}()
Mixing LLVM and Clang address spaces can result in subtle bugs, and there
is no need for this hook to use the LLVM IR level address spaces.
Most of this change is just replacing zero with LangAS::Default,
but it also allows us to remove a few calls to getTargetAddressSpace().
This also removes a stale comment+workaround in
CGDebugInfo::CreatePointerLikeType(): ASTContext::getTypeSize() does
return the expected size for ReferenceType (and handles address spaces).
Differential Revision: https://reviews.llvm.org/D138295
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 92eadb3..da31d33 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2407,8 +2407,8 @@ void IvarLayoutBuilder::visitBlock(const CGBlockInfo &blockInfo) { Qualifiers::GC GCAttr = GetGCAttrTypeForType(CGM.getContext(), type); if (GCAttr == Qualifiers::Strong) { - assert(CGM.getContext().getTypeSize(type) - == CGM.getTarget().getPointerWidth(0)); + assert(CGM.getContext().getTypeSize(type) == + CGM.getTarget().getPointerWidth(LangAS::Default)); IvarsInfo.push_back(IvarInfo(fieldOffset, /*size in words*/ 1)); } } @@ -2701,7 +2701,7 @@ llvm::Constant *CGObjCCommonMac::getBitmapBlockLayout(bool ComputeByrefLayout) { llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy); if (RunSkipBlockVars.empty()) return nullPtr; - unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0); + unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(LangAS::Default); unsigned ByteSizeInBits = CGM.getTarget().getCharWidth(); unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits; @@ -2887,7 +2887,7 @@ void CGObjCCommonMac::fillRunSkipBlockVars(CodeGenModule &CGM, RunSkipBlockVars.clear(); bool hasUnion = false; - unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0); + unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(LangAS::Default); unsigned ByteSizeInBits = CGM.getTarget().getCharWidth(); unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits; |