1*f4a2713aSLionel Sambuc// The line and column layout of this test is significant. Run lines 2*f4a2713aSLionel Sambuc// are at the end. 3*f4a2713aSLionel Sambuctypedef void (^block_t)(float f, double d); 4*f4a2713aSLionel Sambucvoid f(int (^block)(int x, int y)); 5*f4a2713aSLionel Sambucvoid g(block_t b); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambucvoid test_f() { 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc} 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc@interface A 12*f4a2713aSLionel Sambuc- method:(int (^)(int x, int y))b; 13*f4a2713aSLionel Sambuc- method2:(block_t)b; 14*f4a2713aSLionel Sambuc@end 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambucvoid test_A(A *a) { 17*f4a2713aSLionel Sambuc [a method:0]; 18*f4a2713aSLionel Sambuc} 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc@interface B 21*f4a2713aSLionel Sambuc- method3:(int (^)(void))b; 22*f4a2713aSLionel Sambuc@end 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambucvoid test_B(B *b) { 25*f4a2713aSLionel Sambuc [b method3:^int(void){ return 0; }]; 26*f4a2713aSLionel Sambuc} 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc@interface C 29*f4a2713aSLionel Sambuc- method4:(void(^)(void))arg; 30*f4a2713aSLionel Sambuc- method5:(void(^)())arg5; 31*f4a2713aSLionel Sambuc@end 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambucvoid test_C(C *c) { 34*f4a2713aSLionel Sambuc [c method4:^{}]; 35*f4a2713aSLionel Sambuc} 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc@interface D 38*f4a2713aSLionel Sambuc- method6:(void(^)(block_t block))arg; 39*f4a2713aSLionel Sambuc@end 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambucvoid test_D(D *d) { 42*f4a2713aSLionel Sambuc [d method6:0]; 43*f4a2713aSLionel Sambuc} 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:8:1 %s | FileCheck -check-prefix=CHECK-CC1 %s 46*f4a2713aSLionel Sambuc// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50) 47*f4a2713aSLionel Sambuc// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder ^(float f, double d)b}{RightParen )} (50) 48*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:17:6 %s | FileCheck -check-prefix=CHECK-CC2 %s 49*f4a2713aSLionel Sambuc// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method2:}{Placeholder ^(float f, double d)b} (35) 50*f4a2713aSLionel Sambuc// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method:}{Placeholder ^int(int x, int y)b} (35) 51*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:25:6 %s | FileCheck -check-prefix=CHECK-CC3 %s 52*f4a2713aSLionel Sambuc// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText method3:}{Placeholder ^int(void)b} (35) 53*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:34:6 %s | FileCheck -check-prefix=CHECK-CC4 %s 54*f4a2713aSLionel Sambuc// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method4:}{Placeholder ^(void)arg} (35) 55*f4a2713aSLionel Sambuc// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method5:}{Placeholder ^(void)arg5} (35) 56*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:25:15 %s | FileCheck -check-prefix=CHECK-CC5 %s 57*f4a2713aSLionel Sambuc// CHECK-CC5: TypedefDecl:{TypedText block_t} (50) 58*f4a2713aSLionel Sambuc// CHECK-CC5: TypedefDecl:{TypedText Class} (50) 59*f4a2713aSLionel Sambuc// CHECK-CC5-NOT: test_A 60*f4a2713aSLionel Sambuc// CHECK-CC5: {TypedText union} (50) 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc// RUN: c-index-test -code-completion-at=%s:42:6 %s | FileCheck -check-prefix=CHECK-CC6 %s 63*f4a2713aSLionel Sambuc// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText method6:}{Placeholder ^(block_t block)arg} (35) 64*f4a2713aSLionel Sambuc 65