@class I;
@implementation I(cat) // crashes here
@end
rdar://
10968158
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151931
91177308-0d34-0410-b5e6-
96231b3b80d8
///
ObjCCategoryDecl *
ObjCInterfaceDecl::FindCategoryDeclaration(IdentifierInfo *CategoryId) const {
+ // FIXME: Should make sure no callers ever do this.
+ if (!hasDefinition())
+ return 0;
+
if (data().ExternallyCompleted)
LoadExternalDefinition();
IdentifierInfo *CatName, SourceLocation CatLoc) {
ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName, ClassLoc, true);
ObjCCategoryDecl *CatIDecl = 0;
- if (IDecl) {
+ if (IDecl && IDecl->hasDefinition()) {
CatIDecl = IDecl->FindCategoryDeclaration(CatName);
if (!CatIDecl) {
// Category @implementation with no corresponding @interface.
@synthesize name = _name;
@end
+// rdar://10968158
+@class I; // expected-note {{forward declaration}}
+@implementation I(cat) // expected-error{{cannot find interface declaration}}
+@end