From: Fariborz Jahanian Date: Tue, 14 Jan 2014 20:35:13 +0000 (+0000) Subject: ObjectiveC. produce more expressive warning when X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29108212b10bbd6fcd90f68eadb767713e8548fa;p=clang ObjectiveC. produce more expressive warning when -Wselector detects an unimplemented method used in an @selector expression. // rdar://15781538 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199255 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 18b6fa2e8b..e956e851b6 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -855,7 +855,8 @@ def warn_auto_implicit_atomic_property : Warning< "property is assumed atomic when auto-synthesizing the property">, InGroup, DefaultIgnore; def warn_unimplemented_selector: Warning< - "creating selector for nonexistent method %0">, InGroup, DefaultIgnore; + "using @selector on method %0 with no implementation in translation unit">, + InGroup, DefaultIgnore; def warn_unimplemented_protocol_method : Warning< "method %0 in protocol %1 not implemented">, InGroup; diff --git a/test/PCH/chain-selectors.m b/test/PCH/chain-selectors.m index f2bfc4b9d3..5de17725ff 100644 --- a/test/PCH/chain-selectors.m +++ b/test/PCH/chain-selectors.m @@ -18,9 +18,9 @@ void bar() { // FIXME: Can't verify notes in headers //[a f2]; - (void)@selector(x); // expected-warning {{creating selector for nonexistent method 'x'}} - (void)@selector(y); // expected-warning {{creating selector for nonexistent method 'y'}} - (void)@selector(e); // expected-warning {{creating selector for nonexistent method 'e'}} + (void)@selector(x); // expected-warning {{using @selector on method 'x' with no implementation in translation unit}} + (void)@selector(y); // expected-warning {{using @selector on method 'y' with no implementation in translation unit}} + (void)@selector(e); // expected-warning {{using @selector on method 'e' with no implementation in translation unit}} } @implementation X (Blah) diff --git a/test/SemaObjC/selector-3.m b/test/SemaObjC/selector-3.m index 35a4651707..76e14b16c1 100644 --- a/test/SemaObjC/selector-3.m +++ b/test/SemaObjC/selector-3.m @@ -14,7 +14,7 @@ - (void) foo { SEL a,b,c; - a = @selector(b1ar); // expected-warning {{creating selector for nonexistent method 'b1ar'}} + a = @selector(b1ar); // expected-warning {{using @selector on method 'b1ar' with no implementation in translation unit}} b = @selector(bar); } @end @@ -25,7 +25,7 @@ SEL func() { - return @selector(length); // expected-warning {{creating selector for nonexistent method 'length'}} + return @selector(length); // expected-warning {{using @selector on method 'length' with no implementation in translation unit}} } // rdar://9545564 @@ -69,7 +69,7 @@ extern SEL MySelector(SEL s); @implementation INTF - (void) Meth { - if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) // expected-warning {{creating selector for nonexistent method '_setQueue:'}} + if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) // expected-warning {{using @selector on method '_setQueue:' with no implementation in translation unit}} { }