deserialization support for qualified interfaces


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69782 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index f29a0ba..3a311d4 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -2085,10 +2085,15 @@
     return Context.getObjCInterfaceType(
                                   cast<ObjCInterfaceDecl>(GetDecl(Record[0])));
 
-  case pch::TYPE_OBJC_QUALIFIED_INTERFACE:
-    // FIXME: Deserialize ObjCQualifiedInterfaceType
-    assert(false && "Cannot de-serialize ObjC qualified interface types yet");
-    return QualType();
+  case pch::TYPE_OBJC_QUALIFIED_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[0], NumProtos);
+  }
 
   case pch::TYPE_OBJC_QUALIFIED_ID: {
     unsigned Idx = 0;
diff --git a/test/PCH/objc_exprs.h b/test/PCH/objc_exprs.h
index ea6f275..4d58c1f 100644
--- a/test/PCH/objc_exprs.h
+++ b/test/PCH/objc_exprs.h
@@ -1,5 +1,6 @@
 
 @protocol foo;
+@class itf;
 
 // Expressions
 typedef typeof(@"foo" "bar") objc_string;
@@ -10,3 +11,5 @@
 // Types.
 typedef typeof(id<foo>) objc_id_protocol_ty;
 
+typedef typeof(itf*) objc_interface_ty;
+typedef typeof(itf<foo>*) objc_qual_interface_ty;
diff --git a/test/PCH/objc_exprs.m b/test/PCH/objc_exprs.m
index 0b20af8..5b631b4 100644
--- a/test/PCH/objc_exprs.m
+++ b/test/PCH/objc_exprs.m
@@ -18,5 +18,6 @@
 int *T0 = (objc_id_protocol_ty)0; // expected-error {{not a compile-time constant}} \
                                      expected-warning {{aka 'id<foo>'}}
 
-
+int *T1 = (objc_interface_ty)0; // expected-warning {{aka 'itf *'}}
+int *T2 = (objc_qual_interface_ty)0; // expected-warning {{aka 'itf<foo> *'}}