[cfe-commits] r149573 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaObjC/continuation-class-err.m
Fariborz Jahanian
fjahanian at apple.com
Wed Feb 1 16:49:13 PST 2012
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
+ at interface MyOtherClass() // expected-error {{cannot find interface declaration for 'MyOtherClass'}}
+{
+ id array;
+}
+ at end
+
+ at implementation MyOtherClass // expected-warning {{cannot find interface declaration for 'MyOtherClass'}}
+ at end
More information about the cfe-commits
mailing list