1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.8 -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s -check-prefix=CHECK-WITH 2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.7 -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s -check-prefix=CHECK-WITHOUT 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambucvoid destroy(void**); 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc// rdar://problem/9519113 7*f4a2713aSLionel Sambucvoid test0(void) { 8*f4a2713aSLionel Sambuc void test0_helper(void); 9*f4a2713aSLionel Sambuc void *ptr __attribute__((cleanup(destroy))); 10*f4a2713aSLionel Sambuc test0_helper(); 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc // CHECK-WITH-LABEL: define void @test0() 13*f4a2713aSLionel Sambuc // CHECK-WITH: [[PTR:%.*]] = alloca i8*, 14*f4a2713aSLionel Sambuc // CHECK-WITH: call void @destroy(i8** [[PTR]]) 15*f4a2713aSLionel Sambuc // CHECK-WITH-NEXT: ret void 16*f4a2713aSLionel Sambuc // CHECK-WITH: invoke void @destroy(i8** [[PTR]]) 17*f4a2713aSLionel Sambuc // CHECK-WITH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) 18*f4a2713aSLionel Sambuc // CHECK-WITH-NEXT: catch i8* null 19*f4a2713aSLionel Sambuc // CHECK-WITH-NEXT: call void @objc_terminate() 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc // CHECK-WITHOUT-LABEL: define void @test0() 22*f4a2713aSLionel Sambuc // CHECK-WITHOUT: [[PTR:%.*]] = alloca i8*, 23*f4a2713aSLionel Sambuc // CHECK-WITHOUT: call void @destroy(i8** [[PTR]]) 24*f4a2713aSLionel Sambuc // CHECK-WITHOUT-NEXT: ret void 25*f4a2713aSLionel Sambuc // CHECK-WITHOUT: invoke void @destroy(i8** [[PTR]]) 26*f4a2713aSLionel Sambuc // CHECK-WITHOUT: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) 27*f4a2713aSLionel Sambuc // CHECK-WITHOUT-NEXT: catch i8* null 28*f4a2713aSLionel Sambuc // CHECK-WITHOUT-NEXT: call void @abort() 29*f4a2713aSLionel Sambuc} 30