[clang] 64f5fed - [ASTContext][NFC] Remove getTargetAddressSpace(Qualifiers Q)
Alex Richardson via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 23 01:26:27 PST 2022
Author: Alex Richardson
Date: 2022-11-23T09:04:42Z
New Revision: 64f5fedb59e82a79c0c669c3d6591ca9eadb82fb
URL: https://github.com/llvm/llvm-project/commit/64f5fedb59e82a79c0c669c3d6591ca9eadb82fb
DIFF: https://github.com/llvm/llvm-project/commit/64f5fedb59e82a79c0c669c3d6591ca9eadb82fb.diff
LOG: [ASTContext][NFC] Remove getTargetAddressSpace(Qualifiers Q)
This simply calls getTargetAddressSpace(Q.getAddressSpace()) and there
are only two callers, so adjust those caller instead.
Added:
Modified:
clang/include/clang/AST/ASTContext.h
clang/lib/AST/ASTContext.cpp
clang/lib/CodeGen/CodeGenTypes.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 2a21f2d1f37ee..6f695f096857f 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -2812,8 +2812,6 @@ class ASTContext : public RefCountedBase<ASTContext> {
unsigned getTargetAddressSpace(QualType T) const;
- unsigned getTargetAddressSpace(Qualifiers Q) const;
-
unsigned getTargetAddressSpace(LangAS AS) const;
LangAS getLangASForBuiltinAddressSpace(unsigned AS) const;
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b9f9bec39317a..e887f44b3ca0b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -12234,11 +12234,7 @@ unsigned ASTContext::getTargetAddressSpace(QualType T) const {
// the best address space based on the type information
return T->isFunctionType() && !T.hasAddressSpace()
? getTargetInfo().getProgramAddressSpace()
- : getTargetAddressSpace(T.getQualifiers());
-}
-
-unsigned ASTContext::getTargetAddressSpace(Qualifiers Q) const {
- return getTargetAddressSpace(Q.getAddressSpace());
+ : getTargetAddressSpace(T.getAddressSpace());
}
unsigned ASTContext::getTargetAddressSpace(LangAS AS) const {
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 05956c2c1ec69..3869285e0b2cb 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -772,10 +772,10 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
// Block pointers lower to function type. For function type,
// getTargetAddressSpace() returns default address space for
// function pointer i.e. program address space. Therefore, for block
- // pointers, it is important to pass qualifiers when calling
- // getTargetAddressSpace(), to ensure that we get the address space
- // for data pointers and not function pointers.
- unsigned AS = Context.getTargetAddressSpace(FTy.getQualifiers());
+ // pointers, it is important to pass the pointee AST address space when
+ // calling getTargetAddressSpace(), to ensure that we get the LLVM IR
+ // address space for data pointers and not function pointers.
+ unsigned AS = Context.getTargetAddressSpace(FTy.getAddressSpace());
ResultType = llvm::PointerType::get(PointeeType, AS);
break;
}
More information about the cfe-commits
mailing list