1/* Note: the RUN lines are near the end of the file, since line/column 2 matter for this test. */ 3#define IBAction void 4@protocol P1 5- (id)abc; 6- (id)initWithInt:(int)x; 7- (id)initWithTwoInts:(inout int)x second:(int)y; 8- (int)getInt; 9- (id)getSelf; 10@end 11@protocol P1; 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 45@interface C 46- (int)first:(int)x second:(float)y third:(double)z; 47- (id)first:(int)xx second2:(float)y2 third:(double)z; 48- (void*)first:(int)xxx second3:(float)y3 third:(double)z; 49@end 50 51@interface D 52- (int)first:(int)x second2:(float)y third:(double)z; 53@end 54 55@implementation D 56- (int)first:(int)x second2:(float)y third:(double)z { } 57@end 58 59@interface Passing 60- (oneway void)method:(in id)x; 61@end 62 63@interface Gaps 64- (void)method:(int)x :(int)y; 65@end 66 67@implementation Gaps 68- (void)method:(int)x :(int)y {} 69@end 70 71@implementation Passing 72- (oneway void)method:(in id x) {} 73@end 74 75typedef A MyObject; 76typedef A *MyObjectRef; 77 78@interface I1 79-(Class<P1>)meth; 80-(MyObject <P1> *)meth2; 81-(MyObjectRef)meth3; 82@end 83 84@implementation I1 85- 86@end 87 88// RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s 89// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc} (40) 90// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt} (40) 91// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf} (40) 92// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} (40) 93// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} (40) 94// RUN: c-index-test -code-completion-at=%s:17:7 %s | FileCheck -check-prefix=CHECK-CC2 %s 95// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText abc} 96// CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf} 97// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} 98// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} 99// RUN: c-index-test -code-completion-at=%s:24:7 %s | FileCheck -check-prefix=CHECK-CC3 %s 100// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText abc} 101// CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf} 102// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText init} 103// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x} 104// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y} 105// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:33:3 %s | FileCheck -check-prefix=CHECK-CC4 %s 106// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) 107// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace 108// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace 109// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40) 110// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace 111// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace 112// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace 113// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s 114// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) 115// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40) 116// CHECK-CC5-NOT: {TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace 117// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText setValue}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace 118// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:37:7 %s | FileCheck -check-prefix=CHECK-CC6 %s 119// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace 120// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40) 121// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace 122// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text inout }{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace 123// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:42:3 %s | FileCheck -check-prefix=CHECK-CC7 %s 124// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) 125// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace 126// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42) 127// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:21 %s | FileCheck -check-prefix=CHECK-CC8 %s 128// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{TypedText third:}{Text (double)z} (35) 129// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{TypedText third:}{Text (double)z} (35) 130// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{TypedText third:}{Text (double)z} (8) 131// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:19 %s | FileCheck -check-prefix=CHECK-CC9 %s 132// CHECK-CC9: NotImplemented:{TypedText x} (40) 133// CHECK-CC9: NotImplemented:{TypedText xx} (40) 134// CHECK-CC9: NotImplemented:{TypedText xxx} (40) 135// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:36 %s | FileCheck -check-prefix=CHECK-CCA %s 136// CHECK-CCA: NotImplemented:{TypedText y2} (40) 137// RUN: c-index-test -code-completion-at=%s:56:3 %s | FileCheck -check-prefix=CHECK-CCB %s 138// CHECK-CCB: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText first}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second2:}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{TypedText third:}{LeftParen (}{Text double}{RightParen )}{Text z} (40) 139// RUN: c-index-test -code-completion-at=%s:56:8 %s | FileCheck -check-prefix=CHECK-CCC %s 140// CHECK-CCC: ObjCInstanceMethodDecl:{TypedText first}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second2:}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{TypedText third:}{LeftParen (}{Text double}{RightParen )}{Text z} (40) 141// RUN: c-index-test -code-completion-at=%s:56:21 %s | FileCheck -check-prefix=CHECK-CCD %s 142// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{TypedText third:}{Text (double)z} (35) 143// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second2:}{Text (float)y}{HorizontalSpace }{TypedText third:}{Text (double)z} (8) 144// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{TypedText third:}{Text (double)z} (35) 145// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{TypedText third:}{Text (double)z} (8) 146// RUN: c-index-test -code-completion-at=%s:56:38 %s | FileCheck -check-prefix=CHECK-CCE %s 147// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (35) 148// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (8) 149// RUN: c-index-test -code-completion-at=%s:60:4 %s | FileCheck -check-prefix=CHECK-CCF %s 150// CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (50) 151// CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (50) 152// CHECK-CCF: NotImplemented:{TypedText bycopy} (40) 153// CHECK-CCF: NotImplemented:{TypedText byref} (40) 154// CHECK-CCF: NotImplemented:{TypedText in} (40) 155// CHECK-CCF: NotImplemented:{TypedText inout} (40) 156// CHECK-CCF: NotImplemented:{TypedText oneway} (40) 157// CHECK-CCF: NotImplemented:{TypedText out} (40) 158// CHECK-CCF: NotImplemented:{TypedText unsigned} (50) 159// CHECK-CCF: NotImplemented:{TypedText void} (50) 160// CHECK-CCF: NotImplemented:{TypedText volatile} (50) 161// RUN: c-index-test -code-completion-at=%s:60:11 %s | FileCheck -check-prefix=CHECK-CCG %s 162// CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (50) 163// CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (50) 164// CHECK-CCG-NOT: NotImplemented:{TypedText bycopy} (40) 165// CHECK-CCG-NOT: NotImplemented:{TypedText byref} (40) 166// CHECK-CCG: NotImplemented:{TypedText in} (40) 167// CHECK-CCG: NotImplemented:{TypedText inout} (40) 168// CHECK-CCG-NOT: NotImplemented:{TypedText oneway} (40) 169// CHECK-CCG: NotImplemented:{TypedText out} (40) 170// CHECK-CCG: NotImplemented:{TypedText unsigned} (50) 171// CHECK-CCG: NotImplemented:{TypedText void} (50) 172// CHECK-CCG: NotImplemented:{TypedText volatile} (50) 173// RUN: c-index-test -code-completion-at=%s:60:24 %s | FileCheck -check-prefix=CHECK-CCF %s 174// RUN: c-index-test -code-completion-at=%s:60:26 %s | FileCheck -check-prefix=CHECK-CCH %s 175// CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (50) 176// CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (50) 177// CHECK-CCH: NotImplemented:{TypedText bycopy} (40) 178// CHECK-CCH: NotImplemented:{TypedText byref} (40) 179// CHECK-CCH-NOT: NotImplemented:{TypedText in} (40) 180// CHECK-CCH: NotImplemented:{TypedText inout} (40) 181// CHECK-CCH: NotImplemented:{TypedText oneway} (40) 182// CHECK-CCH: NotImplemented:{TypedText out} (40) 183// CHECK-CCH: NotImplemented:{TypedText unsigned} (50) 184// CHECK-CCH: NotImplemented:{TypedText void} (50) 185// CHECK-CCH: NotImplemented:{TypedText volatile} (50) 186 187// IBAction completion 188// RUN: c-index-test -code-completion-at=%s:5:4 %s | FileCheck -check-prefix=CHECK-IBACTION %s 189// CHECK-IBACTION: NotImplemented:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40) 190 191// <rdar://problem/8939352> 192// RUN: c-index-test -code-completion-at=%s:68:9 %s | FileCheck -check-prefix=CHECK-8939352 %s 193// CHECK-8939352: ObjCInstanceMethodDecl:{TypedText method}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text y} (40) 194 195 196// RUN: c-index-test -code-completion-at=%s:72:2 %s | FileCheck -check-prefix=CHECK-ONEWAY %s 197// CHECK-ONEWAY: ObjCInstanceMethodDecl:{LeftParen (}{Text oneway }{Text void}{RightParen )}{TypedText method}{TypedText :}{LeftParen (}{Text in }{Text id}{RightParen )}{Text x} (40) 198 199// RUN: c-index-test -code-completion-at=%s:85:2 %s | FileCheck -check-prefix=CHECK-CLASSTY %s 200// CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text Class<P1>}{RightParen )}{TypedText meth} 201// FIXME: It should be "MyObject <P1> *"" 202// CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text A<P1> *}{RightParen )}{TypedText meth2} 203// CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text MyObjectRef}{RightParen )}{TypedText meth3} 204