Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Index / Core / index-source.m
bloba551fe965bb0bd1175fa53bdf1766d90cbd50981
1 // XFAIL: target={{.*}}-aix{{.*}}
2 // RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
3 // RUN: c-index-test core -print-source-symbols -include-locals -- %s -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=LOCAL %s
5 @interface Base
6 // CHECK: [[@LINE-1]]:12 | class/ObjC | Base | [[BASE_USR:.*]] | _OBJC_CLASS_$_Base | Decl | rel: 0
7 -(void)meth;
8 // CHECK: [[@LINE-1]]:8 | instance-method/ObjC | meth | c:objc(cs)Base(im)meth | -[Base meth] | Decl,Dyn,RelChild | rel: 1
9 // CHECK-NEXT: RelChild | Base | c:objc(cs)Base
10 +(Base*)class_meth;
11 // CHECK: [[@LINE-1]]:9 | class-method/ObjC | class_meth | c:objc(cs)Base(cm)class_meth | +[Base class_meth] | Decl,Dyn,RelChild | rel: 1
12 // CHECK: [[@LINE-2]]:3 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1
13 // CHECK-NEXT: RelCont | class_meth | c:objc(cs)Base(cm)class_meth
15 @end
17 void foo();
18 // CHECK: [[@LINE+6]]:6 | function/C | goo | c:@F@goo | _goo | Def | rel: 0
19 // CHECK: [[@LINE+5]]:10 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1
20 // CHECK-NEXT: RelCont | goo | c:@F@goo
21 // CHECK-NOT: [[@LINE+3]]:16 | param
22 // LOCAL: [[@LINE+2]]:16 | param(local)/C | b | [[b_USR:c:.*]] | _b | Def,RelChild | rel: 1
23 // LOCAL-NEXT: RelChild | goo | c:@F@goo
24 void goo(Base *b) {
25   // CHECK-NOT: [[@LINE+6]]:7 | variable
26   // LOCAL: [[@LINE+5]]:7 | variable(local)/C | x | [[x_USR:c:.*]] | _x | Def,RelCont | rel: 1
27   // LOCAL-NEXT: RelCont | goo | c:@F@goo
28   // CHECK-NOT: [[@LINE+3]]:11 | param
29   // LOCAL: [[@LINE+2]]:11 | param(local)/C | b | [[b_USR]] | _b | Ref,Read,RelCont | rel: 1
30   // LOCAL-NEXT: RelCont | x | [[x_USR]]
31   int x = b;
32   // CHECK-NOT: [[@LINE+5]]:7 | variable
33   // LOCAL: [[@LINE+4]]:7 | variable(local)/C | y | [[y_USR:c:.*]] | _y | Def,RelCont | rel: 1
34   // CHECK-NOT: [[@LINE+3]]:11 | variable
35   // LOCAL: [[@LINE+2]]:11 | variable(local)/C | x | [[x_USR]] | _x | Ref,Read,RelCont | rel: 1
36   // LOCAL-NEXT: RelCont | y | [[y_USR]]
37   int y = x;
39   // CHECK-NOT: [[@LINE+1]]:10 | struct
40   // LOCAL: [[@LINE+1]]:10 | struct(local)/C | Foo | c:{{.*}} | <no-cgname> | Def,RelCont | rel: 1
41   struct Foo {
42     int i;
43   };
45   // CHECK: [[@LINE+2]]:3 | function/C | foo | c:@F@foo | _foo | Ref,Call,RelCall,RelCont | rel: 1
46   // CHECK-NEXT: RelCall,RelCont | goo | c:@F@goo
47   foo();
48   // CHECK: [[@LINE+3]]:6 | instance-method/ObjC | meth | c:objc(cs)Base(im)meth | -[Base meth] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2
49   // CHECK-NEXT: RelCall,RelCont | goo | c:@F@goo
50   // CHECK-NEXT: RelRec | Base | c:objc(cs)Base
51   [b meth];
53   // CHECK: [[@LINE+2]]:4 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1
54   // CHECK-NEXT: RelCont | goo | c:@F@goo
55   [Base class_meth];
57   // CHECK: [[@LINE+4]]:3 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1
58   // CHECK-NEXT: RelCont | goo | c:@F@goo
59   // CHECK: [[@LINE+2]]:14 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1
60   // CHECK-NEXT: RelCont | goo | c:@F@goo
61   Base *f = (Base *) 2;
64 // CHECK: [[@LINE+1]]:11 | protocol/ObjC | Prot1 | [[PROT1_USR:.*]] | <no-cgname> | Decl | rel: 0
65 @protocol Prot1
66 @end
68 // CHECK: [[@LINE+3]]:11 | protocol/ObjC | Prot2 | c:objc(pl)Prot2 | <no-cgname> | Decl | rel: 0
69 // CHECK: [[@LINE+2]]:17 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase,RelCont | rel: 1
70 // CHECK-NEXT: RelBase,RelCont | Prot2 | c:objc(pl)Prot2
71 @protocol Prot2<Prot1>
72 @end
74 // CHECK: [[@LINE+7]]:12 | class/ObjC | Sub | c:objc(cs)Sub | _OBJC_CLASS_$_Sub | Decl | rel: 0
75 // CHECK: [[@LINE+6]]:18 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelBase,RelCont | rel: 1
76 // CHECK-NEXT: RelBase,RelCont | Sub | c:objc(cs)Sub
77 // CHECK: [[@LINE+4]]:23 | protocol/ObjC | Prot2 | c:objc(pl)Prot2 | <no-cgname> | Ref,RelBase,RelCont | rel: 1
78 // CHECK-NEXT: RelBase,RelCont | Sub | c:objc(cs)Sub
79 // CHECK: [[@LINE+2]]:30 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase,RelCont | rel: 1
80 // CHECK-NEXT: RelBase,RelCont | Sub | c:objc(cs)Sub
81 @interface Sub : Base<Prot2, Prot1>
82 @end
84 @interface NSArray<ObjectType> : Base
85 // CHECK-NOT: ObjectType
86 -(ObjectType)getit;
87 @end
89 // CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#I# | __Z9over_funci | Decl | rel: 0
90 void over_func(int x) __attribute__((overloadable));
91 // CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#f# | __Z9over_funcf | Decl | rel: 0
92 void over_func(float x) __attribute__((overloadable));
94 // CHECK: [[@LINE+1]]:6 | enum/C | MyEnum | c:@E@MyEnum | <no-cgname> | Def | rel: 0
95 enum MyEnum {
96   // CHECK: [[@LINE+2]]:3 | enumerator/C | EnumeratorInNamed | c:@E@MyEnum@EnumeratorInNamed | <no-cgname> | Def,RelChild | rel: 1
97   // CHECK-NEXT: RelChild | MyEnum | c:@E@MyEnum
98   EnumeratorInNamed
101 // CHECK: [[@LINE+1]]:1 | enum/C | <no-name> | c:@Ea@One | <no-cgname> | Def | rel: 0
102 enum {
103   // CHECK: [[@LINE+2]]:3 | enumerator/C | One | c:@Ea@One@One | <no-cgname> | Def,RelChild | rel: 1
104   // CHECK-NEXT: RelChild | <no-name> | c:@Ea@One
105   One,
106   // CHECK: [[@LINE+2]]:3 | enumerator/C | Two | c:@Ea@One@Two | <no-cgname> | Def,RelChild | rel: 1
107   // CHECK-NEXT: RelChild | <no-name> | c:@Ea@One
108   Two,
111 // CHECK: [[@LINE+1]]:13 | type-alias/C | jmp_buf | c:index-source.m@T@jmp_buf | <no-cgname> | Def | rel: 0
112 typedef int jmp_buf[(18)];
113 // CHECK: [[@LINE+3]]:12 | function/C | setjmp | c:@F@setjmp | _setjmp | Decl | rel: 0
114 // CHECK: [[@LINE+2]]:19 | type-alias/C | jmp_buf | c:index-source.m@T@jmp_buf | <no-cgname> | Ref,RelCont | rel: 1
115 // CHECK-NEXT: RelCont | setjmp | c:@F@setjmp
116 extern int setjmp(jmp_buf);
118 @class I1;
119 @interface I1
120 // CHECK: [[@LINE+1]]:8 | instance-method/ObjC | meth | c:objc(cs)I1(im)meth | -[I1 meth] | Decl,Dyn,RelChild | rel: 1
121 -(void)meth;
122 @end
124 @interface I2
125 // CHECK: [[@LINE-1]]:12 | class/ObjC | I2 | [[I2_USR:.*]] | {{.*}} | Decl | rel: 0
127 @property (readwrite) id prop;
128 // CHECK: [[@LINE-1]]:26 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR:.*]] | -[I2 prop] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
129 // CHECK: [[@LINE-2]]:26 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR:.*]] | -[I2 setProp:] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
130 // CHECK: [[@LINE-3]]:26 | instance-property/ObjC | prop | [[I2_prop_USR:.*]] | <no-cgname> | Decl,RelChild | rel: 1
132 @property (readwrite, getter=customGet, setter=customSet:) id unrelated;
133 // CHECK: [[@LINE-1]]:30 | instance-method/acc-get/ObjC | customGet | {{.*}} | -[I2 customGet] | Decl,Dyn,RelChild,RelAcc | rel: 2
134 // CHECK: [[@LINE-2]]:48 | instance-method/acc-set/ObjC | customSet: | {{.*}} | -[I2 customSet:] | Decl,Dyn,RelChild,RelAcc | rel: 2
135 // CHECK: [[@LINE-3]]:63 | instance-property/ObjC | unrelated | {{.*}} | <no-cgname> | Decl,RelChild | rel: 1
137 -(id)declaredGet;
138 @property (readwrite, getter=declaredGet) id otherProp;
139 // CHECK: [[@LINE-1]]:30 | instance-method/acc-get/ObjC | declaredGet | {{.*}} | -[I2 declaredGet] | Ref,RelCont | rel: 1
140 // CHECK: [[@LINE-3]]:6 | instance-method/acc-get/ObjC | declaredGet | {{.*}} | -[I2 declaredGet] | Decl,Dyn,RelChild,RelAcc | rel: 2
141 // CHECK: [[@LINE-3]]:46 | instance-method/acc-set/ObjC | setOtherProp: | {{.*}} | -[I2 setOtherProp:] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
143 // CHECK: [[@LINE+4]]:63 | instance-property(IB,IBColl)/ObjC | buttons | [[buttons_USR:.*]] | <no-cgname> | Decl,RelChild | rel: 1
144 // CHECK-NEXT: RelChild | I2 | [[I2_USR]]
145 // CHECK: [[@LINE+2]]:50 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont,RelIBType | rel: 1
146 // CHECK-NEXT: RelCont,RelIBType | buttons | [[buttons_USR]]
147 @property (nonatomic, strong) IBOutletCollection(I1) NSArray *buttons;
148 @end
150 @implementation I2
151 // CHECK: [[@LINE+9]]:13 | instance-property/ObjC | prop | [[I2_prop_USR:.*]] | <no-cgname> | Def,RelChild,RelAcc | rel: 2
152 // CHECK-NEXT: RelChild | I2 | [[I2_USR]]
153 // CHECK-NEXT: RelAcc | _prop | c:objc(cs)I2@_prop
154 // CHECK: [[@LINE+6]]:13 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR]] | -[I2 prop] | Def,Dyn,Impl,RelChild | rel: 1
155 // CHECK-NEXT: RelChild | I2 | [[I2_USR]]
156 // CHECK: [[@LINE+4]]:13 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR]] | -[I2 setProp:] | Def,Dyn,Impl,RelChild | rel: 1
157 // CHECK-NEXT: RelChild | I2 | [[I2_USR]]
158 // CHECK: [[@LINE+2]]:20 | field/ObjC | _prop | c:objc(cs)I2@_prop | <no-cgname> | Def,RelChild | rel: 1
159 // CHECK-NEXT: RelChild | I2 | [[I2_USR]]
160 @synthesize prop = _prop;
162 // CHECK: [[@LINE+11]]:12 | instance-method(IB)/ObjC | doAction:foo: | [[doAction_USR:.*]] | -[I2 doAction:foo:] | Def,Dyn,RelChild | rel: 1
163 // CHECK-NEXT: RelChild | I2 | [[I2_USR]]
164 // CHECK: [[@LINE+9]]:22 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont,RelIBType | rel: 1
165 // CHECK-NEXT: RelCont,RelIBType | doAction:foo: | [[doAction_USR]]
166 // CHECK-NOT: [[@LINE+7]]:27 | param
167 // LOCAL: [[@LINE+6]]:27 | param(local)/C | sender | c:{{.*}} | _sender | Def,RelChild | rel: 1
168 // LOCAL-NEXT: RelChild | doAction:foo: | [[doAction_USR:.*]]
169 // CHECK: [[@LINE+4]]:39 | class/ObjC | I1 | c:objc(cs)I1 | _OBJC_CLASS_$_I1 | Ref,RelCont | rel: 1
170 // CHECK-NOT: [[@LINE+3]]:44 | param
171 // LOCAL: [[@LINE+2]]:44 | param(local)/C | bar | c:{{.*}} | _bar | Def,RelChild | rel: 1
172 // LOCAL-NEXT: RelChild | doAction:foo: | [[doAction_USR]]
173 -(IBAction)doAction:(I1 *)sender foo:(I1 *)bar {
174   [self prop];
175   // CHECK: [[@LINE-1]]:9 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR]] | -[I2 prop] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2
176   // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]]
177   // CHECK-NEXT: RelRec | I2 | [[I2_USR]]
179   [self setProp: bar];
180   // CHECK: [[@LINE-1]]:9 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR]] | -[I2 setProp:] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2
181   // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]]
182   // CHECK-NEXT: RelRec | I2 | [[I2_USR]]
184   self.prop;
185   // CHECK: [[@LINE-1]]:8 | instance-property/ObjC | prop | [[I2_prop_USR]] | <no-cgname> | Ref,RelCont | rel: 1
186   // CHECK-NEXT: RelCont | doAction:foo: | [[doAction_USR]]
187   // CHECK: [[@LINE-3]]:8 | instance-method/acc-get/ObjC | prop | [[I2_prop_getter_USR]] | -[I2 prop] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2
188   // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]]
189   // CHECK-NEXT: RelRec | I2 | [[I2_USR]]
191   self.prop = self.prop;
192   // CHECK: [[@LINE-1]]:8 | instance-property/ObjC | prop | [[I2_prop_USR]] | <no-cgname> | Ref,Writ,RelCont | rel: 1
193   // CHECK-NEXT: RelCont | doAction:foo: | [[doAction_USR]]
194   // CHECK:[[@LINE-3]]:8 | instance-method/acc-set/ObjC | setProp: | [[I2_prop_setter_USR]] | -[I2 setProp:] | Ref,Call,Dyn,Impl,RelRec,RelCall,RelCont | rel: 2
195   // CHECK-NEXT: RelCall,RelCont | doAction:foo: | [[doAction_USR]]
196   // CHECK-NEXT: RelRec | I2 | [[I2_USR]]
198 @end
200 @interface I3
201 @property (readwrite) id prop;
202 // CHECK: [[@LINE+3]]:6 | instance-method/acc-get/ObjC | prop | c:objc(cs)I3(im)prop | -[I3 prop] | Decl,Dyn,RelChild,RelAcc | rel: 2
203 // CHECK-NEXT: RelChild | I3 | c:objc(cs)I3
204 // CHECK-NEXT: RelAcc | prop | c:objc(cs)I3(py)prop
205 -(id)prop;
206 // CHECK: [[@LINE+4]]:8 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Decl,Dyn,RelChild,RelAcc | rel: 2
207 // CHECK-NEXT: RelChild | I3 | c:objc(cs)I3
208 // CHECK-NEXT: RelAcc | prop | c:objc(cs)I3(py)prop
209 // LOCAL-NOT: [[@LINE+1]]:20 | param
210 -(void)setProp:(id)p;
211 @end
213 // CHECK: [[@LINE+1]]:17 | class/ObjC | I3 | c:objc(cs)I3 | <no-cgname> | Def | rel: 0
214 @implementation I3
215 // CHECK: [[@LINE+5]]:13 | instance-property/ObjC | prop | c:objc(cs)I3(py)prop | <no-cgname> | Def,RelChild,RelAcc | rel: 2
216 // CHECK-NEXT: RelChild | I3 | c:objc(cs)I3
217 // CHECK-NEXT: RelAcc | _prop | c:objc(cs)I3@_prop
218 // CHECK: [[@LINE+2]]:13 | instance-method/acc-get/ObjC | prop | c:objc(cs)I3(im)prop | -[I3 prop] | Def,Dyn,Impl,RelChild | rel: 1
219 // CHECK: [[@LINE+1]]:13 | instance-method/acc-set/ObjC | setProp: | c:objc(cs)I3(im)setProp: | -[I3 setProp:] | Def,Dyn,Impl,RelChild | rel: 1
220 @synthesize prop = _prop;
221 @end
223 // CHECK: [[@LINE+5]]:12 | class/ObjC | I3 | c:objc(cs)I3 | _OBJC_CLASS_$_I3 | Ref,RelExt,RelCont | rel: 1
224 // CHECK-NEXT: RelExt,RelCont | bar | c:objc(cy)I3@bar
225 // CHECK: [[@LINE+3]]:15 | extension/ObjC | bar | c:objc(cy)I3@bar | <no-cgname> | Decl | rel: 0
226 // CHECK: [[@LINE+2]]:21 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase,RelCont | rel: 1
227 // CHECK-NEXT: RelBase,RelCont | bar | c:objc(cy)I3@bar
228 @interface I3(bar) <Prot1>
229 @end
231 // CHECK: [[@LINE+2]]:17 | class/ObjC | I3 | c:objc(cs)I3 | _OBJC_CLASS_$_I3 | Ref,RelCont | rel: 1
232 // CHECK: [[@LINE+1]]:20 | extension/ObjC | bar | c:objc(cy)I3@bar | <no-cgname> | Def | rel: 0
233 @implementation I3(bar)
234 @end
236 // CHECK-NOT: [[@LINE+1]]:12 | extension/ObjC |
237 @interface NonExistent()
238 @end
240 @interface MyGenCls<ObjectType> : Base
241 @end
243 @protocol MyEnumerating
244 @end
246 // CHECK: [[@LINE+4]]:41 | type-alias/C | MyEnumerator | [[MyEnumerator_USR:.*]] | <no-cgname> | Def | rel: 0
247 // CHECK: [[@LINE+3]]:26 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,RelCont | rel: 1
248 // CHECK: [[@LINE+2]]:9 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref,RelCont | rel: 1
249 // CHECK: [[@LINE+1]]:18 | class/ObjC | Base | c:objc(cs)Base | _OBJC_CLASS_$_Base | Ref,RelCont | rel: 1
250 typedef MyGenCls<Base *><MyEnumerating> MyEnumerator;
252 // CHECK: [[@LINE+7]]:12 | class/ObjC | PermanentEnumerator | [[PermanentEnumerator_USR:.*]] | _OBJC_CLASS_$_PermanentEnumerator | Decl | rel: 0
253 // CHECK: [[@LINE+6]]:34 | type-alias/C | MyEnumerator | [[MyEnumerator_USR]] | <no-cgname> | Ref,RelCont | rel: 1
254 // CHECK-NEXT: RelCont | PermanentEnumerator | [[PermanentEnumerator_USR]]
255 // CHECK: [[@LINE+4]]:34 | class/ObjC | MyGenCls | c:objc(cs)MyGenCls | _OBJC_CLASS_$_MyGenCls | Ref,Impl,RelBase,RelCont | rel: 1
256 // CHECK-NEXT: RelBase,RelCont | PermanentEnumerator | [[PermanentEnumerator_USR]]
257 // CHECK: [[@LINE+2]]:34 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,Impl,RelBase,RelCont | rel: 1
258 // CHECK-NEXT: RelBase,RelCont | PermanentEnumerator | [[PermanentEnumerator_USR]]
259 @interface PermanentEnumerator : MyEnumerator
260 @end
262 // CHECK: [[@LINE+2]]:48 | protocol/ObjC | Prot1 | c:objc(pl)Prot1 | <no-cgname> | Ref,RelBase,RelCont | rel: 1
263 // CHECK: [[@LINE+1]]:35 | protocol/ObjC | MyEnumerating | c:objc(pl)MyEnumerating | <no-cgname> | Ref,Impl,RelBase,RelCont | rel: 1
264 @interface PermanentEnumerator2 : MyEnumerator<Prot1>
265 @end
267 @interface I4
268 @property id foo;
269 @end
271 @implementation I4 {
272   id _blahfoo; // explicit def
273   // CHECK: [[@LINE-1]]:6 | field/ObjC | _blahfoo | c:objc(cs)I4@_blahfoo | <no-cgname> | Def,RelChild | rel: 1
275 @synthesize foo = _blahfoo; // ref of field _blahfoo
276 // CHECK: [[@LINE-1]]:13 | instance-property/ObjC | foo | c:objc(cs)I4(py)foo | <no-cgname> | Def,RelChild,RelAcc | rel: 2
277 // CHECK-NEXT: RelChild | I4 | c:objc(cs)I4
278 // CHECK-NEXT: RelAcc | _blahfoo | c:objc(cs)I4@_blahfoo
279 // CHECK: [[@LINE-4]]:13 | instance-method/acc-get/ObjC | foo | c:objc(cs)I4(im)foo | -[I4 foo] | Def,Dyn,Impl,RelChild | rel: 1
280 // CHECK-NEXT: RelChild | I4 | c:objc(cs)I4
281 // CHECK: [[@LINE-6]]:13 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I4(im)setFoo: | -[I4 setFoo:] | Def,Dyn,Impl,RelChild | rel: 1
282 // CHECK-NEXT: RelChild | I4 | c:objc(cs)I4
283 // CHECK: [[@LINE-8]]:19 | field/ObjC | _blahfoo | c:objc(cs)I4@_blahfoo | <no-cgname> | Ref | rel: 0
285 -(void)method {
286   _blahfoo = 0;
287   // CHECK: [[@LINE-1]]:3 | field/ObjC | _blahfoo | c:objc(cs)I4@_blahfoo | <no-cgname> | Ref,Writ,RelCont | rel: 1
289 @end
291 @interface I5
292 @property id foo;
293 @end
295 @implementation I5
296 @synthesize foo = _blahfoo; // explicit def of field _blahfoo
297 // CHECK: [[@LINE-1]]:13 | instance-property/ObjC | foo | c:objc(cs)I5(py)foo | <no-cgname> | Def,RelChild,RelAcc | rel: 2
298 // CHECK-NEXT: RelChild | I5 | c:objc(cs)I5
299 // CHECK-NEXT: RelAcc | _blahfoo | c:objc(cs)I5@_blahfoo
300 // CHECK: [[@LINE-4]]:13 | instance-method/acc-get/ObjC | foo | c:objc(cs)I5(im)foo | -[I5 foo] | Def,Dyn,Impl,RelChild | rel: 1
301 // CHECK-NEXT: RelChild | I5 | c:objc(cs)I5
302 // CHECK: [[@LINE-6]]:13 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I5(im)setFoo: | -[I5 setFoo:] | Def,Dyn,Impl,RelChild | rel: 1
303 // CHECK-NEXT: RelChild | I5 | c:objc(cs)I5
304 // CHECK: [[@LINE-8]]:19 | field/ObjC | _blahfoo | c:objc(cs)I5@_blahfoo | <no-cgname> | Def,RelChild | rel: 1
306 -(void)method {
307   _blahfoo = 0;
308   // CHECK: [[@LINE-1]]:3 | field/ObjC | _blahfoo | c:objc(cs)I5@_blahfoo | <no-cgname> | Ref,Writ,RelCont | rel: 1
310 @end
312 @interface I6
313 @property id foo;
314 @end
316 @implementation I6
317 @synthesize foo; // implicit def of field foo
318 // CHECK: [[@LINE-1]]:13 | instance-property/ObjC | foo | c:objc(cs)I6(py)foo | <no-cgname> | Def,RelChild,RelAcc | rel: 2
319 // CHECK-NEXT: RelChild | I6 | c:objc(cs)I6
320 // CHECK-NEXT: RelAcc | foo | c:objc(cs)I6@foo
321 // CHECK: [[@LINE-4]]:13 | instance-method/acc-get/ObjC | foo | c:objc(cs)I6(im)foo | -[I6 foo] | Def,Dyn,Impl,RelChild | rel: 1
322 // CHECK-NEXT: RelChild | I6 | c:objc(cs)I6
323 // CHECK: [[@LINE-6]]:13 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I6(im)setFoo: | -[I6 setFoo:] | Def,Dyn,Impl,RelChild | rel: 1
324 // CHECK-NEXT: RelChild | I6 | c:objc(cs)I6
325 // CHECK: [[@LINE-8]]:13 | field/ObjC | foo | c:objc(cs)I6@foo | <no-cgname> | Def,Impl,RelChild | rel: 1
327 -(void)method {
328   foo = 0;
329   // CHECK: [[@LINE-1]]:3 | field/ObjC | foo | c:objc(cs)I6@foo | <no-cgname> | Ref,Writ,RelCont | rel: 1
331 @end
333 @interface I7
334 @property id foo;
335 @end
337 @implementation I7 // implicit def of field _foo
338 // CHECK: [[@LINE-1]]:17 | instance-property/ObjC | foo | c:objc(cs)I7(py)foo | <no-cgname> | Def,Impl,RelChild,RelAcc | rel: 2
339 // CHECK-NEXT: RelChild | I7 | c:objc(cs)I7
340 // CHECK-NEXT: RelAcc | _foo | c:objc(cs)I7@_foo
341 // CHECK: [[@LINE-4]]:17 | instance-method/acc-get/ObjC | foo | c:objc(cs)I7(im)foo | -[I7 foo] | Def,Dyn,Impl,RelChild | rel: 1
342 // CHECK-NEXT: RelChild | I7 | c:objc(cs)I7
343 // CHECK: [[@LINE-6]]:17 | instance-method/acc-set/ObjC | setFoo: | c:objc(cs)I7(im)setFoo: | -[I7 setFoo:] | Def,Dyn,Impl,RelChild | rel: 1
344 // CHECK-NEXT: RelChild | I7 | c:objc(cs)I7
345 // CHECK: [[@LINE-8]]:17 | field/ObjC | _foo | c:objc(cs)I7@_foo | <no-cgname> | Def,Impl,RelChild | rel: 1
347 -(void)method {
348   _foo = 0;
349 // CHECK: [[@LINE-1]]:3 | field/ObjC | _foo | c:objc(cs)I7@_foo | <no-cgname> | Ref,Writ,RelCont | rel: 1
351 @end
353 #define NS_ENUM(_name, _type) enum _name:_type _name; enum _name : _type
355 typedef NS_ENUM(AnotherEnum, int) {
356 // CHECK-NOT: [[@LINE-1]]:17 | type-alias/C | AnotherEnum |
357 // CHECK-NOT: [[@LINE-2]]:17 | {{.*}} | Ref
358 // CHECK: [[@LINE-3]]:17 | enum/C | AnotherEnum | [[AnotherEnum_USR:.*]] | {{.*}} | Def | rel: 0
359   AnotherEnumFirst = 0,
360   AnotherEnumSecond = 1,
361   AnotherEnumThird = 2,
364 AnotherEnum anotherT;
365 // CHECK: [[@LINE-1]]:1 | enum/C | AnotherEnum | [[AnotherEnum_USR]] | {{.*}} | Ref,RelCont | rel: 1
366 enum AnotherEnum anotherE;
367 // CHECK: [[@LINE-1]]:6 | enum/C | AnotherEnum | [[AnotherEnum_USR]] | {{.*}} | Ref,RelCont | rel: 1
369 #define TRANSPARENT(_name) struct _name _name; struct _name
370 #define OPAQUE(_name) struct _name *_name; struct _name
372 typedef TRANSPARENT(AStruct) {
373   int x;
376 AStruct aStructT;
377 // CHECK: [[@LINE-1]]:1 | struct/C | AStruct | {{.*}} | {{.*}} | Ref,RelCont | rel: 1
378 struct AStruct aStructS;
379 // CHECK: [[@LINE-1]]:8 | struct/C | AStruct | {{.*}} | {{.*}} | Ref,RelCont | rel: 1
381 typedef OPAQUE(Separate) {
382   int x;
385 Separate separateT;
386 // CHECK: [[@LINE-1]]:1 | type-alias/C | Separate | {{.*}} | {{.*}} | Ref,RelCont | rel: 1
387 struct Separate separateE;
388 // CHECK: [[@LINE-1]]:8 | struct/C | Separate | {{.*}} | {{.*}} | Ref,RelCont | rel: 1
390 @interface ClassReceivers
392 @property(class) int p1;
393 // CHECK: [[@LINE-1]]:22 | class-method/acc-get/ObjC | p1 | c:objc(cs)ClassReceivers(cm)p1 | +[ClassReceivers p1] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
394 // CHECK-NEXT: RelChild | ClassReceivers | c:objc(cs)ClassReceivers
395 // CHECK-NEXT: RelAcc | p1 | c:objc(cs)ClassReceivers(cpy)p1
396 // CHECK: [[@LINE-4]]:22 | class-method/acc-set/ObjC | setP1: | c:objc(cs)ClassReceivers(cm)setP1: | +[ClassReceivers setP1:] | Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
397 // CHECK-NEXT: RelChild | ClassReceivers | c:objc(cs)ClassReceivers
398 // CHECK-NEXT: RelAcc | p1 | c:objc(cs)ClassReceivers(cpy)p1
399 // CHECK: [[@LINE-7]]:22 | instance-property/ObjC | p1 | c:objc(cs)ClassReceivers(cpy)p1 | <no-cgname> | Decl,RelChild | rel: 1
400 // CHECK-NEXT: RelChild | ClassReceivers | c:objc(cs)ClassReceivers
402 + (int)implicit;
403 + (void)setImplicit:(int)x;
405 @end
407 void classReceivers() {
408   ClassReceivers.p1 = 0;
409 // CHECK: [[@LINE-1]]:18 | instance-property/ObjC | p1 | c:objc(cs)ClassReceivers(cpy)p1 | <no-cgname> | Ref,Writ,RelCont | rel: 1
410 // CHECK-NEXT: RelCont | classReceivers | c:@F@classReceivers
411 // CHECK: [[@LINE-3]]:3 | class/ObjC | ClassReceivers | c:objc(cs)ClassReceivers | _OBJC_CLASS_$_ClassReceivers | Ref,RelCont | rel: 1
412 // CHECK: [[@LINE-4]]:18 | class-method/acc-set/ObjC | setP1: | c:objc(cs)ClassReceivers(cm)setP1: | +[ClassReceivers setP1:] | Ref,Call,Impl,RelCall,RelCont | rel: 1
413 // CHECK-NEXT: RelCall,RelCont | classReceivers | c:@F@classReceivers
414   (void)ClassReceivers.p1;
415 // CHECK: [[@LINE-1]]:24 | instance-property/ObjC | p1 | c:objc(cs)ClassReceivers(cpy)p1 | <no-cgname> | Ref,RelCont | rel: 1
416 // CHECK-NEXT: RelCont | classReceivers | c:@F@classReceivers
417 // CHECK: [[@LINE-3]]:9 | class/ObjC | ClassReceivers | c:objc(cs)ClassReceivers | _OBJC_CLASS_$_ClassReceivers | Ref,RelCont | rel: 1
418 // CHECK: [[@LINE-4]]:24 | class-method/acc-get/ObjC | p1 | c:objc(cs)ClassReceivers(cm)p1 | +[ClassReceivers p1] | Ref,Call,Impl,RelCall,RelCont | rel: 1
419 // CHECK-NEXT: RelCall,RelCont | classReceivers | c:@F@classReceivers
421   ClassReceivers.implicit = 0;
422 // CHECK: [[@LINE-1]]:3 | class/ObjC | ClassReceivers | c:objc(cs)ClassReceivers | _OBJC_CLASS_$_ClassReceivers | Ref,RelCont | rel: 1
423   (void)ClassReceivers.implicit;
424 // CHECK: [[@LINE-1]]:9 | class/ObjC | ClassReceivers | c:objc(cs)ClassReceivers | _OBJC_CLASS_$_ClassReceivers | Ref,RelCont | rel: 1
427 @interface ImplicitProperties
429 - (int)implicit;
430 - (void)setImplicit:(int)x;
432 + (int)classImplicit;
433 + (void)setClassImplicit:(int)y;
435 @end
437 void testImplicitProperties(ImplicitProperties *c) {
438   c.implicit = 0;
439 // CHECK: [[@LINE-1]]:5 | instance-method/ObjC | setImplicit: | c:objc(cs)ImplicitProperties(im)setImplicit: | -[ImplicitProperties setImplicit:] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2
440 // CHECK-NEXT: RelCall,RelCont | testImplicitProperties | c:@F@testImplicitProperties
441   c.implicit;
442 // CHECK: [[@LINE-1]]:5 | instance-method/ObjC | implicit | c:objc(cs)ImplicitProperties(im)implicit | -[ImplicitProperties implicit] | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 2
443 // CHECK-NEXT: RelCall,RelCont | testImplicitProperties | c:@F@testImplicitProperties
444   ImplicitProperties.classImplicit = 1;
445 // CHECK: [[@LINE-1]]:22 | class-method/ObjC | setClassImplicit: | c:objc(cs)ImplicitProperties(cm)setClassImplicit: | +[ImplicitProperties setClassImplicit:] | Ref,Call,RelCall,RelCont | rel: 1
446 // CHECK-NEXT: RelCall,RelCont | testImplicitProperties | c:@F@testImplicitProperties
447   ImplicitProperties.classImplicit;
448 // CHECK: [[@LINE-1]]:22 | class-method/ObjC | classImplicit | c:objc(cs)ImplicitProperties(cm)classImplicit | +[ImplicitProperties classImplicit] | Ref,Call,RelCall,RelCont | rel: 1
449 // CHECK-NEXT: RelCall,RelCont | testImplicitProperties | c:@F@testImplicitProperties
452 @interface EmptySelectors
454 - (int):(int)_; // CHECK: [[@LINE]]:8 | instance-method/ObjC | : | c:objc(cs)EmptySelectors(im): | -[EmptySelectors :]
455 - (void)test: (int)x :(int)y; // CHECK: [[@LINE]]:9 | instance-method/ObjC | test:: | c:objc(cs)EmptySelectors(im)test:: | -[EmptySelectors test::]
456 - (void):(int)_ :(int)m:(int)z; // CHECK: [[@LINE]]:9 | instance-method/ObjC | ::: | c:objc(cs)EmptySelectors(im)::: | -[EmptySelectors :::]
458 @end
460 @implementation EmptySelectors
462 - (int):(int)_ { // CHECK: [[@LINE]]:8 | instance-method/ObjC | : | c:objc(cs)EmptySelectors(im): | -[EmptySelectors :]
463   [self :2]; // CHECK: [[@LINE]]:9 | instance-method/ObjC | : | c:objc(cs)EmptySelectors(im): | -[EmptySelectors :]
464   return 0;
467 - (void)test: (int)x :(int)y { // CHECK: [[@LINE]]:9 | instance-method/ObjC | test:: | c:objc(cs)EmptySelectors(im)test:: | -[EmptySelectors test::]
470 - (void) :(int)_ :(int)m :(int)z { // CHECK: [[@LINE]]:10 | instance-method/ObjC | ::: | c:objc(cs)EmptySelectors(im)::: | -[EmptySelectors :::]
471   [self test:0:1]; // CHECK: [[@LINE]]:9 | instance-method/ObjC | test:: | c:objc(cs)EmptySelectors(im)test:: | -[EmptySelectors test::]
472   [self: 0: 1: 2]; // CHECK: [[@LINE]]:8 | instance-method/ObjC | ::: | c:objc(cs)EmptySelectors(im)::: | -[EmptySelectors :::]
475 @end
477 @protocol Prot3 // CHECK: [[@LINE]]:11 | protocol/ObjC | Prot3 | [[PROT3_USR:.*]] | <no-cgname> | Decl |
478 -(void)meth; // CHECK: [[@LINE]]:8 | instance-method(protocol)/ObjC | meth | [[PROT3_meth_USR:.*]] | -[Prot3 meth] | Decl,Dyn,RelChild |
479 @end
481 void test_rec1() {
482   id<Prot3, Prot1> o1;
483   [o1 meth]; // CHECK: [[@LINE]]:7 | instance-method(protocol)/ObjC | meth | [[PROT3_meth_USR]] | {{.*}} | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 3
484     // CHECK-NEXT: RelCall,RelCont | test_rec1 |
485     // CHECK-NEXT: RelRec | Prot3 | [[PROT3_USR]]
486     // CHECK-NEXT: RelRec | Prot1 | [[PROT1_USR]]
487   Base<Prot3, Prot1> *o2;
488   [o2 meth]; // CHECK: [[@LINE]]:7 | instance-method/ObjC | meth | {{.*}} | Ref,Call,Dyn,RelRec,RelCall,RelCont | rel: 4
489     // CHECK-NEXT: RelCall,RelCont | test_rec1 |
490     // CHECK-NEXT: RelRec | Base | [[BASE_USR]]
491     // CHECK-NEXT: RelRec | Prot3 | [[PROT3_USR]]
492     // CHECK-NEXT: RelRec | Prot1 | [[PROT1_USR]]