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