forked from OSchip/llvm-project
Diagnose if an implementation implements a forward class
declaration (and avoid issuing bogus error later on). llvm-svn: 69928
This commit is contained in:
parent
0e89886048
commit
6f0f25b0d8
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
|
||||
@class PBXTrackableTaskManager;
|
||||
@interface PBXTrackableTaskManager @end
|
||||
|
||||
@implementation PBXTrackableTaskManager
|
||||
- (id) init {}
|
||||
|
|
Loading…
Reference in New Issue