diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-13 01:09:36 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-13 01:09:36 +0000 |
commit | cd707abbc758149d9f7d37bd0b25298455c678b2 (patch) | |
tree | 3eff0bb6d40f23d603990709797bf4e031de642c | |
parent | 78dae24600a877f52dbb6e58bfd5778754a00974 (diff) |
Fix crash at @implementation with a forward reference as base class.
rdar://11020003
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152596 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 2 | ||||
-rw-r--r-- | test/ASTMerge/Inputs/interface2.m | 2 | ||||
-rw-r--r-- | test/SemaObjC/invalid-code.m | 6 |
3 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 27bdcd6c8c..d224f1058a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -925,6 +925,8 @@ Decl *Sema::ActOnStartClassImplementation( Diag(PrevDecl->getLocation(), diag::note_previous_definition); } else { SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl); + if (SDecl && !SDecl->hasDefinition()) + SDecl = 0; if (!SDecl) Diag(SuperClassLoc, diag::err_undef_superclass) << SuperClassname << ClassName; diff --git a/test/ASTMerge/Inputs/interface2.m b/test/ASTMerge/Inputs/interface2.m index 3fb43f5930..2133bd1381 100644 --- a/test/ASTMerge/Inputs/interface2.m +++ b/test/ASTMerge/Inputs/interface2.m @@ -69,7 +69,7 @@ @end // Forward-declared interface -@class I12, I10; +@class I10; @interface I12 @end @interface I11 @end diff --git a/test/SemaObjC/invalid-code.m b/test/SemaObjC/invalid-code.m index 7b6591205b..4ba34f0e47 100644 --- a/test/SemaObjC/invalid-code.m +++ b/test/SemaObjC/invalid-code.m @@ -42,3 +42,9 @@ void foo() { @end @end // expected-error {{'@end' must appear in an Objective-C context}} + +@class ForwardBase; +@implementation SomeI : ForwardBase // expected-error {{cannot find interface declaration for 'ForwardBase', superclass of 'SomeI'}} \ + // expected-warning {{cannot find interface declaration for 'SomeI'}} +-(void)meth {} +@end |