Fix <rdar://problem/7330784>. Avoid crashing on 'Class<p>' when generating meta-data for a class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85440 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index eb6d392..7be55eb 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -3419,7 +3419,10 @@
       return;
     }
 
-    if (OPT->isObjCClassType()) {
+    if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
+      // FIXME: Consider if we need to output qualifiers for 'Class<p>'.
+      // Since this is a binary compatibility issue, need to consult with runtime
+      // folks. Fortunately, this is a *very* obsure construct.
       S += '#';
       return;
     }
@@ -3457,9 +3460,9 @@
     }
 
     S += '@';
-    if (FD || EncodingProperty) {
+    if (OPT->getInterfaceDecl() && (FD || EncodingProperty)) {
       S += '"';
-      S += OPT->getInterfaceDecl()->getNameAsCString();
+      S += OPT->getInterfaceDecl()->getIdentifier()->getName();
       for (ObjCObjectPointerType::qual_iterator I = OPT->qual_begin(),
            E = OPT->qual_end(); I != E; ++I) {
         S += '<';