Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / cp-blocks-linetables.cpp
blobca8cba8fa9f3e3b07a55dac75373375822c98cdf
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
8 void * _NSConcreteStackBlock;
9 #ifdef __cplusplus
10 extern "C" void exit(int);
11 #else
12 extern void exit(int);
13 #endif
15 enum numbers {
16 zero, one, two, three, four
19 typedef enum numbers (^myblock)(enum numbers);
22 double test(myblock I) {
23 return I(three);
26 int main() {
27 __block enum numbers x = one;
28 __block enum numbers y = two;
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);
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;
55 enum numbers res = (enum numbers)test(CL);
57 if (res != one)
58 exit (5);
59 return 0;