forked from OSchip/llvm-project
[Sema/objc] When checking for unimplemented methods treat methods from class extensions as continuation of the class interface.
llvm-svn: 250250
This commit is contained in:
parent
87156d25bc
commit
3a43754329
|
@ -2773,7 +2773,8 @@ void Sema::MatchAllMethodDeclarations(const SelectorSet &InsMap,
|
|||
if (!WarnCategoryMethodImpl) {
|
||||
for (auto *Cat : I->visible_categories())
|
||||
MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
|
||||
IMPDecl, Cat, IncompleteImpl, false,
|
||||
IMPDecl, Cat, IncompleteImpl,
|
||||
ImmediateClass && Cat->IsClassExtension(),
|
||||
WarnCategoryMethodImpl);
|
||||
} else {
|
||||
// Also methods in class extensions need be looked at next.
|
||||
|
@ -2890,9 +2891,6 @@ void Sema::ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl* IMPDecl,
|
|||
for (auto *PI : I->all_referenced_protocols())
|
||||
CheckProtocolMethodDefs(*this, IMPDecl->getLocation(), PI, IncompleteImpl,
|
||||
InsMap, ClsMap, I, ExplicitImplProtocols);
|
||||
// Check class extensions (unnamed categories)
|
||||
for (auto *Ext : I->visible_extensions())
|
||||
ImplMethodsVsClassMethods(S, IMPDecl, Ext, IncompleteImpl);
|
||||
} else if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl)) {
|
||||
// For extended class, unimplemented methods in its protocols will
|
||||
// be reported in the primary class.
|
||||
|
|
|
@ -26,3 +26,15 @@ __attribute__((objc_root_class)) @interface AppDelegate
|
|||
- (void)someMethodWithArgument:(float)argument; // OK. No warning to be issued here.
|
||||
+ (void)someMethodWithArgument:(float)argument : (float)argument2; // expected-error {{duplicate declaration of method 'someMethodWithArgument::'}}
|
||||
@end
|
||||
|
||||
__attribute__((objc_root_class))
|
||||
@interface Test
|
||||
-(void)meth; // expected-note {{declared here}}
|
||||
@end
|
||||
|
||||
@interface Test()
|
||||
-(void)meth;
|
||||
@end
|
||||
|
||||
@implementation Test // expected-warning {{method definition for 'meth' not found}}
|
||||
@end
|
||||
|
|
|
@ -37,12 +37,11 @@ void FUNC () {
|
|||
|
||||
@interface rdar8747333 ()
|
||||
- (NSObject *)bam;
|
||||
- (NSObject *)warn; // expected-note {{method 'warn' declared here}}
|
||||
- (void)setWarn : (NSObject *)val; // expected-note {{method 'setWarn:' declared here}}
|
||||
- (NSObject *)warn;
|
||||
- (void)setWarn : (NSObject *)val;
|
||||
@end
|
||||
|
||||
@implementation rdar8747333 // expected-warning {{method definition for 'warn' not found}} \
|
||||
// expected-warning {{method definition for 'setWarn:' not found}}
|
||||
@implementation rdar8747333
|
||||
@synthesize bar = _bar;
|
||||
@synthesize baz = _baz;
|
||||
@synthesize bam = _bam;
|
||||
|
|
Loading…
Reference in New Issue