r199255 - ObjectiveC. produce more expressive warning when
Jordan Rose
jordan_rose at apple.com
Tue Jan 14 16:18:29 PST 2014
The problem isn't that it's unimplemented, it's that it's undeclared. And @selector isn't really an operator. How about "no methods visible for selector %0" or "no methods declared for selector %0 in this translation unit"?
Jordan
On Jan 14, 2014, at 12:35, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Tue Jan 14 14:35:13 2014
> New Revision: 199255
>
> URL: http://llvm.org/viewvc/llvm-project?rev=199255&view=rev
> Log:
> ObjectiveC. produce more expressive warning when
> -Wselector detects an unimplemented method used
> in an @selector expression. // rdar://15781538
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/test/PCH/chain-selectors.m
> cfe/trunk/test/SemaObjC/selector-3.m
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=199255&r1=199254&r2=199255&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jan 14 14:35:13 2014
> @@ -855,7 +855,8 @@ def warn_auto_implicit_atomic_property :
> "property is assumed atomic when auto-synthesizing the property">,
> InGroup<ImplicitAtomic>, DefaultIgnore;
> def warn_unimplemented_selector: Warning<
> - "creating selector for nonexistent method %0">, InGroup<Selector>, DefaultIgnore;
> + "using @selector on method %0 with no implementation in translation unit">,
> + InGroup<Selector>, DefaultIgnore;
> def warn_unimplemented_protocol_method : Warning<
> "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
>
>
> Modified: cfe/trunk/test/PCH/chain-selectors.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/chain-selectors.m?rev=199255&r1=199254&r2=199255&view=diff
> ==============================================================================
> --- cfe/trunk/test/PCH/chain-selectors.m (original)
> +++ cfe/trunk/test/PCH/chain-selectors.m Tue Jan 14 14:35:13 2014
> @@ -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)
>
> Modified: cfe/trunk/test/SemaObjC/selector-3.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/selector-3.m?rev=199255&r1=199254&r2=199255&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/selector-3.m (original)
> +++ cfe/trunk/test/SemaObjC/selector-3.m Tue Jan 14 14:35:13 2014
> @@ -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}}
> {
> }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list