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: = bitcast {{.*}}, !dbg ![[L1:[0-9]+]]
6// CHECK-NOT:  call {{.*}} @_Block_object_dispose{{.*}}, !dbg ![[L1]]
7// CHECK: ret
8
9void * _NSConcreteStackBlock;
10#ifdef __cplusplus
11extern "C" void exit(int);
12#else
13extern void exit(int);
14#endif
15
16enum numbers {
17  zero, one, two, three, four
18};
19
20typedef enum numbers (^myblock)(enum numbers);
21
22
23double test(myblock I) {
24  return I(three);
25}
26
27int main() {
28  __block enum numbers x = one;
29  __block enum numbers y = two;
30
31  /* Breakpoint for first Block function.  */
32  myblock CL = ^(enum numbers z)
33    { enum numbers savex = x;
34      { __block enum numbers x = savex;
35	y = z;
36	if (y != three)
37	  exit (6);
38	test (
39	      /* Breakpoint for second Block function.  */
40	      ^ (enum numbers z) {
41		if (y != three) {
42		  exit(1);
43		}
44		if (x != one)
45		  exit(2);
46		x = z;
47		if (x != three)
48		  exit(3);
49		if (y != three)
50		  exit(4);
51		return (enum numbers) four;
52	      });}
53      return x;
54    };
55
56  enum numbers res = (enum numbers)test(CL);
57
58  if (res != one)
59    exit (5);
60  return 0;
61}
62