| 1 |
// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s |
| 2 |
// Ensure that we generate a line table entry for the block cleanup. |
| 3 |
// CHECK: define {{.*}} @__main_block_invoke |
| 4 |
// CHECK: _NSConcreteStackBlock |
| 5 |
// CHECK: call {{.*}} @_Block_object_dispose{{.*}}, !dbg ![[L1:[0-9]+]] |
| 6 |
// CHECK: ret |
| 7 |
|
| 8 |
void * _NSConcreteStackBlock; |
| 9 |
#ifdef __cplusplus |
| 10 |
extern "C" void exit(int); |
| 11 |
#else |
| 12 |
extern void exit(int); |
| 13 |
#endif |
| 14 |
|
| 15 |
enum numbers { |
| 16 |
zero, one, two, three, four |
| 17 |
}; |
| 18 |
|
| 19 |
typedef enum numbers (^myblock)(enum numbers); |
| 20 |
|
| 21 |
|
| 22 |
double test(myblock I) { |
| 23 |
return I(three); |
| 24 |
} |
| 25 |
|
| 26 |
int main() { |
| 27 |
__block enum numbers x = one; |
| 28 |
__block enum numbers y = two; |
| 29 |
|
| 30 |
/* Breakpoint for first Block function. */ |
| 31 |
myblock CL = ^(enum numbers z) |
| 32 |
{ enum numbers savex = x; |
| 33 |
{ __block enum numbers x = savex; |
| 34 |
y = z; |
| 35 |
if (y != three) |
| 36 |
exit (6); |
| 37 |
test ( |
| 38 |
/* Breakpoint for second Block function. */ |
| 39 |
^ (enum numbers z) { |
| 40 |
if (y != three) { |
| 41 |
exit(1); |
| 42 |
} |
| 43 |
if (x != one) |
| 44 |
exit(2); |
| 45 |
x = z; |
| 46 |
if (x != three) |
| 47 |
exit(3); |
| 48 |
if (y != three) |
| 49 |
exit(4); |
| 50 |
return (enum numbers) four; |
| 51 |
});} |
| 52 |
return x; |
| 53 |
}; |
| 54 |
|
| 55 |
enum numbers res = (enum numbers)test(CL); |
| 56 |
|
| 57 |
if (res != one) |
| 58 |
exit (5); |
| 59 |
return 0; |
| 60 |
} |