Douglas Gregor | 55385fe | 2009-11-18 04:19:12 +0000 | [diff] [blame] | 1 | /* Note: the RUN lines are near the end of the file, since line/column |
| 2 | matter for this test. */ |
Douglas Gregor | 95ac655 | 2009-11-18 01:29:26 +0000 | [diff] [blame] | 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 | |
Douglas Gregor | 4b81cde | 2011-05-05 15:50:42 +0000 | [diff] [blame] | 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 | |
Douglas Gregor | f5cd27d | 2012-01-23 15:59:30 +0000 | [diff] [blame] | 37 | @interface Other |
| 38 | @property Sub *sub; |
| 39 | @end |
| 40 | |
| 41 | int test_two_levels(Other *other) { |
| 42 | return other.sub.myProp; |
| 43 | } |
| 44 | |
Douglas Gregor | 95ac655 | 2009-11-18 01:29:26 +0000 | [diff] [blame] | 45 | // RUN: c-index-test -code-completion-at=%s:21:7 %s | FileCheck -check-prefix=CHECK-CC1 %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 46 | // CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1} |
| 47 | // CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} |
Douglas Gregor | e081a61 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 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 |
Douglas Gregor | 95ac655 | 2009-11-18 01:29:26 +0000 | [diff] [blame] | 53 | // RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 54 | // CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (35) |
| 55 | // CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (37) |
Douglas Gregor | e081a61 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 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 |
Douglas Gregor | 4b81cde | 2011-05-05 15:50:42 +0000 | [diff] [blame] | 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} (35) |
| 65 | // CHECK-CC3: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35) |
Douglas Gregor | e081a61 | 2011-07-21 01:05:26 +0000 | [diff] [blame] | 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 |
Douglas Gregor | f5cd27d | 2012-01-23 15:59:30 +0000 | [diff] [blame] | 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} (35) |
| 76 | // CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp} (35) |
| 77 | |