annotate clang/test/CodeGenObjC/dot-syntax-1.m @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +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 -emit-llvm -o %t %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 int printf(const char *, ...);
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 @interface Root
anatofuz
parents:
diff changeset
6 -(id) alloc;
anatofuz
parents:
diff changeset
7 -(id) init;
anatofuz
parents:
diff changeset
8 @end
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 // Property above methods...
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 @interface Top0 : Root
anatofuz
parents:
diff changeset
13 @property(getter=_getX,setter=_setX:) int x;
anatofuz
parents:
diff changeset
14 @end
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 @interface Bot0 : Top0
anatofuz
parents:
diff changeset
17 -(int) x;
anatofuz
parents:
diff changeset
18 -(void) setX: (int) arg;
anatofuz
parents:
diff changeset
19 @end
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 @implementation Top0
anatofuz
parents:
diff changeset
22 -(int) _getX {
anatofuz
parents:
diff changeset
23 printf("-[ Top0 _getX ]\n");
anatofuz
parents:
diff changeset
24 return 0;
anatofuz
parents:
diff changeset
25 }
anatofuz
parents:
diff changeset
26 -(void) _setX: (int) arg {
anatofuz
parents:
diff changeset
27 printf("-[ Top0 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
28 }
anatofuz
parents:
diff changeset
29 @end
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 @implementation Bot0
anatofuz
parents:
diff changeset
32 -(int) x {
anatofuz
parents:
diff changeset
33 printf("-[ Bot0 _getX ]\n");
anatofuz
parents:
diff changeset
34 return 0;
anatofuz
parents:
diff changeset
35 }
anatofuz
parents:
diff changeset
36 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
37 printf("-[ Bot0 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39 @end
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 // Methods above property...
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 @interface Top1 : Root
anatofuz
parents:
diff changeset
44 -(int) x;
anatofuz
parents:
diff changeset
45 -(void) setX: (int) arg;
anatofuz
parents:
diff changeset
46 @end
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 @interface Bot1 : Top1
anatofuz
parents:
diff changeset
49 @property(getter=_getX,setter=_setX:) int x;
anatofuz
parents:
diff changeset
50 @end
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 @implementation Top1
anatofuz
parents:
diff changeset
53 -(int) x {
anatofuz
parents:
diff changeset
54 printf("-[ Top1 x ]\n");
anatofuz
parents:
diff changeset
55 return 0;
anatofuz
parents:
diff changeset
56 }
anatofuz
parents:
diff changeset
57 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
58 printf("-[ Top1 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
59 }
anatofuz
parents:
diff changeset
60 @end
anatofuz
parents:
diff changeset
61
anatofuz
parents:
diff changeset
62 @implementation Bot1
anatofuz
parents:
diff changeset
63 -(int) _getX {
anatofuz
parents:
diff changeset
64 printf("-[ Bot1 _getX ]\n");
anatofuz
parents:
diff changeset
65 return 0;
anatofuz
parents:
diff changeset
66 }
anatofuz
parents:
diff changeset
67 -(void) _setX: (int) arg {
anatofuz
parents:
diff changeset
68 printf("-[ Bot1 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
69 }
anatofuz
parents:
diff changeset
70 @end
anatofuz
parents:
diff changeset
71
anatofuz
parents:
diff changeset
72 // Mixed setter & getter (variant 1)
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 @interface Top2 : Root
anatofuz
parents:
diff changeset
75 -(int) x;
anatofuz
parents:
diff changeset
76 -(void) _setX: (int) arg;
anatofuz
parents:
diff changeset
77 @end
anatofuz
parents:
diff changeset
78
anatofuz
parents:
diff changeset
79 @interface Bot2 : Top2
anatofuz
parents:
diff changeset
80 @property(getter=_getX,setter=_setX:) int x;
anatofuz
parents:
diff changeset
81 @end
anatofuz
parents:
diff changeset
82
anatofuz
parents:
diff changeset
83 @implementation Top2
anatofuz
parents:
diff changeset
84 -(int) x {
anatofuz
parents:
diff changeset
85 printf("-[ Top2 x ]\n");
anatofuz
parents:
diff changeset
86 return 0;
anatofuz
parents:
diff changeset
87 }
anatofuz
parents:
diff changeset
88 -(void) _setX: (int) arg {
anatofuz
parents:
diff changeset
89 printf("-[ Top2 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
90 }
anatofuz
parents:
diff changeset
91 @end
anatofuz
parents:
diff changeset
92
anatofuz
parents:
diff changeset
93 @implementation Bot2
anatofuz
parents:
diff changeset
94 -(int) _getX {
anatofuz
parents:
diff changeset
95 printf("-[ Bot2 _getX ]\n");
anatofuz
parents:
diff changeset
96 return 0;
anatofuz
parents:
diff changeset
97 }
anatofuz
parents:
diff changeset
98 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
99 printf("-[ Bot2 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
100 }
anatofuz
parents:
diff changeset
101 @end
anatofuz
parents:
diff changeset
102
anatofuz
parents:
diff changeset
103 // Mixed setter & getter (variant 2)
anatofuz
parents:
diff changeset
104
anatofuz
parents:
diff changeset
105 @interface Top3 : Root
anatofuz
parents:
diff changeset
106 -(int) _getX;
anatofuz
parents:
diff changeset
107 -(void) setX: (int) arg;
anatofuz
parents:
diff changeset
108 @end
anatofuz
parents:
diff changeset
109
anatofuz
parents:
diff changeset
110 @interface Bot3 : Top3
anatofuz
parents:
diff changeset
111 @property(getter=_getX,setter=_setX:) int x;
anatofuz
parents:
diff changeset
112 @end
anatofuz
parents:
diff changeset
113
anatofuz
parents:
diff changeset
114 @implementation Top3
anatofuz
parents:
diff changeset
115 -(int) _getX {
anatofuz
parents:
diff changeset
116 printf("-[ Top3 _getX ]\n");
anatofuz
parents:
diff changeset
117 return 0;
anatofuz
parents:
diff changeset
118 }
anatofuz
parents:
diff changeset
119 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
120 printf("-[ Top3 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
121 }
anatofuz
parents:
diff changeset
122 @end
anatofuz
parents:
diff changeset
123
anatofuz
parents:
diff changeset
124 @implementation Bot3
anatofuz
parents:
diff changeset
125 -(int) x {
anatofuz
parents:
diff changeset
126 printf("-[ Bot3 x ]\n");
anatofuz
parents:
diff changeset
127 return 0;
anatofuz
parents:
diff changeset
128 }
anatofuz
parents:
diff changeset
129 -(void) _setX: (int) arg {
anatofuz
parents:
diff changeset
130 printf("-[ Bot3 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
131 }
anatofuz
parents:
diff changeset
132 @end
anatofuz
parents:
diff changeset
133
anatofuz
parents:
diff changeset
134 // Mixed setter & getter (variant 3)
anatofuz
parents:
diff changeset
135
anatofuz
parents:
diff changeset
136 @interface Top4 : Root
anatofuz
parents:
diff changeset
137 @property(getter=_getX,setter=_setX:) int x;
anatofuz
parents:
diff changeset
138 @end
anatofuz
parents:
diff changeset
139
anatofuz
parents:
diff changeset
140 @interface Bot4 : Top4
anatofuz
parents:
diff changeset
141 -(int) _getX;
anatofuz
parents:
diff changeset
142 -(void) setX: (int) arg;
anatofuz
parents:
diff changeset
143 @end
anatofuz
parents:
diff changeset
144
anatofuz
parents:
diff changeset
145 @implementation Top4
anatofuz
parents:
diff changeset
146 -(int) x {
anatofuz
parents:
diff changeset
147 printf("-[ Top4 x ]\n");
anatofuz
parents:
diff changeset
148 return 0;
anatofuz
parents:
diff changeset
149 }
anatofuz
parents:
diff changeset
150 -(void) _setX: (int) arg {
anatofuz
parents:
diff changeset
151 printf("-[ Top4 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
152 }
anatofuz
parents:
diff changeset
153 @end
anatofuz
parents:
diff changeset
154
anatofuz
parents:
diff changeset
155 @implementation Bot4
anatofuz
parents:
diff changeset
156 -(int) _getX {
anatofuz
parents:
diff changeset
157 printf("-[ Bot4 _getX ]\n");
anatofuz
parents:
diff changeset
158 return 0;
anatofuz
parents:
diff changeset
159 }
anatofuz
parents:
diff changeset
160 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
161 printf("-[ Bot4 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
162 }
anatofuz
parents:
diff changeset
163 @end
anatofuz
parents:
diff changeset
164
anatofuz
parents:
diff changeset
165 // Mixed setter & getter (variant 4)
anatofuz
parents:
diff changeset
166
anatofuz
parents:
diff changeset
167 @interface Top5 : Root
anatofuz
parents:
diff changeset
168 @property(getter=_getX,setter=_setX:) int x;
anatofuz
parents:
diff changeset
169 @end
anatofuz
parents:
diff changeset
170
anatofuz
parents:
diff changeset
171 @interface Bot5 : Top5
anatofuz
parents:
diff changeset
172 -(int) x;
anatofuz
parents:
diff changeset
173 -(void) _setX: (int) arg;
anatofuz
parents:
diff changeset
174 @end
anatofuz
parents:
diff changeset
175
anatofuz
parents:
diff changeset
176 @implementation Top5
anatofuz
parents:
diff changeset
177 -(int) _getX {
anatofuz
parents:
diff changeset
178 printf("-[ Top5 _getX ]\n");
anatofuz
parents:
diff changeset
179 return 0;
anatofuz
parents:
diff changeset
180 }
anatofuz
parents:
diff changeset
181 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
182 printf("-[ Top5 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
183 }
anatofuz
parents:
diff changeset
184 @end
anatofuz
parents:
diff changeset
185
anatofuz
parents:
diff changeset
186 @implementation Bot5
anatofuz
parents:
diff changeset
187 -(int) x {
anatofuz
parents:
diff changeset
188 printf("-[ Bot5 x ]\n");
anatofuz
parents:
diff changeset
189 return 0;
anatofuz
parents:
diff changeset
190 }
anatofuz
parents:
diff changeset
191 -(void) _setX: (int) arg {
anatofuz
parents:
diff changeset
192 printf("-[ Bot5 _setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
193 }
anatofuz
parents:
diff changeset
194 @end
anatofuz
parents:
diff changeset
195
anatofuz
parents:
diff changeset
196 // Mixed level calls (variant 1)
anatofuz
parents:
diff changeset
197
anatofuz
parents:
diff changeset
198 @interface Top6 : Root
anatofuz
parents:
diff changeset
199 -(int) x;
anatofuz
parents:
diff changeset
200 @end
anatofuz
parents:
diff changeset
201
anatofuz
parents:
diff changeset
202 @interface Bot6 : Top6
anatofuz
parents:
diff changeset
203 -(void) setX: (int) arg;
anatofuz
parents:
diff changeset
204 @end
anatofuz
parents:
diff changeset
205
anatofuz
parents:
diff changeset
206 @implementation Top6
anatofuz
parents:
diff changeset
207 -(int) x {
anatofuz
parents:
diff changeset
208 printf("-[ Top6 x ]\n");
anatofuz
parents:
diff changeset
209 return 0;
anatofuz
parents:
diff changeset
210 }
anatofuz
parents:
diff changeset
211 @end
anatofuz
parents:
diff changeset
212
anatofuz
parents:
diff changeset
213 @implementation Bot6
anatofuz
parents:
diff changeset
214 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
215 printf("-[ Bot5 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
216 }
anatofuz
parents:
diff changeset
217 @end
anatofuz
parents:
diff changeset
218
anatofuz
parents:
diff changeset
219 // Mixed level calls (variant 1)
anatofuz
parents:
diff changeset
220
anatofuz
parents:
diff changeset
221 @interface Top7 : Root
anatofuz
parents:
diff changeset
222 -(void) setX: (int) arg;
anatofuz
parents:
diff changeset
223 @end
anatofuz
parents:
diff changeset
224
anatofuz
parents:
diff changeset
225 @interface Bot7 : Top7
anatofuz
parents:
diff changeset
226 -(int) x;
anatofuz
parents:
diff changeset
227 @end
anatofuz
parents:
diff changeset
228
anatofuz
parents:
diff changeset
229 @implementation Top7
anatofuz
parents:
diff changeset
230 -(void) setX: (int) arg {
anatofuz
parents:
diff changeset
231 printf("-[ Top7 setX: %d ]\n", arg);
anatofuz
parents:
diff changeset
232 }
anatofuz
parents:
diff changeset
233 @end
anatofuz
parents:
diff changeset
234
anatofuz
parents:
diff changeset
235 @implementation Bot7
anatofuz
parents:
diff changeset
236 -(int) x {
anatofuz
parents:
diff changeset
237 printf("-[ Bot7 x ]\n");
anatofuz
parents:
diff changeset
238 return 0;
anatofuz
parents:
diff changeset
239 }
anatofuz
parents:
diff changeset
240 @end
anatofuz
parents:
diff changeset
241
anatofuz
parents:
diff changeset
242 //
anatofuz
parents:
diff changeset
243
anatofuz
parents:
diff changeset
244 // FIXME: Two more (thats it?) interesting cases. Method access on
anatofuz
parents:
diff changeset
245 // getter w/o setter and method access on setter w/o getter.
anatofuz
parents:
diff changeset
246
anatofuz
parents:
diff changeset
247 int main() {
anatofuz
parents:
diff changeset
248 #define test(N) { \
anatofuz
parents:
diff changeset
249 Bot##N *ob = [[Bot##N alloc] init]; \
anatofuz
parents:
diff changeset
250 int x = ob.x; \
anatofuz
parents:
diff changeset
251 ob.x = 10; }
anatofuz
parents:
diff changeset
252
anatofuz
parents:
diff changeset
253 test(0);
anatofuz
parents:
diff changeset
254 test(1);
anatofuz
parents:
diff changeset
255 test(2);
anatofuz
parents:
diff changeset
256 test(3);
anatofuz
parents:
diff changeset
257 test(4);
anatofuz
parents:
diff changeset
258 test(5);
anatofuz
parents:
diff changeset
259 // test(6);
anatofuz
parents:
diff changeset
260 // test(7);
anatofuz
parents:
diff changeset
261
anatofuz
parents:
diff changeset
262 return 0;
anatofuz
parents:
diff changeset
263 }
anatofuz
parents:
diff changeset
264