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

Fariborz Jahanian fjahanian at apple.com
Tue Nov 8 14:51:28 PST 2011


Author: fjahanian
Date: Tue Nov  8 16:51:27 2011
New Revision: 144143

URL: http://llvm.org/viewvc/llvm-project?rev=144143&view=rev
Log:
objc: Don't crash on missing @interface decl.
// rdar://10415026

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

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=144143&r1=144142&r2=144143&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Nov  8 16:51:27 2011
@@ -1968,12 +1968,13 @@
     }
   } else if (CurMethod->isInstanceMethod()) {
     // We should warn if a local variable hides an ivar.
-    ObjCInterfaceDecl *IFace = CurMethod->getClassInterface();
-    ObjCInterfaceDecl *ClassDeclared;
-    if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) {
-      if (IV->getAccessControl() != ObjCIvarDecl::Private ||
-          IFace == ClassDeclared)
-        Diag(Loc, diag::warn_ivar_use_hidden) << IV->getDeclName();
+    if (ObjCInterfaceDecl *IFace = CurMethod->getClassInterface()) {
+      ObjCInterfaceDecl *ClassDeclared;
+      if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) {
+        if (IV->getAccessControl() != ObjCIvarDecl::Private ||
+            IFace == ClassDeclared)
+          Diag(Loc, diag::warn_ivar_use_hidden) << IV->getDeclName();
+      }
     }
   }
 

Modified: cfe/trunk/test/SemaObjC/invalid-code.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/invalid-code.m?rev=144143&r1=144142&r2=144143&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/invalid-code.m (original)
+++ cfe/trunk/test/SemaObjC/invalid-code.m Tue Nov  8 16:51:27 2011
@@ -19,3 +19,10 @@
   @throw (id)0 // expected-error{{expected ';' after @throw}}
 }
 
+// <rdar://problem/10415026>
+ at class NSView;
+ at implementation IBFillView(IBFillViewIntegration) // expected-error {{cannot find interface declaration for 'IBFillView'}}
+- (NSView *)ibDesignableContentView {
+    return self;
+}
+ at end





More information about the cfe-commits mailing list