summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp6
-rw-r--r--clang/test/SemaObjC/class-extension-dup-methods.m12
-rw-r--r--clang/test/SemaObjC/property-in-class-extension.m7
3 files changed, 17 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 0ce463be6a1..8217ba811ea 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -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.
diff --git a/clang/test/SemaObjC/class-extension-dup-methods.m b/clang/test/SemaObjC/class-extension-dup-methods.m
index 5f463aed168..446d2be0378 100644
--- a/clang/test/SemaObjC/class-extension-dup-methods.m
+++ b/clang/test/SemaObjC/class-extension-dup-methods.m
@@ -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
diff --git a/clang/test/SemaObjC/property-in-class-extension.m b/clang/test/SemaObjC/property-in-class-extension.m
index 022a487ec6d..a780a352199 100644
--- a/clang/test/SemaObjC/property-in-class-extension.m
+++ b/clang/test/SemaObjC/property-in-class-extension.m
@@ -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;
OpenPOWER on IntegriCloud