1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -fexceptions -disable-llvm-passes -o - %s | FileCheck %s
4 void test1_fn(void (^blk)(void));
6 test1_fn(c ? ^{ (void)weakId; } : 0);
8 // CHECK: [[CLEANUP_COND:%.*]] = alloca i1
9 // CHECK-NEXT: [[CLEANUP_SAVE:%.*]] = alloca ptr
11 // CHECK: store i1 true, ptr [[CLEANUP_COND]]
12 // CHECK-NEXT: store ptr {{.*}}, ptr [[CLEANUP_SAVE]]
14 // CHECK: invoke void @test1_fn(
15 // CHECK-NEXT: to label %[[INVOKE_CONT:.*]] unwind label %[[LANDING_PAD_LAB:.*]]
17 // CHECK: [[INVOKE_CONT]]:
18 // CHECK-NEXT: [[LOAD:%.*]] = load i1, ptr [[CLEANUP_COND]]
19 // CHECK-NEXT: br i1 [[LOAD]], label %[[END_OF_SCOPE_LAB:.*]], label
21 // CHECK: [[END_OF_SCOPE_LAB]]:
22 // CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[CLEANUP_SAVE]]
23 // CHECK-NEXT: call void @llvm.objc.destroyWeak(ptr [[LOAD]])
24 // CHECK-NEXT: br label
26 // CHECK: [[LANDING_PAD_LAB]]:
27 // /* some EH stuff */
28 // CHECK: [[LOAD:%.*]] = load i1, ptr [[CLEANUP_COND]]
29 // CHECK-NEXT: br i1 [[LOAD]], label %[[EH_CLEANUP_LAB:.*]], label
31 // CHECK: [[EH_CLEANUP_LAB]]:
32 // CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[CLEANUP_SAVE]]
33 // CHECK-NEXT: call void @llvm.objc.destroyWeak(ptr [[LOAD]])
34 // CHECK-NEXT: br label