[cfe-commits] r85440 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/encode-test-2.m

Steve Naroff snaroff at apple.com
Wed Oct 28 15:03:49 PDT 2009


Author: snaroff
Date: Wed Oct 28 17:03:49 2009
New Revision: 85440

URL: http://llvm.org/viewvc/llvm-project?rev=85440&view=rev
Log:
Fix <rdar://problem/7330784>. Avoid crashing on 'Class<p>' when generating meta-data for a class.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/CodeGenObjC/encode-test-2.m

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=85440&r1=85439&r2=85440&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Oct 28 17:03:49 2009
@@ -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 += '<';

Modified: cfe/trunk/test/CodeGenObjC/encode-test-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test-2.m?rev=85440&r1=85439&r2=85440&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test-2.m (original)
+++ cfe/trunk/test/CodeGenObjC/encode-test-2.m Wed Oct 28 17:03:49 2009
@@ -3,7 +3,7 @@
 // RUN: grep -e "@\\\22<X><Y>\\\22" %t  &&
 // RUN: grep -e "@\\\22<X><Y><Z>\\\22" %t  &&
 // RUN: grep -e "@\\\22Foo<X><Y><Z>\\\22" %t  &&
-// RUN: grep -e "{Intf=@@@@}" %t  
+// RUN: grep -e "{Intf=@@@@#}" %t  
 
 @protocol X, Y, Z;
 @class Foo;
@@ -17,6 +17,7 @@
 id <X, Y> IVAR_xy;
 id <X, Y, Z> IVAR_xyz;
 Foo <X, Y, Z> *IVAR_Fooxyz;
+Class <X> IVAR_Classx;
 }
 @end
 





More information about the cfe-commits mailing list