]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenObjC/terminate.m
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / CodeGenObjC / terminate.m
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
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-LABEL:       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:         landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
18   // CHECK-WITH-NEXT:      catch i8* null
19   // CHECK-WITH-NEXT:    call void @objc_terminate()
20
21   // CHECK-WITHOUT-LABEL:    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:      landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
27   // CHECK-WITHOUT-NEXT:   catch i8* null
28   // CHECK-WITHOUT-NEXT: call void @abort()
29 }