xref: /minix3/external/bsd/llvm/dist/clang/test/Index/complete-properties.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc/* Note: the RUN lines are near the end of the file, since line/column
2*f4a2713aSLionel Sambuc matter for this test. */
3*f4a2713aSLionel Sambuc@class MyClass;
4*f4a2713aSLionel Sambuc@interface I1
5*f4a2713aSLionel Sambuc{
6*f4a2713aSLionel Sambuc  id StoredProp3;
7*f4a2713aSLionel Sambuc  int RandomIVar;
8*f4a2713aSLionel Sambuc}
9*f4a2713aSLionel Sambuc@property int Prop0;
10*f4a2713aSLionel Sambuc@property int Prop1;
11*f4a2713aSLionel Sambuc@property float Prop2;
12*f4a2713aSLionel Sambuc@end
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc@interface I2 : I1
15*f4a2713aSLionel Sambuc@property id Prop3;
16*f4a2713aSLionel Sambuc@property id Prop4;
17*f4a2713aSLionel Sambuc@end
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@implementation I2
20*f4a2713aSLionel Sambuc@synthesize Prop2, Prop1, Prop3 = StoredProp3;
21*f4a2713aSLionel Sambuc@dynamic Prop4;
22*f4a2713aSLionel Sambuc@end
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc@interface I3 : I2
25*f4a2713aSLionel Sambuc@property id Prop3;
26*f4a2713aSLionel Sambuc@end
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambucid test(I3 *i3) {
29*f4a2713aSLionel Sambuc  return i3.Prop3;
30*f4a2713aSLionel Sambuc}
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambuc@interface I4
33*f4a2713aSLionel Sambuc@property id Prop2;
34*f4a2713aSLionel Sambuc@end
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambuc@interface I4 () {
37*f4a2713aSLionel Sambuc  I4 *Prop1;
38*f4a2713aSLionel Sambuc}
39*f4a2713aSLionel Sambuc@end
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambuc@implementation I4 {
42*f4a2713aSLionel Sambuc  id Prop2_;
43*f4a2713aSLionel Sambuc}
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc@synthesize Prop2 = Prop2_;
46*f4a2713aSLionel Sambuc@end
47*f4a2713aSLionel Sambuc
48*f4a2713aSLionel Sambuc@protocol P1
49*f4a2713aSLionel Sambuc@property int Prop5;
50*f4a2713aSLionel Sambuc@end
51*f4a2713aSLionel Sambuc
52*f4a2713aSLionel Sambuc@class P1;
53*f4a2713aSLionel Sambuc
54*f4a2713aSLionel Sambuc@interface I5<P1>
55*f4a2713aSLionel Sambuc@end
56*f4a2713aSLionel Sambuc@implementation I5
57*f4a2713aSLionel Sambuc@synthesize Prop5;
58*f4a2713aSLionel Sambuc@end
59*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:20:13 %s | FileCheck -check-prefix=CHECK-CC1 %s
60*f4a2713aSLionel Sambuc// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
61*f4a2713aSLionel Sambuc// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
62*f4a2713aSLionel Sambuc// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText Prop2}
63*f4a2713aSLionel Sambuc// CHECK-CC1: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
64*f4a2713aSLionel Sambuc// CHECK-CC1: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
65*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:20:20 %s | FileCheck -check-prefix=CHECK-CC2 %s
66*f4a2713aSLionel Sambuc// CHECK-CC2: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
67*f4a2713aSLionel Sambuc// CHECK-CC2: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
68*f4a2713aSLionel Sambuc// CHECK-CC2-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
69*f4a2713aSLionel Sambuc// CHECK-CC2: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
70*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:20:35 %s | FileCheck -check-prefix=CHECK-CC3 %s
71*f4a2713aSLionel Sambuc// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText _Prop3} (36)
72*f4a2713aSLionel Sambuc// CHECK-CC3: ObjCIvarDecl:{ResultType int}{TypedText RandomIVar} (35)
73*f4a2713aSLionel Sambuc// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText StoredProp3} (8)
74*f4a2713aSLionel Sambuc
75*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:21:10 %s | FileCheck -check-prefix=CHECK-CC4 %s
76*f4a2713aSLionel Sambuc// CHECK-CC4: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
77*f4a2713aSLionel Sambuc// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
78*f4a2713aSLionel Sambuc
79*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:29:13 %s | FileCheck -check-prefix=CHECK-CC5 %s
80*f4a2713aSLionel Sambuc// CHECK-CC5: ObjCPropertyDecl:{ResultType int}{TypedText Prop0} (35)
81*f4a2713aSLionel Sambuc// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText Prop1} (35)
82*f4a2713aSLionel Sambuc// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText Prop2} (35)
83*f4a2713aSLionel Sambuc// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3} (35)
84*f4a2713aSLionel Sambuc// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4} (35)
85*f4a2713aSLionel Sambuc
86*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC6 %s
87*f4a2713aSLionel Sambuc// CHECK-CC6: ObjCInterfaceDecl:{TypedText MyClass} (50)
88*f4a2713aSLionel Sambuc
89*f4a2713aSLionel Sambuc
90*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:45:21 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC7 %s
91*f4a2713aSLionel Sambuc// CHECK-CC7-NOT: ObjCIvarDecl:{ResultType id}{TypedText _Prop2}
92*f4a2713aSLionel Sambuc// CHECK-CC7: ObjCIvarDecl:{ResultType I4 *}{TypedText Prop1} (17)
93*f4a2713aSLionel Sambuc// CHECK-CC7: ObjCIvarDecl:{ResultType id}{TypedText Prop2_} (7)
94*f4a2713aSLionel Sambuc
95*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:57:13 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC8 %s
96*f4a2713aSLionel Sambuc// CHECK-CC8: ObjCPropertyDecl:{ResultType int}{TypedText Prop5} (35)
97