unsigned getTargetAddressSpace(QualType T) const;
- unsigned getTargetAddressSpace(Qualifiers Q) const;
-
unsigned getTargetAddressSpace(LangAS AS) const;
LangAS getLangASForBuiltinAddressSpace(unsigned AS) 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 {
// 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;
}