Fix a fixme by allowing pointers in different address spaces to have
different widths. Start simplifying TargetInfo accessor methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48050 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index b5b28bc..5dd7d9a 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -260,9 +260,15 @@
// alignment requirements: getPointerInfo should take an AddrSpace.
return getTypeInfo(QualType(cast<ASQualType>(T)->getBaseType(), 0));
case Type::ObjCQualifiedId:
- case Type::Pointer:
- Target.getPointerInfo(Size, Align);
+ Size = Target.getPointerWidth(0);
+ Align = Target.getPointerAlign(0);
break;
+ case Type::Pointer: {
+ unsigned AS = cast<PointerType>(T)->getPointeeType().getAddressSpace();
+ Size = Target.getPointerWidth(AS);
+ Align = Target.getPointerAlign(AS);
+ break;
+ }
case Type::Reference:
// "When applied to a reference or a reference type, the result is the size
// of the referenced type." C++98 5.3.3p2: expr.sizeof.