John McCall | 260611a | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 1 | // 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 McCall | 256a76e | 2011-07-06 01:22:26 +0000 | [diff] [blame] | 3 | |
| 4 | void destroy(void**); |
| 5 | |
| 6 | // rdar://problem/9519113 |
| 7 | void 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 Wendling | 285cfd8 | 2011-09-19 20:31:14 +0000 | [diff] [blame] | 17 | // CHECK-WITH: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) |
| 18 | // CHECK-WITH-NEXT: catch i8* null |
John McCall | 256a76e | 2011-07-06 01:22:26 +0000 | [diff] [blame] | 19 | // 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 Wendling | 285cfd8 | 2011-09-19 20:31:14 +0000 | [diff] [blame] | 26 | // CHECK-WITHOUT: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*) |
| 27 | // CHECK-WITHOUT-NEXT: catch i8* null |
John McCall | 256a76e | 2011-07-06 01:22:26 +0000 | [diff] [blame] | 28 | // CHECK-WITHOUT-NEXT: call void @abort() |
| 29 | } |