1 // RUN: %clang_cc1 %s -emit-llvm -o %t -fblocks
2 // RUN: grep "_Block_object_dispose" %t | count 17
3 // RUN: grep "__copy_helper_block_" %t | count 14
4 // RUN: grep "__destroy_helper_block_" %t | count 14
5 // RUN: grep "__Block_byref_object_copy_" %t | count 2
6 // RUN: grep "__Block_byref_object_dispose_" %t | count 2
7 // RUN: grep "i32 135)" %t | count 2
8 // RUN: grep "_Block_object_assign" %t | count 10
10 int printf(const char *, ...);
16 printf("a is %d, b is %d\n", a
, b
);
17 ^{ a
= 10; printf("a is %d, b is %d\n", a
, b
); }(); // needs copy/dispose
18 printf("a is %d, b is %d\n", a
, b
);
20 printf("a is %d, b is %d\n", a
, b
);
26 printf("a is %d\n", a
);
27 ^{ // needs copy/dispose
28 ^{ // needs copy/dispose
32 printf("a is %d\n", a
);
34 printf("a is %d\n", a
);
39 __block
int (^j
)(int);
40 ^{j
=0; k
=0;}(); // needs copy/dispose
46 ^(int j
){ i
= j
; g
= 0; }(0); // does not need copy/dispose
53 __block
struct { int i
; } i
;
54 ^{ (void)i
; }(); // needs copy/dispose
59 ^{ i
=1; }(); // needs copy/dispose
60 ^{}(); // does not need copy/dispose
64 ^{ // does not need copy/dispose
66 ^{ i
= 1; }(); // needs copy/dispose