Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.
Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42983 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index f26105f..9344682 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -146,6 +146,10 @@
FloatComplexTy = getComplexType(FloatTy);
DoubleComplexTy = getComplexType(DoubleTy);
LongDoubleComplexTy = getComplexType(LongDoubleTy);
+
+ BuiltinVaListType = QualType();
+ ObjcIdType = QualType();
+ IdStructType = 0;
}
//===----------------------------------------------------------------------===//
@@ -837,3 +841,17 @@
BuiltinVaListType = T;
}
+void ASTContext::setObjcIdType(TypedefDecl *TD)
+{
+ assert(ObjcIdType.isNull() && "'id' type already set!");
+
+ ObjcIdType = getTypedefType(TD);
+
+ // typedef struct objc_object *id;
+ const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();
+ assert(ptr && "'id' incorrectly typed");
+ const RecordType *rec = ptr->getPointeeType()->getAsStructureType();
+ assert(rec && "'id' incorrectly typed");
+ IdStructType = rec;
+}
+