xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/gnu-exceptions.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gcc -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gnustep-1.7 -o - %s | FileCheck -check-prefix=NEW-ABI %s
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucvoid opaque(void);
5*f4a2713aSLionel Sambucvoid log(int i);
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc@class C;
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc// CHECK: define void @test0() [[TF:#[0-9]+]] {
10*f4a2713aSLionel Sambucvoid test0() {
11*f4a2713aSLionel Sambuc  @try {
12*f4a2713aSLionel Sambuc    // CHECK: invoke void @opaque()
13*f4a2713aSLionel Sambuc    opaque();
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc    // CHECK: call void @log(i32 1)
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc  } @catch (C *c) {
18*f4a2713aSLionel Sambuc    // CHECK:      landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*)
19*f4a2713aSLionel Sambuc    // CHECK-NEXT:   catch i8* getelementptr inbounds ([2 x i8]* @0, i64 0, i64 0)
20*f4a2713aSLionel Sambuc    // CHECK:      br i1
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc    // CHECK: call void @log(i32 0)
23*f4a2713aSLionel Sambuc
24*f4a2713aSLionel Sambuc    // CHECK: resume
25*f4a2713aSLionel Sambuc    // NEW-ABI: objc_begin_catch
26*f4a2713aSLionel Sambuc    // NEW-ABI: objc_end_catch
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc    log(0);
29*f4a2713aSLionel Sambuc  }
30*f4a2713aSLionel Sambuc
31*f4a2713aSLionel Sambuc  log(1);
32*f4a2713aSLionel Sambuc}
33*f4a2713aSLionel Sambuc
34*f4a2713aSLionel Sambuc// CHECK: attributes [[TF]] = { "{{.*}} }
35