blob: e80243a3005729a070f3a2a8c1f5ebd1c55e66f1 [file] [log] [blame]
Douglas Gregor9630eb62009-11-17 16:44:22 +00001// Note: the run lines follow their respective tests, since line/column
2// matter in this test.
Douglas Gregoraaa107a2010-08-23 23:51:41 +00003#define nil (void*)0
Douglas Gregor9630eb62009-11-17 16:44:22 +00004@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
22void func() {
23 Foo *obj = [Foo new];
24 [obj xx];
25}
Douglas Gregor24a069f2009-11-17 17:59:40 +000026
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
Douglas Gregor8e254cf2010-05-27 23:06:34 +000054MyClass *getMyClass();
Douglas Gregor24a069f2009-11-17 17:59:40 +000055@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
73void test_super_var(MySubClass *super) {
74 [super MyInstMethod: super second:super];
75}
76
Douglas Gregorf74a4192009-11-18 00:06:18 +000077@protocol FooTestProtocol2
78- (int)secondProtocolInstanceMethod;
79@end
80
81void test_qual_id(id<FooTestProtocol,FooTestProtocol2> ptr) {
82 [ptr protocolInstanceMethod:1];
83}
84
Douglas Gregord3c68542009-11-19 01:08:35 +000085@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
94void test_overload(Overload *ovl) {
95 [ovl Method:1 Arg1:1 OtherArg:ovl];
96}
97
Douglas Gregor2a17af02009-12-23 00:21:46 +000098@interface Ellipsis
Douglas Gregoraaa107a2010-08-23 23:51:41 +000099- (int)Method:(int)i, ...;
100- (int)SentinelMethod:(int)i, ... __attribute__((sentinel(0,1)));
Douglas Gregor2a17af02009-12-23 00:21:46 +0000101@end
Douglas Gregor2a17af02009-12-23 00:21:46 +0000102void f(Ellipsis *e) {
103 [e Method:1, 2, 3];
104}
105
Douglas Gregor85372b92010-04-06 15:27:03 +0000106@interface Overload2
107+ (int)Method:(int)i;
108+ (int)Method;
109+ (int)Method:(float)f Arg1:(int)i1 Arg2:(int)i2;
110+ (int)Method:(float)f Arg1:(int)i1 OtherArg:(id)obj;
111+ (int)Method:(float)f SomeArg:(int)i1 OtherArg:(id)obj;
112+ (int)OtherMethod:(float)f Arg1:(int)i1 Arg2:(int)i2;
113@end
114
115void test_overload2(void) {
116 [Overload2 Method:1 Arg1:1 OtherArg:ovl];
117}
118
Douglas Gregor13438f92010-04-06 16:40:00 +0000119void msg_id(id x) {
120 [x Method:1 Arg1:1 OtherArg:ovl];
121 [[x blarg] Method:1 Arg1:1 OtherArg:ovl];
122 [id Method:1 Arg1:1 OtherArg:ovl];
123}
124
Douglas Gregor408be5a2010-08-25 01:08:01 +0000125@interface A
126- (void)method1;
127@end
128
129@interface B : A
130- (void)method2;
131@end
132
133void test_ranking(B *b) {
134 [b method1];
Douglas Gregor78edf512010-09-15 16:23:04 +0000135 b method1];
136}
137
Douglas Gregor77328d12010-09-15 23:19:31 +0000138void test_overload3(Overload *ovl) {
Douglas Gregor78edf512010-09-15 16:23:04 +0000139 ovl Method:1 Arg1:1 OtherArg:ovl];
Douglas Gregorc7b6d882010-09-16 15:14:18 +0000140 Overload2 Method:1 Arg1:1 OtherArg:ovl];
141 (Overload2 Method:1 Arg1:1 OtherArg:ovl]);
Douglas Gregor408be5a2010-08-25 01:08:01 +0000142}
143
Douglas Gregord36adf52010-09-16 16:06:31 +0000144@interface C : B
145- (void)method2;
146- (void)method3;
147@end
148
149void test_redundancy(C *c) {
150 [c method2];
151};
152
Douglas Gregorda892642010-11-08 21:12:30 +0000153@protocol P
154- (Class)class;
155@end
156
157@interface A () <P>
158@end
159
160@interface A ()
161+ (void)class_method3;
162@end
163
164@interface A (Cat)
165+ (void)class_method4;
166@end
167
168@implementation A
169- (void)method5:(A*)a {
170 [[self class] class_method4];
171}
172@end
173
Douglas Gregor97d7ff02011-02-15 19:17:31 +0000174void test_missing_open_more() {
175 A *a = A class_method3];
176}
177
Douglas Gregor3e64d562011-04-14 20:33:34 +0000178void test_block_invoke(A *(^block1)(int),
179 int (^block2)(int),
180 id (^block3)(int)) {
181 [block1(5) init];
182}
183
Douglas Gregor9630eb62009-11-17 16:44:22 +0000184// RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
185// CHECK-CC1: {TypedText categoryClassMethod}
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000186// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)}
Douglas Gregor9630eb62009-11-17 16:44:22 +0000187// CHECK-CC1: {TypedText classMethod2}
188// CHECK-CC1: {TypedText new}
189// CHECK-CC1: {TypedText protocolClassMethod}
Douglas Gregore081a612011-07-21 01:05:26 +0000190// CHECK-CC1: Completion contexts:
191// CHECK-CC1-NEXT: Objective-C class method
192// CHECK-CC1-NEXT: Container Kind: ObjCInterfaceDecl
193// CHECK-CC1-NEXT: Container is complete
194// CHECK-CC1-NEXT: Container USR: c:objc(cs)Foo
Douglas Gregor9630eb62009-11-17 16:44:22 +0000195// RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
196// CHECK-CC2: {TypedText categoryInstanceMethod}
197// CHECK-CC2: {TypedText instanceMethod1}
Douglas Gregoraba48082010-08-29 19:47:46 +0000198// CHECK-CC2: {TypedText protocolInstanceMethod:}{Placeholder (int)}
Douglas Gregore081a612011-07-21 01:05:26 +0000199// CHECK-CC2: Completion contexts:
200// CHECK-CC2-NEXT: Objective-C instance method
201// CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
202// CHECK-CC2-NEXT: Container is complete
203// CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
Douglas Gregor24a069f2009-11-17 17:59:40 +0000204// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregoraba48082010-08-29 19:47:46 +0000205// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
Douglas Gregorff5ce6e2009-12-18 18:53:37 +0000206// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
Douglas Gregor24a069f2009-11-17 17:59:40 +0000207// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000208// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
Douglas Gregorff5ce6e2009-12-18 18:53:37 +0000209// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
Douglas Gregor24a069f2009-11-17 17:59:40 +0000210// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000211// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
Douglas Gregorff5ce6e2009-12-18 18:53:37 +0000212// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
Douglas Gregorf74a4192009-11-18 00:06:18 +0000213// RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
Douglas Gregoraba48082010-08-29 19:47:46 +0000214// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)}
Douglas Gregorff5ce6e2009-12-18 18:53:37 +0000215// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
Douglas Gregord3c68542009-11-19 01:08:35 +0000216// RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s
Douglas Gregorff5ce6e2009-12-18 18:53:37 +0000217// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
Douglas Gregoraba48082010-08-29 19:47:46 +0000218// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000219// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
220// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
221// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
222// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
Douglas Gregord3c68542009-11-19 01:08:35 +0000223// RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000224// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
225// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
226// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
Douglas Gregorcf544262010-11-17 21:36:08 +0000227// CHECK-CC8-NOT: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText }
Douglas Gregord3c68542009-11-19 01:08:35 +0000228// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s
Douglas Gregoraba48082010-08-29 19:47:46 +0000229// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)}
230// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)}
Douglas Gregor2a7925c2009-12-07 09:54:55 +0000231// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s
Douglas Gregor2a7925c2009-12-07 09:54:55 +0000232// CHECK-CCA: TypedefDecl:{TypedText Class}
Douglas Gregor8e254cf2010-05-27 23:06:34 +0000233// CHECK-CCA-NEXT: ObjCInterfaceDecl:{TypedText Foo}
234// CHECK-CCA-NOT: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )}
235// CHECK-CCA:FunctionDecl:{ResultType MyClass *}{TypedText getMyClass}{LeftParen (}{RightParen )}
Douglas Gregor2a7925c2009-12-07 09:54:55 +0000236// CHECK-CCA: TypedefDecl:{TypedText id}
237// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass}
238// CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass}
Douglas Gregorab0b4f12010-01-13 23:24:38 +0000239// CHECK-CCA: {ResultType Class}{TypedText self}
Douglas Gregor2a7925c2009-12-07 09:54:55 +0000240// CHECK-CCA: {TypedText super}
Douglas Gregor2a17af02009-12-23 00:21:46 +0000241// RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s
Douglas Gregore17794f2010-08-31 05:13:43 +0000242// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int), ...}
243// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText SentinelMethod:}{Placeholder (int), ...}{Text , nil}
Douglas Gregor85372b92010-04-06 15:27:03 +0000244// RUN: c-index-test -code-completion-at=%s:116:14 %s | FileCheck -check-prefix=CHECK-CCC %s
245// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
Douglas Gregoraba48082010-08-29 19:47:46 +0000246// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000247// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
248// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
249// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
250// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
Douglas Gregor85372b92010-04-06 15:27:03 +0000251// RUN: c-index-test -code-completion-at=%s:116:23 %s | FileCheck -check-prefix=CHECK-CCD %s
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000252// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
253// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
254// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
Douglas Gregorcf544262010-11-17 21:36:08 +0000255// CHECK-CCD-NOT: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText }
Douglas Gregor85372b92010-04-06 15:27:03 +0000256// RUN: c-index-test -code-completion-at=%s:116:30 %s | FileCheck -check-prefix=CHECK-CCE %s
Douglas Gregoraba48082010-08-29 19:47:46 +0000257// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)}
258// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)}
Douglas Gregor85372b92010-04-06 15:27:03 +0000259// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCF %s
Douglas Gregor85372b92010-04-06 15:27:03 +0000260// CHECK-CCF: TypedefDecl:{TypedText Class}
261// CHECK-CCF: ObjCInterfaceDecl:{TypedText Foo}
Douglas Gregor8e254cf2010-05-27 23:06:34 +0000262// CHECK-CCF-NOT: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )}
Douglas Gregor85372b92010-04-06 15:27:03 +0000263// CHECK-CCF: TypedefDecl:{TypedText id}
264// CHECK-CCF: ObjCInterfaceDecl:{TypedText MyClass}
265// CHECK-CCF: ObjCInterfaceDecl:{TypedText MySubClass}
Douglas Gregor85372b92010-04-06 15:27:03 +0000266// CHECK-CCF: {ResultType Class}{TypedText self}
267// CHECK-CCF: {TypedText super}
Douglas Gregor13438f92010-04-06 16:40:00 +0000268// RUN: c-index-test -code-completion-at=%s:120:6 %s | FileCheck -check-prefix=CHECK-CCG %s
Douglas Gregor92148192010-08-26 00:30:24 +0000269// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText categoryInstanceMethod}
270// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText instanceMethod1}
271// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000272// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
Douglas Gregor92148192010-08-26 00:30:24 +0000273// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
274// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
Douglas Gregoraba48082010-08-29 19:47:46 +0000275// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)}
Douglas Gregor92148192010-08-26 00:30:24 +0000276// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
Douglas Gregor13438f92010-04-06 16:40:00 +0000277// RUN: c-index-test -code-completion-at=%s:121:14 %s | FileCheck -check-prefix=CHECK-CCG %s
278// RUN: c-index-test -code-completion-at=%s:122:7 %s | FileCheck -check-prefix=CHECK-CCH %s
279// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText categoryClassMethod}
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000280// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)}
Douglas Gregor13438f92010-04-06 16:40:00 +0000281// CHECK-CCH: ObjCClassMethodDecl:{ResultType void}{TypedText classMethod2}
282// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
Douglas Gregoraba48082010-08-29 19:47:46 +0000283// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
284// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
Douglas Gregor13438f92010-04-06 16:40:00 +0000285// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
286// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubClassMethod}
287// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubPrivateMethod}
288// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText new}
Douglas Gregorc7b7b7a2010-10-18 21:05:04 +0000289// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
Douglas Gregor13438f92010-04-06 16:40:00 +0000290// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText protocolClassMethod}
Douglas Gregor408be5a2010-08-25 01:08:01 +0000291// RUN: c-index-test -code-completion-at=%s:134:6 %s | FileCheck -check-prefix=CHECK-CCI %s
Douglas Gregor8ec904c2010-10-19 00:03:23 +0000292// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method1} (37)
293// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (35)
Douglas Gregor78edf512010-09-15 16:23:04 +0000294
Douglas Gregord36adf52010-09-16 16:06:31 +0000295// RUN: c-index-test -code-completion-at=%s:150:5 %s | FileCheck -check-prefix=CHECK-REDUNDANT %s
Douglas Gregor8ec904c2010-10-19 00:03:23 +0000296// CHECK-REDUNDANT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (35)
Douglas Gregord36adf52010-09-16 16:06:31 +0000297// CHECK-REDUNDANT-NOT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2}
Douglas Gregor8ec904c2010-10-19 00:03:23 +0000298// CHECK-REDUNDANT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method3} (35)
Douglas Gregord36adf52010-09-16 16:06:31 +0000299
Douglas Gregorda892642010-11-08 21:12:30 +0000300// RUN: c-index-test -code-completion-at=%s:170:16 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s
301// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method3} (35)
302// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method4} (35)
303
Douglas Gregor3e64d562011-04-14 20:33:34 +0000304// RUN: c-index-test -code-completion-at=%s:181:4 %s | FileCheck -check-prefix=CHECK-BLOCK-RECEIVER %s
305// CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText A} (50)
306// CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText B} (50)
307// CHECK-BLOCK-RECEIVER: ParmDecl:{ResultType A *(^)(int)}{TypedText block1} (34)
308// CHECK-BLOCK-RECEIVER-NEXT: ParmDecl:{ResultType id (^)(int)}{TypedText block3} (34)
309
Douglas Gregor78edf512010-09-15 16:23:04 +0000310// Test code completion with a missing opening bracket:
311// RUN: c-index-test -code-completion-at=%s:135:5 %s | FileCheck -check-prefix=CHECK-CCI %s
312// RUN: c-index-test -code-completion-at=%s:139:7 %s | FileCheck -check-prefix=CHECK-CC7 %s
313// RUN: c-index-test -code-completion-at=%s:139:16 %s | FileCheck -check-prefix=CHECK-CC8 %s
314// RUN: c-index-test -code-completion-at=%s:139:23 %s | FileCheck -check-prefix=CHECK-CC9 %s
Douglas Gregorc7b6d882010-09-16 15:14:18 +0000315
316// RUN: c-index-test -code-completion-at=%s:140:14 %s | FileCheck -check-prefix=CHECK-CCC %s
317// RUN: c-index-test -code-completion-at=%s:140:23 %s | FileCheck -check-prefix=CHECK-CCD %s
318// RUN: c-index-test -code-completion-at=%s:140:30 %s | FileCheck -check-prefix=CHECK-CCE %s
319// RUN: c-index-test -code-completion-at=%s:141:14 %s | FileCheck -check-prefix=CHECK-CCC %s
320// RUN: c-index-test -code-completion-at=%s:141:23 %s | FileCheck -check-prefix=CHECK-CCD %s
321// RUN: c-index-test -code-completion-at=%s:141:30 %s | FileCheck -check-prefix=CHECK-CCE %s
Douglas Gregorda892642010-11-08 21:12:30 +0000322
Douglas Gregor97d7ff02011-02-15 19:17:31 +0000323// RUN: c-index-test -code-completion-at=%s:175:12 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s