blob: 8728ec4598bf5a843d650b1b9fcdcad55a0f3056 [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// 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// 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
John McCall256a76e2011-07-06 01:22:26 +00003
4void destroy(void**);
5
6// rdar://problem/9519113
7void test0(void) {
8 void test0_helper(void);
9 void *ptr __attribute__((cleanup(destroy)));
10 test0_helper();
11
12 // CHECK-WITH: define void @test0()
13 // CHECK-WITH: [[PTR:%.*]] = alloca i8*,
14 // CHECK-WITH: call void @destroy(i8** [[PTR]])
15 // CHECK-WITH-NEXT: ret void
16 // CHECK-WITH: invoke void @destroy(i8** [[PTR]])
Bill Wendling285cfd82011-09-19 20:31:14 +000017 // CHECK-WITH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
18 // CHECK-WITH-NEXT: catch i8* null
John McCall256a76e2011-07-06 01:22:26 +000019 // CHECK-WITH-NEXT: call void @objc_terminate()
20
21 // CHECK-WITHOUT: define void @test0()
22 // CHECK-WITHOUT: [[PTR:%.*]] = alloca i8*,
23 // CHECK-WITHOUT: call void @destroy(i8** [[PTR]])
24 // CHECK-WITHOUT-NEXT: ret void
25 // CHECK-WITHOUT: invoke void @destroy(i8** [[PTR]])
Bill Wendling285cfd82011-09-19 20:31:14 +000026 // CHECK-WITHOUT: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
27 // CHECK-WITHOUT-NEXT: catch i8* null
John McCall256a76e2011-07-06 01:22:26 +000028 // CHECK-WITHOUT-NEXT: call void @abort()
29}