1 // RUN: %clang_cc1 -fobjc-arc -fblocks -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK-HEAP %s
2 // RUN: %clang_cc1 -fobjc-arc -fblocks -fobjc-avoid-heapify-local-blocks -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK-NOHEAP %s
5 typedef void (^block_t)(void);
6 void use_block(block_t);
10 block_t block = ^{ use_int(i); };
11 // CHECK-LABEL: define {{.*}}void @test0(
12 // CHECK-HEAP: call {{.*}}ptr @llvm.objc.retainBlock(ptr {{%.*}}) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape
13 // CHECK-NOHEAP-NOT: @llvm.objc.retainBlock(
18 id block = ^{ use_int(i); };
19 // CHECK-LABEL: define {{.*}}void @test1(
20 // CHECK-HEAP: call {{.*}}ptr @llvm.objc.retainBlock(ptr {{%.*}}) [[NUW]]
21 // CHECK-NOHEAP: call {{.*}}ptr @llvm.objc.retainBlock(ptr {{%.*}}) [[NUW:#[0-9]+]]
22 // CHECK-NOT: !clang.arc.copy_on_escape
26 // CHECK: attributes [[NUW]] = { nounwind }