PCH support for all of the predefined Objective-C types, such as id,
SEL, Class, Protocol, CFConstantString, and
__objcFastEnumerationState. With this, we can now run the Objective-C
methods and properties PCH tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69932 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 3895b13..3466d70 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -2000,6 +2000,12 @@
return getTagDeclType(CFConstantStringTypeDecl);
}
+void ASTContext::setCFConstantStringType(QualType T) {
+ const RecordType *Rec = T->getAsRecordType();
+ assert(Rec && "Invalid CFConstantStringType");
+ CFConstantStringTypeDecl = Rec->getDecl();
+}
+
QualType ASTContext::getObjCFastEnumerationStateType()
{
if (!ObjCFastEnumerationStateTypeDecl) {
@@ -2030,6 +2036,12 @@
return getTagDeclType(ObjCFastEnumerationStateTypeDecl);
}
+void ASTContext::setObjCFastEnumerationStateType(QualType T) {
+ const RecordType *Rec = T->getAsRecordType();
+ assert(Rec && "Invalid ObjCFAstEnumerationStateType");
+ ObjCFastEnumerationStateTypeDecl = Rec->getDecl();
+}
+
// This returns true if a type has been typedefed to BOOL:
// typedef <type> BOOL;
static bool isTypeTypedefedAsBOOL(QualType T) {
@@ -2520,9 +2532,15 @@
BuiltinVaListType = T;
}
-void ASTContext::setObjCIdType(TypedefDecl *TD)
+void ASTContext::setObjCIdType(QualType T)
{
- ObjCIdType = getTypedefType(TD);
+ ObjCIdType = T;
+
+ const TypedefType *TT = T->getAsTypedefType();
+ if (!TT)
+ return;
+
+ TypedefDecl *TD = TT->getDecl();
// typedef struct objc_object *id;
const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();
@@ -2536,9 +2554,14 @@
IdStructType = rec;
}
-void ASTContext::setObjCSelType(TypedefDecl *TD)
+void ASTContext::setObjCSelType(QualType T)
{
- ObjCSelType = getTypedefType(TD);
+ ObjCSelType = T;
+
+ const TypedefType *TT = T->getAsTypedefType();
+ if (!TT)
+ return;
+ TypedefDecl *TD = TT->getDecl();
// typedef struct objc_selector *SEL;
const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();
@@ -2555,9 +2578,14 @@
ObjCProtoType = QT;
}
-void ASTContext::setObjCClassType(TypedefDecl *TD)
+void ASTContext::setObjCClassType(QualType T)
{
- ObjCClassType = getTypedefType(TD);
+ ObjCClassType = T;
+
+ const TypedefType *TT = T->getAsTypedefType();
+ if (!TT)
+ return;
+ TypedefDecl *TD = TT->getDecl();
// typedef struct objc_class *Class;
const PointerType *ptr = TD->getUnderlyingType()->getAsPointerType();