78 lines · plain
1/* Note: the RUN lines are near the end of the file, since line/column2 matter for this test. */3 4@protocol MyProtocol5@property float ProtoProp;6@end7 8@interface Super {9 int SuperIVar;10}11@end12@interface Int : Super<MyProtocol>13{14 int IVar;15}16 17@property int prop1;18@end19 20void 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@end32 33int test_more_props(Sub *s) {34 return s.myOtherPropLikeThing;35}36 37@interface Other38@property Sub *sub;39@end40 41int 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 %s46// 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 access50// CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl51// CHECK-CC1-NEXT: Container is complete52// CHECK-CC1-NEXT: Container USR: c:objc(cs)Int53// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s54// 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 access58// CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl59// CHECK-CC2-NEXT: Container is complete60// CHECK-CC2-NEXT: Container USR: c:objc(cs)Int61// RUN: c-index-test -code-completion-at=%s:34:12 %s | FileCheck -check-prefix=CHECK-CC3 %s62// 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 access68// CHECK-CC3-NEXT: Container Kind: ObjCInterfaceDecl69// CHECK-CC3-NEXT: Container is complete70// CHECK-CC3-NEXT: Container USR: c:objc(cs)Sub71 72// RUN: c-index-test -code-completion-at=%s:42:20 %s | FileCheck -check-prefix=CHECK-CC4 %s73// 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