[cfe-commits] r144150 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/invalid-code.m

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Nov 8 16:22:48 PST 2011


Author: akirtzidis
Date: Tue Nov  8 18:22:48 2011
New Revision: 144150

URL: http://llvm.org/viewvc/llvm-project?rev=144150&view=rev
Log:
Don't crash on invalid objc code.

Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/SemaObjC/invalid-code.m

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=144150&r1=144149&r2=144150&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Nov  8 18:22:48 2011
@@ -873,6 +873,11 @@
     // FIXME: This is a hack. Ivar lookup should be part of normal
     // lookup.
     if (ObjCMethodDecl *Method = getCurMethodDecl()) {
+      if (!Method->getClassInterface()) {
+        // Fall back: let the parser try to parse it as an instance message.
+        return ObjCInstanceMessage;
+      }
+
       ObjCInterfaceDecl *ClassDeclared;
       if (Method->getClassInterface()->lookupInstanceVariable(Name, 
                                                               ClassDeclared))

Modified: cfe/trunk/test/SemaObjC/invalid-code.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/invalid-code.m?rev=144150&r1=144149&r2=144150&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/invalid-code.m (original)
+++ cfe/trunk/test/SemaObjC/invalid-code.m Tue Nov  8 18:22:48 2011
@@ -23,6 +23,7 @@
 @class NSView;
 @implementation IBFillView(IBFillViewIntegration) // expected-error {{cannot find interface declaration for 'IBFillView'}}
 - (NSView *)ibDesignableContentView {
+    [Cake lie]; // expected-error {{undeclared}}
     return self;
 }
 @end





More information about the cfe-commits mailing list