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 2 3void test1(_Bool c) { 4 void test1_fn(void (^blk)()); 5 __weak id weakId = 0; 6 test1_fn(c ? ^{ (void)weakId; } : 0); 7 8 // CHECK: [[CLEANUP_COND:%.*]] = alloca i1 9 // CHECK-NEXT: [[CLEANUP_SAVE:%.*]] = alloca i8** 10 11 // CHECK: store i1 true, i1* [[CLEANUP_COND]] 12 // CHECK-NEXT: store i8** {{.*}}, i8*** [[CLEANUP_SAVE]] 13 14 // CHECK: invoke void @test1_fn( 15 // CHECK-NEXT: to label %[[INVOKE_CONT:.*]] unwind label %[[LANDING_PAD_LAB:.*]] 16 17 // CHECK: [[INVOKE_CONT]]: 18 // CHECK-NEXT: [[LOAD:%.*]] = load i1, i1* [[CLEANUP_COND]] 19 // CHECK-NEXT: br i1 [[LOAD]], label %[[END_OF_SCOPE_LAB:.*]], label 20 21 // CHECK: [[END_OF_SCOPE_LAB]]: 22 // CHECK-NEXT: [[LOAD:%.*]] = load i8**, i8*** [[CLEANUP_SAVE]] 23 // CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[LOAD]]) 24 // CHECK-NEXT: br label 25 26 // CHECK: [[LANDING_PAD_LAB]]: 27 // /* some EH stuff */ 28 // CHECK: [[LOAD:%.*]] = load i1, i1* [[CLEANUP_COND]] 29 // CHECK-NEXT: br i1 [[LOAD]], label %[[EH_CLEANUP_LAB:.*]], label 30 31 // CHECK: [[EH_CLEANUP_LAB]]: 32 // CHECK-NEXT: [[LOAD:%.*]] = load i8**, i8*** [[CLEANUP_SAVE]] 33 // CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[LOAD]]) 34 // CHECK-NEXT: br label 35} 36