1 // RUN: %clang_cc1 -triple thumbv7-apple-ios %s -emit-llvm -o %t -fblocks
2 // RUN: grep "_Block_object_dispose" %t | count 12
3 // RUN: grep "__copy_helper_block_" %t | count 9
4 // RUN: grep "__destroy_helper_block_" %t | count 9
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 5
10 // RUN: %clang_cc1 -triple thumbv7-unknown-windows %s -emit-llvm -o %t -fblocks
11 // RUN: grep "_Block_object_dispose" %t | count 12
12 // RUN: grep "__copy_helper_block_" %t | count 11
13 // RUN: grep "__destroy_helper_block_" %t | count 11
14 // RUN: grep "__Block_byref_object_copy_" %t | count 2
15 // RUN: grep "__Block_byref_object_dispose_" %t | count 2
16 // RUN: grep "i32 135)" %t | count 2
17 // RUN: grep "_Block_object_assign" %t | count 5
19 int printf(const char *, ...);
25 printf("a is %d, b is %d\n", a
, b
);
26 ^{ a
= 10; printf("a is %d, b is %d\n", a
, b
); }(); // needs copy/dispose
27 printf("a is %d, b is %d\n", a
, b
);
29 printf("a is %d, b is %d\n", a
, b
);
35 printf("a is %d\n", a
);
36 ^{ // needs copy/dispose
37 ^{ // needs copy/dispose
41 printf("a is %d\n", a
);
43 printf("a is %d\n", a
);
48 __block
int (^j
)(int);
49 ^{j
=0; k
=0;}(); // needs copy/dispose
55 ^(int j
){ i
= j
; g
= 0; }(0); // does not need copy/dispose
62 __block
struct { int i
; } i
;
63 ^{ (void)i
; }(); // needs copy/dispose
68 ^{ i
=1; }(); // needs copy/dispose
69 ^{}(); // does not need copy/dispose
73 ^{ // does not need copy/dispose
75 ^{ i
= 1; }(); // needs copy/dispose