Author: fjahanian
Date: Wed Feb  1 18:49:12 2012
New Revision: 149573

URL: http://llvm.org/viewvc/llvm-project?rev=149573&view=rev
Log:
objc: don't crash if primary class is missing and continuation class
is declaring ivars. // rdar://10752081


Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaObjC/continuation-class-err.m

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=149573&r1=149572&r2=149573&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Feb  1 18:49:12 2012
@@ -9045,6 +9045,8 @@
                                         : ObjCIvarDecl::None;
   // Must set ivar's DeclContext to its enclosing interface.
   ObjCContainerDecl *EnclosingDecl = cast<ObjCContainerDecl>(CurContext);
+  if (!EnclosingDecl || EnclosingDecl->isInvalidDecl())
+    return 0;
   ObjCContainerDecl *EnclosingContext;
   if (ObjCImplementationDecl *IMPDecl =
       dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {

Modified: cfe/trunk/test/SemaObjC/continuation-class-err.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/continuation-class-err.m?rev=149573&r1=149572&r2=149573&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/continuation-class-err.m (original)
+++ cfe/trunk/test/SemaObjC/continuation-class-err.m Wed Feb  1 18:49:12 2012
@@ -40,3 +40,12 @@
 @synthesize fee = _fee;
 @end
 
+// rdar://10752081
+@interface MyOtherClass() // expected-error {{cannot find interface 
declaration for 'MyOtherClass'}}
+{
+ id array;
+}
+@end
+
+@implementation MyOtherClass // expected-warning {{cannot find interface 
declaration for 'MyOtherClass'}}
+@end


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to