]> granicus.if.org Git - clang/commitdiff
[Sema/objc] When checking for unimplemented methods treat methods from class extensio...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 13 Oct 2015 23:27:34 +0000 (23:27 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 13 Oct 2015 23:27:34 +0000 (23:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250250 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/class-extension-dup-methods.m
test/SemaObjC/property-in-class-extension.m

index 0ce463be6a161f46ae628c75af73ceb7aecdb438..8217ba811eae64b32256afc1ab85c0d87d91a97a 100644 (file)
@@ -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.
index 5f463aed168cba391874b5603b77ff4f78ec5f4a..446d2be0378e491322d370032504d4ed8ccbd4ab 100644 (file)
@@ -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
index 022a487ec6d13ff22e38ef9b9213a084079e371c..a780a352199eea84842045e68c239cda239c0d85 100644 (file)
@@ -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;