// interface and each other.
if (ObjCCategoryDecl *Category = dyn_cast<ObjCCategoryDecl>(container)) {
searchFromContainer(container);
- searchFromContainer(Category->getClassInterface());
+ if (ObjCInterfaceDecl *Interface = Category->getClassInterface())
+ searchFromContainer(Interface);
} else {
searchFromContainer(container);
}
// declaration.
if (ObjCCategoryDecl *category = impl->getCategoryDecl()) {
search(category);
- search(category->getClassInterface());
+ if (ObjCInterfaceDecl *Interface = category->getClassInterface())
+ search(Interface);
// Otherwise it overrides declarations from the class.
- } else {
- search(impl->getClassInterface());
+ } else if (ObjCInterfaceDecl *Interface = impl->getClassInterface()) {
+ search(Interface);
}
}
void searchFrom(ObjCImplementationDecl *impl) {
// A method in a class implementation overrides declarations from
// the class interface.
- search(impl->getClassInterface());
+ if (ObjCInterfaceDecl *Interface = impl->getClassInterface())
+ search(Interface);
}
@class I; // expected-note {{forward declaration}}
@implementation I(cat) // expected-error{{cannot find interface declaration}}
@end
+
+// <rdar://problem/11478173>
+@interface Unrelated
+- foo;
+@end
+
+@interface Blah (Blarg) // expected-error{{cannot find interface declaration for 'Blah'}}
+- foo;
+@end