blob: 3694d2c8137141438cefcb0818c33dbfe7498b0f [file] [log] [blame]
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001// 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
5void except() {
6 throw 32;
7}
8
9void attempt() {
10 try { except(); } catch (...) { }
11}
12
13// CHECK: @_ZTIi = external 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: %exn.slot = alloca i8*
25// CHECK: %ehselector.slot = alloca i32
26// CHECK: invoke {{.*}}void @_Z6exceptv()
27// CHECK: to label %invoke.cont unwind label %lpad
28// CHECK: invoke.cont:
29// CHECK: br label %try.cont
30// CHECK: lpad:
31// CHECK: %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
32// CHECK: catch i8* null
33// CHECK: %1 = extractvalue { i8*, i32 } %0, 0
34// CHECK: store i8* %1, i8** %exn.slot
35// CHECK: %2 = extractvalue { i8*, i32 } %0, 1
36// CHECK: store i32 %2, i32* %ehselector.slot
37// CHECK: br label %catch
38// CHECK: catch:
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070039// CHECK: %exn = load i8*, i8** %exn.slot
Stephen Hinesc568f1e2014-07-21 00:47:37 -070040// CHECK: %3 = call {{.*}}i8* @__cxa_begin_catch(i8* %{{2|exn}})
41// CHECK: call {{.*}}void @__cxa_end_catch()
42// CHECK: br label %try.cont
43// CHECK: try.cont:
44// CHECK: ret void
45// CHECK: }
46
47