xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/undeclared-selector.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -Wundeclared-selector -verify -Wno-objc-root-class %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuctypedef struct objc_selector *SEL;
4*f4a2713aSLionel Sambuc
5*f4a2713aSLionel Sambuc@interface MyClass
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc+ (void) methodA;
8*f4a2713aSLionel Sambuc- (void) methodB;
9*f4a2713aSLionel Sambuc+ (void) methodD;
10*f4a2713aSLionel Sambuc- (void) methodF;
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc@end
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc@implementation MyClass
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc+ (void) methodA {}
17*f4a2713aSLionel Sambuc- (void) methodB {}
18*f4a2713aSLionel Sambuc+ (void) methodD
19*f4a2713aSLionel Sambuc{
20*f4a2713aSLionel Sambuc  SEL d = @selector(methodD); /* Ok */
21*f4a2713aSLionel Sambuc  SEL e = @selector(methodE);
22*f4a2713aSLionel Sambuc}
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc- (void) methodE
25*f4a2713aSLionel Sambuc{
26*f4a2713aSLionel Sambuc  SEL e = @selector(methodE); /* Ok */
27*f4a2713aSLionel Sambuc}
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc- (void) methodF
30*f4a2713aSLionel Sambuc{
31*f4a2713aSLionel Sambuc  SEL e = @selector(methodE); /* Ok */
32*f4a2713aSLionel Sambuc}
33*f4a2713aSLionel Sambuc
34*f4a2713aSLionel Sambuc@end
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambucint main (void)
37*f4a2713aSLionel Sambuc{
38*f4a2713aSLionel Sambuc  SEL a = @selector(methodA); /* Ok */
39*f4a2713aSLionel Sambuc  SEL b = @selector(methodB); /* Ok */
40*f4a2713aSLionel Sambuc  SEL c = @selector(methodC);  // expected-warning {{undeclared selector 'methodC'}}
41*f4a2713aSLionel Sambuc  SEL d = @selector(methodD); /* Ok */
42*f4a2713aSLionel Sambuc  SEL e = @selector(methodE); /* Ok */
43*f4a2713aSLionel Sambuc  return 0;
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc}
46