Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 1 | // Note: the run lines follow their respective tests, since line/column |
| 2 | // matter in this test. |
| 3 | |
| 4 | @protocol FooTestProtocol |
| 5 | + protocolClassMethod; |
| 6 | - protocolInstanceMethod : (int)value; |
| 7 | @end |
| 8 | @interface Foo <FooTestProtocol> { |
| 9 | void *isa; |
| 10 | } |
| 11 | + (int)classMethod1:a withKeyword:(int)b; |
| 12 | + (void)classMethod2; |
| 13 | + new; |
| 14 | - instanceMethod1; |
| 15 | @end |
| 16 | |
| 17 | @interface Foo (FooTestCategory) |
| 18 | + categoryClassMethod; |
| 19 | - categoryInstanceMethod; |
| 20 | @end |
| 21 | |
| 22 | void func() { |
| 23 | Foo *obj = [Foo new]; |
| 24 | [obj xx]; |
| 25 | } |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 26 | |
| 27 | @interface MyClass { } |
| 28 | + (int)MyClassMethod:(id)obj; |
| 29 | - (int)MyInstMethod:(id)x second:(id)y; |
| 30 | @end |
| 31 | |
| 32 | @interface MySubClass : MyClass { } |
| 33 | + (int)MySubClassMethod; |
| 34 | - (int)MySubInstMethod; |
| 35 | @end |
| 36 | |
| 37 | @implementation MyClass |
| 38 | + (int)MyClassMethod:(id)obj { |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | + (int)MyPrivateMethod { |
| 43 | return 1; |
| 44 | } |
| 45 | |
| 46 | - (int)MyInstMethod:(id)x second:(id)y { |
| 47 | return 2; |
| 48 | } |
| 49 | |
| 50 | - (int)MyPrivateInstMethod { |
| 51 | return 3; |
| 52 | } |
| 53 | @end |
| 54 | |
| 55 | @implementation MySubClass |
| 56 | + (int)MySubClassMethod { |
| 57 | return 2; |
| 58 | } |
| 59 | |
| 60 | + (int)MySubPrivateMethod { |
| 61 | return [super MyPrivateMethod]; |
| 62 | } |
| 63 | |
| 64 | - (int)MySubInstMethod:(id)obj { |
| 65 | return [super MyInstMethod: obj second:obj]; |
| 66 | } |
| 67 | |
| 68 | - (int)MyInstMethod:(id)x second:(id)y { |
| 69 | return 3; |
| 70 | } |
| 71 | @end |
| 72 | |
| 73 | void test_super_var(MySubClass *super) { |
| 74 | [super MyInstMethod: super second:super]; |
| 75 | } |
| 76 | |
Douglas Gregor | f74a419 | 2009-11-18 00:06:18 +0000 | [diff] [blame^] | 77 | @protocol FooTestProtocol2 |
| 78 | - (int)secondProtocolInstanceMethod; |
| 79 | @end |
| 80 | |
| 81 | void test_qual_id(id<FooTestProtocol,FooTestProtocol2> ptr) { |
| 82 | [ptr protocolInstanceMethod:1]; |
| 83 | } |
| 84 | |
Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 85 | // RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 86 | // CHECK-CC1: {TypedText categoryClassMethod} |
Douglas Gregor | 36ecb04 | 2009-11-17 23:22:23 +0000 | [diff] [blame] | 87 | // CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{Text withKeyword:}{Placeholder (int)b} |
Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 88 | // CHECK-CC1: {TypedText classMethod2} |
| 89 | // CHECK-CC1: {TypedText new} |
| 90 | // CHECK-CC1: {TypedText protocolClassMethod} |
Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 91 | // RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC2 %s |
| 92 | // CHECK-CC2: {TypedText categoryInstanceMethod} |
| 93 | // CHECK-CC2: {TypedText instanceMethod1} |
| 94 | // CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)value} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 95 | // RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s |
| 96 | // CHECK-CC3: ObjCClassMethodDecl:{TypedText MyClassMethod:}{Placeholder (id)obj} |
Douglas Gregor | 36ecb04 | 2009-11-17 23:22:23 +0000 | [diff] [blame] | 97 | // CHECK-CC3: ObjCClassMethodDecl:{TypedText MyPrivateMethod} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 98 | // RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s |
| 99 | // CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y} |
Douglas Gregor | 36ecb04 | 2009-11-17 23:22:23 +0000 | [diff] [blame] | 100 | // CHECK-CC4: ObjCInstanceMethodDecl:{TypedText MyPrivateInstMethod} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 101 | // RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 102 | // CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MyInstMethod:}{Placeholder (id)x}{Text second:}{Placeholder (id)y} |
Douglas Gregor | 36ecb04 | 2009-11-17 23:22:23 +0000 | [diff] [blame] | 103 | // CHECK-CC5: ObjCInstanceMethodDecl:{TypedText MySubInstMethod} |
Douglas Gregor | f74a419 | 2009-11-18 00:06:18 +0000 | [diff] [blame^] | 104 | // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s |
| 105 | // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText protocolInstanceMethod:}{Placeholder (int)value} |
| 106 | // CHECK-CC6: ObjCInstanceMethodDecl:{TypedText secondProtocolInstanceMethod} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 107 | |