blob: 5e40be1eac013f0e156342c9caad89ffa1ebf765 [file] [log] [blame]
Douglas Gregor55385fe2009-11-18 04:19:12 +00001/* Note: the RUN lines are near the end of the file, since line/column
2 matter for this test. */
Douglas Gregor95ac6552009-11-18 01:29:26 +00003
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
20void test_props(Int* ptr) {
21 ptr.prop1 = 0;
22 ptr->IVar = 0;
23}
24
Douglas Gregor4b81cde2011-05-05 15:50:42 +000025@interface Sub : Int
26@property int myProp;
27
28- (int)myProp;
29- (int)myOtherPropLikeThing;
30- (int)myOtherNonPropThing:(int)value;
31@end
32
33int test_more_props(Sub *s) {
34 return s.myOtherPropLikeThing;
35}
36
Douglas Gregorf5cd27d2012-01-23 15:59:30 +000037@interface Other
38@property Sub *sub;
39@end
40
41int test_two_levels(Other *other) {
42 return other.sub.myProp;
43}
44
Douglas Gregor95ac6552009-11-18 01:29:26 +000045// RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
Douglas Gregorff5ce6e2009-12-18 18:53:37 +000046// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1}
47// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp}
Douglas Gregore081a612011-07-21 01:05:26 +000048// 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
Douglas Gregor95ac6552009-11-18 01:29:26 +000053// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
Douglas Gregor8ec904c2010-10-19 00:03:23 +000054// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (35)
55// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (37)
Douglas Gregore081a612011-07-21 01:05:26 +000056// 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
Douglas Gregor4b81cde2011-05-05 15:50:42 +000061// 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} (35)
65// CHECK-CC3: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35)
Douglas Gregore081a612011-07-21 01:05:26 +000066// 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
Douglas Gregorf5cd27d2012-01-23 15:59:30 +000070// 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} (35)
76// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35)
77