Remove ObjCQualifiedInterfaceType:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76321 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 1c3d187..d3c7465 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1918,19 +1918,14 @@
     assert(Record.size() == 1 && "incorrect encoding of enum type");
     return Context->getTypeDeclType(cast<EnumDecl>(GetDecl(Record[0])));
 
-  case pch::TYPE_OBJC_INTERFACE:
-    assert(Record.size() == 1 && "incorrect encoding of objc interface type");
-    return Context->getObjCInterfaceType(
-                                  cast<ObjCInterfaceDecl>(GetDecl(Record[0])));
-
-  case pch::TYPE_OBJC_QUALIFIED_INTERFACE: {
+  case pch::TYPE_OBJC_INTERFACE: {
     unsigned Idx = 0;
     ObjCInterfaceDecl *ItfD = cast<ObjCInterfaceDecl>(GetDecl(Record[Idx++]));
     unsigned NumProtos = Record[Idx++];
     llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
     for (unsigned I = 0; I != NumProtos; ++I)
       Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
-    return Context->getObjCQualifiedInterfaceType(ItfD, Protos.data(), NumProtos);
+    return Context->getObjCInterfaceType(ItfD, Protos.data(), NumProtos);
   }
 
   case pch::TYPE_OBJC_OBJECT_POINTER: {
@@ -1995,7 +1990,7 @@
   }
 
   Index -= pch::NUM_PREDEF_TYPE_IDS;
-  assert(Index < TypesLoaded.size() && "Type index out-of-range");
+  //assert(Index < TypesLoaded.size() && "Type index out-of-range");
   if (!TypesLoaded[Index])
     TypesLoaded[Index] = ReadTypeRecord(TypeOffsets[Index]).getTypePtr();
     
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 6a17f39..0a0202b 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -239,18 +239,11 @@
 
 void PCHTypeWriter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {
   Writer.AddDeclRef(T->getDecl(), Record);
-  Code = pch::TYPE_OBJC_INTERFACE;
-}
-
-void 
-PCHTypeWriter::VisitObjCQualifiedInterfaceType(
-                                      const ObjCQualifiedInterfaceType *T) {
-  VisitObjCInterfaceType(T);
   Record.push_back(T->getNumProtocols());
   for (ObjCInterfaceType::qual_iterator I = T->qual_begin(),
        E = T->qual_end(); I != E; ++I)
     Writer.AddDeclRef(*I, Record);
-  Code = pch::TYPE_OBJC_QUALIFIED_INTERFACE;
+  Code = pch::TYPE_OBJC_INTERFACE;
 }
 
 void
@@ -433,7 +426,6 @@
   RECORD(TYPE_RECORD);
   RECORD(TYPE_ENUM);
   RECORD(TYPE_OBJC_INTERFACE);
-  RECORD(TYPE_OBJC_QUALIFIED_INTERFACE);
   RECORD(TYPE_OBJC_OBJECT_POINTER);
   // Statements and Exprs can occur in the Types block.
   AddStmtsExprs(Stream, Record);
@@ -1844,6 +1836,18 @@
   WriteSourceManagerBlock(Context.getSourceManager(), PP, isysroot);
   WritePreprocessor(PP);
   WriteComments(Context);  
+  // Write the record of special types.
+  Record.clear();
+  
+  AddTypeRef(Context.getBuiltinVaListType(), Record);
+  AddTypeRef(Context.getObjCIdType(), Record);
+  AddTypeRef(Context.getObjCSelType(), Record);
+  AddTypeRef(Context.getObjCProtoType(), Record);
+  AddTypeRef(Context.getObjCClassType(), Record);
+  AddTypeRef(Context.getRawCFConstantStringType(), Record);
+  AddTypeRef(Context.getRawObjCFastEnumerationStateType(), Record);
+  AddTypeRef(Context.getFILEType(), Record);
+  Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
   
   // Keep writing types and declarations until all types and
   // declarations have been written.
@@ -1883,18 +1887,6 @@
                             (const char *)&DeclOffsets.front(), 
                             DeclOffsets.size() * sizeof(DeclOffsets[0]));
 
-  // Write the record of special types.
-  Record.clear();
-  AddTypeRef(Context.getBuiltinVaListType(), Record);
-  AddTypeRef(Context.getObjCIdType(), Record);
-  AddTypeRef(Context.getObjCSelType(), Record);
-  AddTypeRef(Context.getObjCProtoType(), Record);
-  AddTypeRef(Context.getObjCClassType(), Record);
-  AddTypeRef(Context.getRawCFConstantStringType(), Record);
-  AddTypeRef(Context.getRawObjCFastEnumerationStateType(), Record);
-  AddTypeRef(Context.getFILEType(), Record);
-  Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
-
   // Write the record containing external, unnamed definitions.
   if (!ExternalDefinitions.empty())
     Stream.EmitRecord(pch::EXTERNAL_DEFINITIONS, ExternalDefinitions);
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp
index 1bc7451..fa1476a 100644
--- a/lib/Frontend/RewriteObjC.cpp
+++ b/lib/Frontend/RewriteObjC.cpp
@@ -1820,16 +1820,7 @@
 }
 
 bool RewriteObjC::needToScanForQualifiers(QualType T) {
-  
-  if (T->isObjCQualifiedIdType())
-    return true;
-  
-  if (const PointerType *pType = T->getAsPointerType()) {
-    Type *pointeeType = pType->getPointeeType().getTypePtr();
-    if (isa<ObjCQualifiedInterfaceType>(pointeeType))
-      return true; // we have "Class <Protocol> *".
-  }
-  return false;
+  return T->isObjCQualifiedIdType() || T->isObjCQualifiedInterfaceType();
 }
 
 void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Expr *E) {