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 | d3c6854 | 2009-11-19 01:08:35 +0000 | [diff] [blame] | 85 | @interface Overload |
| 86 | - (int)Method:(int)i; |
| 87 | - (int)Method; |
| 88 | - (int)Method:(float)f Arg1:(int)i1 Arg2:(int)i2; |
| 89 | - (int)Method:(float)f Arg1:(int)i1 OtherArg:(id)obj; |
| 90 | - (int)Method:(float)f SomeArg:(int)i1 OtherArg:(id)obj; |
| 91 | - (int)OtherMethod:(float)f Arg1:(int)i1 Arg2:(int)i2; |
| 92 | @end |
| 93 | |
| 94 | void test_overload(Overload *ovl) { |
| 95 | [ovl Method:1 Arg1:1 OtherArg:ovl]; |
| 96 | } |
| 97 | |
Douglas Gregor | 2a17af0 | 2009-12-23 00:21:46 +0000 | [diff] [blame] | 98 | @interface Ellipsis |
| 99 | - (int)Method:(int)i, ...; |
| 100 | @end |
| 101 | |
| 102 | void f(Ellipsis *e) { |
| 103 | [e Method:1, 2, 3]; |
| 104 | } |
| 105 | |
Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 106 | // RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s |
| 107 | // CHECK-CC1: {TypedText categoryClassMethod} |
Douglas Gregor | 834389b | 2010-01-12 06:38:28 +0000 | [diff] [blame] | 108 | // CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{HorizontalSpace }{Text withKeyword:}{Placeholder (int)b} |
Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 109 | // CHECK-CC1: {TypedText classMethod2} |
| 110 | // CHECK-CC1: {TypedText new} |
| 111 | // CHECK-CC1: {TypedText protocolClassMethod} |
Douglas Gregor | 9630eb6 | 2009-11-17 16:44:22 +0000 | [diff] [blame] | 112 | // RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC2 %s |
| 113 | // CHECK-CC2: {TypedText categoryInstanceMethod} |
| 114 | // CHECK-CC2: {TypedText instanceMethod1} |
| 115 | // CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)value} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 116 | // RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 117 | // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)obj} |
| 118 | // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 119 | // RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s |
Douglas Gregor | 834389b | 2010-01-12 06:38:28 +0000 | [diff] [blame] | 120 | // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{HorizontalSpace }{Text second:}{Placeholder (id)y} |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 121 | // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod} |
Douglas Gregor | 24a069f | 2009-11-17 17:59:40 +0000 | [diff] [blame] | 122 | // RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s |
Douglas Gregor | 834389b | 2010-01-12 06:38:28 +0000 | [diff] [blame] | 123 | // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{HorizontalSpace }{Text second:}{Placeholder (id)y} |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 124 | // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod} |
Douglas Gregor | f74a419 | 2009-11-18 00:06:18 +0000 | [diff] [blame] | 125 | // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 126 | // CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)value} |
| 127 | // CHECK-CC6: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod} |
Douglas Gregor | d3c6854 | 2009-11-19 01:08:35 +0000 | [diff] [blame] | 128 | // RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 129 | // CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method} |
| 130 | // CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i} |
Douglas Gregor | 834389b | 2010-01-12 06:38:28 +0000 | [diff] [blame] | 131 | // CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2} |
| 132 | // CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj} |
| 133 | // CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text SomeArg:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj} |
| 134 | // CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2} |
Douglas Gregor | d3c6854 | 2009-11-19 01:08:35 +0000 | [diff] [blame] | 135 | // RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 136 | // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText } |
Douglas Gregor | 834389b | 2010-01-12 06:38:28 +0000 | [diff] [blame] | 137 | // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2} |
| 138 | // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj} |
| 139 | // CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj} |
Douglas Gregor | d3c6854 | 2009-11-19 01:08:35 +0000 | [diff] [blame] | 140 | // RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 141 | // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2} |
| 142 | // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj} |
Douglas Gregor | 2a7925c | 2009-12-07 09:54:55 +0000 | [diff] [blame] | 143 | // RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 144 | // CHECK-CCA: {ResultType SEL}{TypedText _cmd} |
Douglas Gregor | 2a7925c | 2009-12-07 09:54:55 +0000 | [diff] [blame] | 145 | // CHECK-CCA: TypedefDecl:{TypedText Class} |
| 146 | // CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo} |
Douglas Gregor | ff5ce6e | 2009-12-18 18:53:37 +0000 | [diff] [blame] | 147 | // CHECK-CCA: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} |
Douglas Gregor | 2a7925c | 2009-12-07 09:54:55 +0000 | [diff] [blame] | 148 | // CHECK-CCA: TypedefDecl:{TypedText id} |
| 149 | // CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass} |
| 150 | // CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass} |
| 151 | // CHECK-CCA: TypedefDecl:{TypedText SEL} |
Douglas Gregor | ab0b4f1 | 2010-01-13 23:24:38 +0000 | [diff] [blame^] | 152 | // CHECK-CCA: {ResultType Class}{TypedText self} |
Douglas Gregor | 2a7925c | 2009-12-07 09:54:55 +0000 | [diff] [blame] | 153 | // CHECK-CCA: {TypedText super} |
Douglas Gregor | 2a17af0 | 2009-12-23 00:21:46 +0000 | [diff] [blame] | 154 | // RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s |
| 155 | // CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}{Placeholder , ...} |