blob: 33541e7f5ce422782be25450030a31fb213ffaa2 [file] [log] [blame]
Douglas Gregore8f5a172010-04-07 00:21:17 +00001/* Note: the RUN lines are near the end of the file, since line/column
2 matter for this test. */
3
4@protocol P1
5- (id)abc;
6- (id)initWithInt:(int)x;
7- (id)initWithTwoInts:(int)x second:(int)y;
8- (int)getInt;
9- (id)getSelf;
10@end
11
12@protocol P2<P1>
13+ (id)alloc;
14@end
15
16@interface A <P1>
17- (id)init;
18- (int)getValue;
19@end
20
21@interface B : A<P2>
22- (id)initWithInt:(int)x;
23- (int)getSecondValue;
24- (id)getSelf;
25- (int)setValue:(int)x;
26@end
27
28@interface B (FooBar)
29- (id)categoryFunction:(int)x;
30@end
31
32@implementation B
33- (int)getSecondValue { return 0; }
34- (id)init { return self; }
35- (id)getSelf { return self; }
36- (void)setValue:(int)x { }
37- (id)initWithTwoInts:(int)x second:(int)y { return self; }
38+ (id)alloc { return 0; }
39@end
40
41@implementation B (FooBar)
42- (id)categoryFunction:(int)x { return self; }
43@end
44
Douglas Gregor1f5537a2010-07-08 23:20:03 +000045@interface C
46- (int)first:(int)x second:(float)y third:(double)z;
Douglas Gregor40ed9a12010-07-08 23:37:41 +000047- (id)first:(int)xx second2:(float)y2 third:(double)z;
48- (void*)first:(int)xxx second3:(float)y3 third:(double)z;
Douglas Gregor1f5537a2010-07-08 23:20:03 +000049@end
50
51@interface D
Douglas Gregor40ed9a12010-07-08 23:37:41 +000052- (int)first:(int)x second2:(float)y third:(double)z;
Douglas Gregor1f5537a2010-07-08 23:20:03 +000053@end
54
Douglas Gregor47c03a72010-08-17 15:53:35 +000055@implementation D
Douglas Gregord32b0222010-08-24 01:06:58 +000056- (int)first:(int)x second2:(float)y third:(double)z { }
57@end
58
59@interface Passing
60- (oneway void)method:(in id x);
Douglas Gregor47c03a72010-08-17 15:53:35 +000061@end
62
Douglas Gregore8f5a172010-04-07 00:21:17 +000063// RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000064// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}
65// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}
66// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}
67// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
68// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
Douglas Gregore8f5a172010-04-07 00:21:17 +000069// RUN: c-index-test -code-completion-at=%s:17:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000070// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText abc}
71// CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf}
72// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
73// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
Douglas Gregore8f5a172010-04-07 00:21:17 +000074// RUN: c-index-test -code-completion-at=%s:24:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000075// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText abc}
76// CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf}
77// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText init}
78// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
79// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
Douglas Gregor447107d2010-05-28 00:57:46 +000080// RUN: c-index-test -code-completion-at=%s:33:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
Douglas Gregor408be5a2010-08-25 01:08:01 +000081// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (32)
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000082// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace
83// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregor408be5a2010-08-25 01:08:01 +000084// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (30)
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000085// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
86// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
87// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregor447107d2010-05-28 00:57:46 +000088// RUN: c-index-test -code-completion-at=%s:33:8 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000089// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace
90// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregore8f5a172010-04-07 00:21:17 +000091// CHECK-CC5-NOT: {TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000092// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregor447107d2010-05-28 00:57:46 +000093// RUN: c-index-test -code-completion-at=%s:37:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000094// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregore8f5a172010-04-07 00:21:17 +000095// CHECK-CC6-NOT: getSelf
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000096// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
97// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregor447107d2010-05-28 00:57:46 +000098// RUN: c-index-test -code-completion-at=%s:42:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +000099// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
Douglas Gregor1f5537a2010-07-08 23:20:03 +0000100// RUN: c-index-test -code-completion-at=%s:52:21 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s
Douglas Gregor40ed9a12010-07-08 23:37:41 +0000101// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{Text third:}{Text (double)z} (20)
102// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{Text third:}{Text (double)z} (20)
Douglas Gregor1f5537a2010-07-08 23:20:03 +0000103// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5)
Douglas Gregor40ed9a12010-07-08 23:37:41 +0000104// RUN: c-index-test -code-completion-at=%s:52:19 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC9 %s
105// CHECK-CC9: NotImplemented:{TypedText x} (30)
106// CHECK-CC9: NotImplemented:{TypedText xx} (30)
107// CHECK-CC9: NotImplemented:{TypedText xxx} (30)
108// RUN: c-index-test -code-completion-at=%s:52:36 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CCA %s
109// CHECK-CCA: NotImplemented:{TypedText y2} (30)
Douglas Gregor47c03a72010-08-17 15:53:35 +0000110// RUN: c-index-test -code-completion-at=%s:56:3 %s | FileCheck -check-prefix=CHECK-CCB %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +0000111// CHECK-CCB: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText first}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second2}{Colon :}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{Text third}{Colon :}{LeftParen (}{Text double}{RightParen )}{Text z} (30)
Douglas Gregor47c03a72010-08-17 15:53:35 +0000112// RUN: c-index-test -code-completion-at=%s:56:8 %s | FileCheck -check-prefix=CHECK-CCC %s
Douglas Gregor16ed9ad2010-08-17 16:06:07 +0000113// CHECK-CCC: ObjCInstanceMethodDecl:{TypedText first}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second2}{Colon :}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{Text third}{Colon :}{LeftParen (}{Text double}{RightParen )}{Text z} (30)
Douglas Gregor47c03a72010-08-17 15:53:35 +0000114// RUN: c-index-test -code-completion-at=%s:56:21 %s | FileCheck -check-prefix=CHECK-CCD %s
115// FIXME: These results could be more precise.
Douglas Gregorc7ed3722010-08-25 22:15:42 +0000116// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{Text third:}{Text (double)z} (20)
Douglas Gregor92148192010-08-26 00:30:24 +0000117// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second2:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5)
Douglas Gregor47c03a72010-08-17 15:53:35 +0000118// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{Text third:}{Text (double)z} (20)
119// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5)
120// RUN: c-index-test -code-completion-at=%s:56:38 %s | FileCheck -check-prefix=CHECK-CCE %s
Douglas Gregorc7ed3722010-08-25 22:15:42 +0000121// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (20)
Douglas Gregor92148192010-08-26 00:30:24 +0000122// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (5)
Douglas Gregord32b0222010-08-24 01:06:58 +0000123// RUN: c-index-test -code-completion-at=%s:60:4 %s | FileCheck -check-prefix=CHECK-CCF %s
Douglas Gregor08f43cd2010-09-20 23:11:55 +0000124// CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (50)
125// CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (50)
Douglas Gregord32b0222010-08-24 01:06:58 +0000126// CHECK-CCF: NotImplemented:{TypedText bycopy} (30)
127// CHECK-CCF: NotImplemented:{TypedText byref} (30)
128// CHECK-CCF: NotImplemented:{TypedText in} (30)
129// CHECK-CCF: NotImplemented:{TypedText inout} (30)
130// CHECK-CCF: NotImplemented:{TypedText oneway} (30)
131// CHECK-CCF: NotImplemented:{TypedText out} (30)
Douglas Gregor08f43cd2010-09-20 23:11:55 +0000132// CHECK-CCF: NotImplemented:{TypedText unsigned} (50)
133// CHECK-CCF: NotImplemented:{TypedText void} (50)
134// CHECK-CCF: NotImplemented:{TypedText volatile} (50)
Douglas Gregord32b0222010-08-24 01:06:58 +0000135// RUN: c-index-test -code-completion-at=%s:60:11 %s | FileCheck -check-prefix=CHECK-CCG %s
Douglas Gregor08f43cd2010-09-20 23:11:55 +0000136// CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (50)
137// CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (50)
Douglas Gregord32b0222010-08-24 01:06:58 +0000138// CHECK-CCG-NOT: NotImplemented:{TypedText bycopy} (30)
139// CHECK-CCG-NOT: NotImplemented:{TypedText byref} (30)
140// CHECK-CCG: NotImplemented:{TypedText in} (30)
141// CHECK-CCG: NotImplemented:{TypedText inout} (30)
142// CHECK-CCG-NOT: NotImplemented:{TypedText oneway} (30)
143// CHECK-CCG: NotImplemented:{TypedText out} (30)
Douglas Gregor08f43cd2010-09-20 23:11:55 +0000144// CHECK-CCG: NotImplemented:{TypedText unsigned} (50)
145// CHECK-CCG: NotImplemented:{TypedText void} (50)
146// CHECK-CCG: NotImplemented:{TypedText volatile} (50)
Douglas Gregord32b0222010-08-24 01:06:58 +0000147// RUN: c-index-test -code-completion-at=%s:60:24 %s | FileCheck -check-prefix=CHECK-CCF %s
148// RUN: c-index-test -code-completion-at=%s:60:26 %s | FileCheck -check-prefix=CHECK-CCH %s
Douglas Gregor08f43cd2010-09-20 23:11:55 +0000149// CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (50)
150// CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (50)
Douglas Gregord32b0222010-08-24 01:06:58 +0000151// CHECK-CCH: NotImplemented:{TypedText bycopy} (30)
152// CHECK-CCH: NotImplemented:{TypedText byref} (30)
153// CHECK-CCH-NOT: NotImplemented:{TypedText in} (30)
154// CHECK-CCH: NotImplemented:{TypedText inout} (30)
155// CHECK-CCH: NotImplemented:{TypedText oneway} (30)
156// CHECK-CCH: NotImplemented:{TypedText out} (30)
Douglas Gregor08f43cd2010-09-20 23:11:55 +0000157// CHECK-CCH: NotImplemented:{TypedText unsigned} (50)
158// CHECK-CCH: NotImplemented:{TypedText void} (50)
159// CHECK-CCH: NotImplemented:{TypedText volatile} (50)