1 | // RUN: %clang_cc1 -emit-llvm -triple thumbv7-windows-itanium -fexceptions -fcxx-exceptions %s -o - | FileCheck %s |
2 | // RUN: %clang_cc1 -emit-llvm -triple i686-windows-itanium -fexceptions -fcxx-exceptions %s -o - | FileCheck %s |
3 | // REQUIRES: asserts |
4 | |
5 | void except() { |
6 | throw 32; |
7 | } |
8 | |
9 | void attempt() { |
10 | try { except(); } catch (...) { } |
11 | } |
12 | |
13 | // CHECK: @_ZTIi = external dso_local constant i8* |
14 | |
15 | // CHECK: define {{.*}}void @_Z6exceptv() {{.*}} { |
16 | // CHECK: %exception = call {{.*}}i8* @__cxa_allocate_exception(i32 4) |
17 | // CHECK: %0 = bitcast i8* %exception to i32* |
18 | // CHECK: store i32 32, i32* %0 |
19 | // CHECK: call {{.*}}void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) |
20 | // CHECK: unreachable |
21 | // CHECK: } |
22 | |
23 | // CHECK: define {{.*}}void @_Z7attemptv() |
24 | // CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) |
25 | // CHECK: %exn.slot = alloca i8* |
26 | // CHECK: %ehselector.slot = alloca i32 |
27 | // CHECK: invoke {{.*}}void @_Z6exceptv() |
28 | // CHECK: to label %invoke.cont unwind label %lpad |
29 | // CHECK: invoke.cont: |
30 | // CHECK: br label %try.cont |
31 | // CHECK: lpad: |
32 | // CHECK: %0 = landingpad { i8*, i32 } |
33 | // CHECK: catch i8* null |
34 | // CHECK: %1 = extractvalue { i8*, i32 } %0, 0 |
35 | // CHECK: store i8* %1, i8** %exn.slot |
36 | // CHECK: %2 = extractvalue { i8*, i32 } %0, 1 |
37 | // CHECK: store i32 %2, i32* %ehselector.slot |
38 | // CHECK: br label %catch |
39 | // CHECK: catch: |
40 | // CHECK: %exn = load i8*, i8** %exn.slot |
41 | // CHECK: %3 = call {{.*}}i8* @__cxa_begin_catch(i8* %{{2|exn}}) |
42 | // CHECK: call {{.*}}void @__cxa_end_catch() |
43 | // CHECK: br label %try.cont |
44 | // CHECK: try.cont: |
45 | // CHECK: ret void |
46 | // CHECK: } |
47 | |
48 | |
49 | |