aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC/selector-3.m
blob: dfd216a16fa9316457367c37fde682d1ac414b20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// RUN: %clang_cc1  -fsyntax-only -Wselector -verify -Wno-objc-root-class %s
// rdar://8851684

@interface Foo
- (void) foo;
- (void) bar;
@end

@implementation Foo
- (void) bar
{
}

- (void) foo
{
  SEL a,b,c;
  a = @selector(b1ar);
  b = @selector(bar);
}
@end

@interface I
- length;
@end

SEL func()
{
    return  @selector(length);  // expected-warning {{no method with selector 'length' is implemented in this translation unit}}
}

// rdar://9545564
@class MSPauseManager;

@protocol MSPauseManagerDelegate 
@optional
- (void)pauseManagerDidPause:(MSPauseManager *)manager;
- (int)respondsToSelector:(SEL)aSelector;
@end

@interface MSPauseManager
{
  id<MSPauseManagerDelegate> _delegate;
}
@end


@implementation MSPauseManager
- (id) Meth {
  if ([_delegate respondsToSelector:@selector(pauseManagerDidPause:)])
    return 0;
  return 0;
}
@end

// rdar://12938616
@class NSXPCConnection;

@interface NSObject
@end

@interface INTF : NSObject
{
  NSXPCConnection *cnx; // Comes in as a parameter.
}
- (void) Meth;
@end

extern SEL MySelector(SEL s);

@implementation INTF
- (void) Meth {
  if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] )
  {
  }

  if( [cnx respondsToSelector:@selector( _setQueueXX: )] ) // No warning here.
  {
  }
  if( [cnx respondsToSelector:(@selector( _setQueueXX: ))] ) // No warning here.
  {
  }
}
@end

// rdar://14007194
@interface UxTechTest : NSObject
- (int) invalidate : (id)Arg;
+ (int) C_invalidate : (int)arg;
@end

@interface UxTechTest(CAT)
- (char) invalidate : (int)arg;
+ (int) C_invalidate : (char)arg;
@end

@interface NSPort : NSObject
- (double) invalidate : (void*)Arg1;
+ (int) C_invalidate : (id*)arg;
@end


@interface USEText : NSPort
- (int) invalidate : (int)arg;
@end

@implementation USEText
- (int) invalidate :(int) arg { return 0; }
@end

@interface USETextSub : USEText
- (int) invalidate : (id)arg;
@end

// rdar://16428638
@interface I16428638
- (int) compare: (I16428638 *) arg1; // commenting out this line avoids the warning
@end

@interface J16428638
- (int) compare: (J16428638 *) arg1;
@end

@implementation J16428638
- (void)method {
    SEL s = @selector(compare:); // spurious warning
    (void)s;
}
- (int) compare: (J16428638 *) arg1 {
    return 0;
}
@end

void test16428638() {
    SEL s = @selector(compare:);
    (void)s;
}