blob: f04eb6a92bb7313e930cda6d5b9ccbaa2497bb6f [file] [log] [blame]
John McCall256a76e2011-07-06 01:22:26 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime-has-terminate -o - %s | FileCheck %s -check-prefix=CHECK-WITH
2// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s -check-prefix=CHECK-WITHOUT
3
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]])
17 // CHECK-WITH: call i8* @llvm.eh.exception()
18 // CHECK-WITH-NEXT: @llvm.eh.selector
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]])
26 // CHECK-WITHOUT: call i8* @llvm.eh.exception()
27 // CHECK-WITHOUT-NEXT: @llvm.eh.selector
28 // CHECK-WITHOUT-NEXT: call void @abort()
29}