Author: akirtzidis
Date: Tue Oct 13 18:27:34 2015
New Revision: 250250

URL: http://llvm.org/viewvc/llvm-project?rev=250250&view=rev
Log:
[Sema/objc] When checking for unimplemented methods treat methods from class 
extensions as continuation of the class interface.

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

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=250250&r1=250249&r2=250250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Oct 13 18:27:34 2015
@@ -2773,7 +2773,8 @@ void Sema::MatchAllMethodDeclarations(co
     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(Sco
     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.

Modified: cfe/trunk/test/SemaObjC/class-extension-dup-methods.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/class-extension-dup-methods.m?rev=250250&r1=250249&r2=250250&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/class-extension-dup-methods.m (original)
+++ cfe/trunk/test/SemaObjC/class-extension-dup-methods.m Tue Oct 13 18:27:34 
2015
@@ -26,3 +26,15 @@ __attribute__((objc_root_class)) @interf
 - (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

Modified: cfe/trunk/test/SemaObjC/property-in-class-extension.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-in-class-extension.m?rev=250250&r1=250249&r2=250250&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-in-class-extension.m (original)
+++ cfe/trunk/test/SemaObjC/property-in-class-extension.m Tue Oct 13 18:27:34 
2015
@@ -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;


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to