1 | /* Note: the RUN lines are near the end of the file, since line/column |
2 | matter for this test. */ |
3 | |
4 | @protocol MyProtocol |
5 | @property float ProtoProp; |
6 | @end |
7 | |
8 | @interface Super { |
9 | int SuperIVar; |
10 | } |
11 | @end |
12 | @interface Int : Super<MyProtocol> |
13 | { |
14 | int IVar; |
15 | } |
16 | |
17 | @property int prop1; |
18 | @end |
19 | |
20 | void test_props(Int* ptr) { |
21 | ptr.prop1 = 0; |
22 | ptr->IVar = 0; |
23 | } |
24 | |
25 | @interface Sub : Int |
26 | @property int myProp; |
27 | |
28 | - (int)myProp; |
29 | - (int)myOtherPropLikeThing; |
30 | - (int)myOtherNonPropThing:(int)value; |
31 | @end |
32 | |
33 | int test_more_props(Sub *s) { |
34 | return s.myOtherPropLikeThing; |
35 | } |
36 | |
37 | @interface Other |
38 | @property Sub *sub; |
39 | @end |
40 | |
41 | int test_two_levels(Other *other) { |
42 | return other.sub.myProp; |
43 | } |
44 | |
45 | // RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s |
46 | // CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1} |
47 | // CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} |
48 | // CHECK-CC1: Completion contexts: |
49 | // CHECK-CC1-NEXT: Objective-C property access |
50 | // CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl |
51 | // CHECK-CC1-NEXT: Container is complete |
52 | // CHECK-CC1-NEXT: Container USR: c:objc(cs)Int |
53 | // RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s |
54 | // CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (35) |
55 | // CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (37) |
56 | // CHECK-CC2: Completion contexts: |
57 | // CHECK-CC2-NEXT: Arrow member access |
58 | // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl |
59 | // CHECK-CC2-NEXT: Container is complete |
60 | // CHECK-CC2-NEXT: Container USR: c:objc(cs)Int |
61 | // RUN: c-index-test -code-completion-at=%s:34:12 %s | FileCheck -check-prefix=CHECK-CC3 %s |
62 | // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType int}{TypedText myOtherPropLikeThing} (37) |
63 | // CHECK-CC3: ObjCPropertyDecl:{ResultType int}{TypedText myProp} (35) |
64 | // CHECK-CC3: ObjCPropertyDecl:{ResultType int}{TypedText prop1} (37) |
65 | // CHECK-CC3: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (37) |
66 | // CHECK-CC3: Completion contexts: |
67 | // CHECK-CC3-NEXT: Objective-C property access |
68 | // CHECK-CC3-NEXT: Container Kind: ObjCInterfaceDecl |
69 | // CHECK-CC3-NEXT: Container is complete |
70 | // CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub |
71 | |
72 | // RUN: c-index-test -code-completion-at=%s:42:20 %s | FileCheck -check-prefix=CHECK-CC4 %s |
73 | // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText myOtherPropLikeThing} (37) |
74 | // CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText myProp} (35) |
75 | // CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText prop1} (37) |
76 | // CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (37) |
77 | |
78 | |