objc: Don't crash on missing @interface decl.

// rdar://10415026

llvm-svn: 144143
This commit is contained in:
Fariborz Jahanian 2011-11-08 22:51:27 +00:00
parent 26573c5585
commit 557fc9a99d
2 changed files with 14 additions and 6 deletions

View File

@ -1968,12 +1968,13 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
}
} 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();
}
}
}

View File

@ -19,3 +19,10 @@ void foo() {
@throw (id)0 // expected-error{{expected ';' after @throw}}
}
// <rdar://problem/10415026>
@class NSView;
@implementation IBFillView(IBFillViewIntegration) // expected-error {{cannot find interface declaration for 'IBFillView'}}
- (NSView *)ibDesignableContentView {
return self;
}
@end