aboutsummaryrefslogtreecommitdiff
path: root/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-10-15 14:41:52 +0000
committerSteve Naroff <snaroff@apple.com>2007-10-15 14:41:52 +0000
commit7e219e47de26346885d667131977bd9ca2d7662a (patch)
tree9b46962d0bb3d31b2dfd053fa78acf89cc4f0ea6 /AST/ASTContext.cpp
parent954ea17353d3b24be52424bc287bdb6bef787fec (diff)
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
Diffstat (limited to 'AST/ASTContext.cpp')
-rw-r--r--AST/ASTContext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp
index f26105f55a..93446824b1 100644
--- a/AST/ASTContext.cpp
+++ b/AST/ASTContext.cpp
@@ -146,6 +146,10 @@ void ASTContext::InitBuiltinTypes() {
FloatComplexTy = getComplexType(FloatTy);
DoubleComplexTy = getComplexType(DoubleTy);
LongDoubleComplexTy = getComplexType(LongDoubleTy);
+
+ BuiltinVaListType = QualType();
+ ObjcIdType = QualType();
+ IdStructType = 0;
}
//===----------------------------------------------------------------------===//
@@ -837,3 +841,17 @@ void ASTContext::setBuiltinVaListType(QualType T)
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;
+}
+