xref: /llvm-project/clang/test/SemaObjC/warning-missing-selector-name.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class -Wmissing-selector-name %s
3
4@interface Super @end
5@interface INTF : Super
6-(void) Name1:(id)Arg1 Name2:(id)Arg2; // Name1:Name2:
7-(void) Name1:(id) Name2:(id)Arg2; // expected-warning {{'Name2' used as the name of the previous parameter rather than as part of the selector}} \
8				   // expected-note {{introduce a parameter name to make 'Name2' part of the selector}} \
9				   // expected-note {{or insert whitespace before ':' to use 'Name2' as parameter name and have an empty entry in the selector}}
10-(void) Name1:(id)Arg1 Name2:(id)Arg2 Name3:(id)Arg3; // Name1:Name2:Name3:
11-(void) Name1:(id)Arg1 Name2:(id) Name3:(id)Arg3; // expected-warning {{'Name3' used as the name of the previous parameter rather than as part of the selector}} \
12				   // expected-note {{introduce a parameter name to make 'Name3' part of the selector}} \
13				   // expected-note {{or insert whitespace before ':' to use 'Name3' as parameter name and have an empty entry in the selector}}
14- method:(id) second:(id)second; // expected-warning {{'second' used as the name of the previous parameter rather than as part of the selector}} \
15				   // expected-note {{introduce a parameter name to make 'second' part of the selector}} \
16				   // expected-note {{or insert whitespace before ':' to use 'second' as parameter name and have an empty entry in the selector}} \
17				   // expected-note {{method 'method::' declared here}}
18
19@end
20
21@implementation INTF // expected-warning {{method definition for 'method::' not found}}
22-(void) Name1:(id)Arg1 Name2:(id)Arg2{}
23-(void) Name1:(id) Name2:(id)Arg2 {} // expected-warning {{'Name2' used as the name of the previous parameter rather than as part of the selector}} \
24					// expected-note {{introduce a parameter name to make 'Name2' part of the selector}} \
25 					// expected-note {{or insert whitespace before ':' to use 'Name2' as parameter name and have an empty entry in the selector}}
26-(void) Name1:(id)Arg1 Name2:(id)Arg2 Name3:(id)Arg3 {}
27-(void) Name1:(id)Arg1 Name2:(id) Name3:(id)Arg3 {} // expected-warning {{'Name3' used as the name of the previous parameter rather than as part of the selector}} \
28					// expected-note {{introduce a parameter name to make 'Name3' part of the selector}} \
29 					// expected-note {{or insert whitespace before ':' to use 'Name3' as parameter name and have an empty entry in the selector}}
30- method:(id)first second:(id)second {return 0; }
31@end
32