annotate clang/test/SemaObjC/selector-1.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -Wselector-type-mismatch -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 @interface I
anatofuz
parents:
diff changeset
4 - (id) compare: (char) arg1; // expected-note {{method 'compare:' declared here}}
anatofuz
parents:
diff changeset
5 - length;
anatofuz
parents:
diff changeset
6 @end
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 @interface J
anatofuz
parents:
diff changeset
9 - (id) compare: (id) arg1; // expected-note {{method 'compare:' declared here}}
anatofuz
parents:
diff changeset
10 @end
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 SEL func()
anatofuz
parents:
diff changeset
13 {
anatofuz
parents:
diff changeset
14 return @selector(compare:); // expected-warning {{several methods with selector 'compare:' of mismatched types are found for the @selector expression}}
anatofuz
parents:
diff changeset
15 }
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 // rdar://16458579
anatofuz
parents:
diff changeset
18 void Test16458579() {
anatofuz
parents:
diff changeset
19 SEL s = @selector((retain));
anatofuz
parents:
diff changeset
20 SEL s1 = @selector((meth1:));
anatofuz
parents:
diff changeset
21 SEL s2 = @selector((retainArgument::));
anatofuz
parents:
diff changeset
22 SEL s3 = @selector((retainArgument:::::));
anatofuz
parents:
diff changeset
23 SEL s4 = @selector((retainArgument:with:));
anatofuz
parents:
diff changeset
24 SEL s5 = @selector((meth1:with:with:));
anatofuz
parents:
diff changeset
25 SEL s6 = @selector((getEnum:enum:bool:));
anatofuz
parents:
diff changeset
26 SEL s7 = @selector((char:float:double:unsigned:short:long:));
anatofuz
parents:
diff changeset
27 SEL s9 = @selector((:enum:bool:));
anatofuz
parents:
diff changeset
28 }
anatofuz
parents:
diff changeset
29 int main() {
anatofuz
parents:
diff changeset
30 SEL s = @selector(retain);
anatofuz
parents:
diff changeset
31 SEL s1 = @selector(meth1:);
anatofuz
parents:
diff changeset
32 SEL s2 = @selector(retainArgument::);
anatofuz
parents:
diff changeset
33 SEL s3 = @selector(retainArgument:::::);
anatofuz
parents:
diff changeset
34 SEL s4 = @selector(retainArgument:with:);
anatofuz
parents:
diff changeset
35 SEL s5 = @selector(meth1:with:with:);
anatofuz
parents:
diff changeset
36 SEL s6 = @selector(getEnum:enum:bool:);
anatofuz
parents:
diff changeset
37 SEL s7 = @selector(char:float:double:unsigned:short:long:);
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 SEL s9 = @selector(:enum:bool:);
anatofuz
parents:
diff changeset
40 }
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 // rdar://15794055
anatofuz
parents:
diff changeset
43 @interface NSObject @end
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 @class NSNumber;
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 @interface XBRecipe : NSObject
anatofuz
parents:
diff changeset
48 @property (nonatomic, assign) float finalVolume; // expected-note {{method 'setFinalVolume:' declared here}}
anatofuz
parents:
diff changeset
49 @end
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 @interface XBDocument : NSObject
anatofuz
parents:
diff changeset
52 @end
anatofuz
parents:
diff changeset
53
anatofuz
parents:
diff changeset
54 @interface XBDocument ()
anatofuz
parents:
diff changeset
55 - (void)setFinalVolume:(NSNumber *)finalVolumeNumber; // expected-note {{method 'setFinalVolume:' declared here}}
anatofuz
parents:
diff changeset
56 @end
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 @implementation XBDocument
anatofuz
parents:
diff changeset
59 - (void)setFinalVolume:(NSNumber *)finalVolumeNumber
anatofuz
parents:
diff changeset
60 {
anatofuz
parents:
diff changeset
61 (void)@selector(setFinalVolume:); // expected-warning {{several methods with selector 'setFinalVolume:' of mismatched types are found for the @selector expression}}
anatofuz
parents:
diff changeset
62 }
anatofuz
parents:
diff changeset
63 @end