xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/exceptions-nonfragile.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc// rdar://problem/8535238
4*f4a2713aSLionel Sambuc// CHECK: declare void @objc_exception_rethrow()
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambucvoid protos() {
7*f4a2713aSLionel Sambuc  extern void foo();
8*f4a2713aSLionel Sambuc  @try {
9*f4a2713aSLionel Sambuc    foo();
10*f4a2713aSLionel Sambuc  } @catch (id e) {
11*f4a2713aSLionel Sambuc    @throw;
12*f4a2713aSLionel Sambuc  }
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambucvoid throwing() {
16*f4a2713aSLionel Sambuc  @throw(@"error!");
17*f4a2713aSLionel Sambuc}
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc// rdar://problem/9431547
20*f4a2713aSLionel Sambucvoid die(void) __attribute__((nothrow, noreturn));
21*f4a2713aSLionel Sambucvoid test2(void) {
22*f4a2713aSLionel Sambuc  @try {
23*f4a2713aSLionel Sambuc    die();
24*f4a2713aSLionel Sambuc  } @finally {
25*f4a2713aSLionel Sambuc    extern void test2_helper(void);
26*f4a2713aSLionel Sambuc    test2_helper();
27*f4a2713aSLionel Sambuc  }
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc  // CHECK-LABEL: define void @test2()
30*f4a2713aSLionel Sambuc  // CHECK-NOT: call void @test2_helper()
31*f4a2713aSLionel Sambuc}
32