Diagnose if an implementation implements a forward class

declaration (and avoid issuing bogus error later on).

llvm-svn: 69928
This commit is contained in:
Fariborz Jahanian 2009-04-23 21:49:04 +00:00
parent 0e89886048
commit 6f0f25b0d8
3 changed files with 11 additions and 2 deletions

View File

@ -623,8 +623,10 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
} else {
// Is there an interface declaration of this class; if not, warn!
IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!IDecl)
if (!IDecl || IDecl->isForwardDecl()) {
Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
IDecl = 0;
}
}
// Check that super class name is valid class name

View File

@ -31,3 +31,10 @@ typedef int INTF3; // expected-note {{previous definition is here}}
@implementation INTF4 @end // expected-warning {{cannot find interface declaration for 'INTF4'}}
@class INTF5;
@implementation INTF5 { // expected-warning {{cannot find interface declaration for 'INTF5'}}
int x;
}
@end

View File

@ -1,6 +1,6 @@
// RUN: clang-cc -fsyntax-only -verify %s
@class PBXTrackableTaskManager;
@interface PBXTrackableTaskManager @end
@implementation PBXTrackableTaskManager
- (id) init {}