61 lines · cpp
1// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s2// Ensure that we generate a line table entry for the block cleanup.3// CHECK: define {{.*}} @__main_block_invoke4// CHECK: _NSConcreteStackBlock5// CHECK: call {{.*}} @_Block_object_dispose{{.*}}, !dbg ![[L1:[0-9]+]]6// CHECK: ret7 8void * _NSConcreteStackBlock;9#ifdef __cplusplus10extern "C" void exit(int);11#else12extern void exit(int);13#endif14 15enum numbers {16 zero, one, two, three, four17};18 19typedef enum numbers (^myblock)(enum numbers);20 21 22double test(myblock I) {23 return I(three);24}25 26int 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}61