Douglas Gregor | 83482d1 | 2010-08-24 16:15:59 +0000 | [diff] [blame] | 1 | // The line and column layout of this test is significant. Run lines |
| 2 | // are at the end. |
| 3 | typedef void (^block_t)(float f, double d); |
| 4 | void f(int (^block)(int x, int y)); |
| 5 | void g(block_t b); |
| 6 | |
| 7 | void test_f() { |
| 8 | |
| 9 | } |
| 10 | |
| 11 | @interface A |
| 12 | - method:(int (^)(int x, int y))b; |
| 13 | - method2:(block_t)b; |
| 14 | @end |
| 15 | |
| 16 | void test_A(A *a) { |
| 17 | [a method:0]; |
| 18 | } |
Douglas Gregor | 3827625 | 2010-09-08 22:47:51 +0000 | [diff] [blame] | 19 | |
| 20 | @interface B |
| 21 | - method3:(int (^)(void))b; |
| 22 | @end |
| 23 | |
| 24 | void test_B(B *b) { |
| 25 | [b method3:^int(void){ return 0; }]; |
| 26 | } |
| 27 | |
Douglas Gregor | c2760bc | 2010-10-02 23:49:58 +0000 | [diff] [blame] | 28 | @interface C |
| 29 | - method4:(void(^)(void))arg { }; |
| 30 | @end |
| 31 | |
| 32 | void test_C(C *c) { |
| 33 | [c method4:^{}]; |
| 34 | } |
| 35 | |
Douglas Gregor | 83482d1 | 2010-08-24 16:15:59 +0000 | [diff] [blame] | 36 | // RUN: c-index-test -code-completion-at=%s:8:1 %s | FileCheck -check-prefix=CHECK-CC1 %s |
Douglas Gregor | c2760bc | 2010-10-02 23:49:58 +0000 | [diff] [blame] | 37 | // CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50) |
| 38 | // CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder ^(float f, double d)b}{RightParen )} (50) |
Douglas Gregor | 83482d1 | 2010-08-24 16:15:59 +0000 | [diff] [blame] | 39 | // RUN: c-index-test -code-completion-at=%s:17:6 %s | FileCheck -check-prefix=CHECK-CC2 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 40 | // CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method2:}{Placeholder ^(float f, double d)b} (35) |
| 41 | // CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method:}{Placeholder ^int(int x, int y)b} (35) |
Douglas Gregor | 3827625 | 2010-09-08 22:47:51 +0000 | [diff] [blame] | 42 | // RUN: c-index-test -code-completion-at=%s:25:6 %s | FileCheck -check-prefix=CHECK-CC3 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 43 | // CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText method3:}{Placeholder ^int(void)b} (35) |
Douglas Gregor | c2760bc | 2010-10-02 23:49:58 +0000 | [diff] [blame] | 44 | // RUN: c-index-test -code-completion-at=%s:33:6 %s | FileCheck -check-prefix=CHECK-CC4 %s |
Douglas Gregor | 8ec904c | 2010-10-19 00:03:23 +0000 | [diff] [blame] | 45 | // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method4:}{Placeholder ^(void)arg} (35) |
Douglas Gregor | 75ab414 | 2010-10-18 21:34:55 +0000 | [diff] [blame] | 46 | // RUN: c-index-test -code-completion-at=%s:25:15 %s | FileCheck -check-prefix=CHECK-CC5 %s |
| 47 | // CHECK-CC5: TypedefDecl:{TypedText block_t} (50) |
| 48 | // CHECK-CC5: TypedefDecl:{TypedText Class} (50) |
| 49 | // CHECK-CC5-NOT: test_A |
| 50 | // CHECK-CC5: {TypedText union} (50) |
| 51 | |