ObjectiveC. produce more expressive warning when

-Wselector detects an unimplemented method used
in an @selector expression. // rdar://15781538

llvm-svn: 199255
This commit is contained in:
Fariborz Jahanian 2014-01-14 20:35:13 +00:00
parent 2d353d1a10
commit 2ea30fb9b0
3 changed files with 8 additions and 7 deletions

View File

@ -855,7 +855,8 @@ def warn_auto_implicit_atomic_property : Warning<
"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>;

View File

@ -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)

View File

@ -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}}
{
}