1 ; REQUIRES: webassembly-registered-target
2 ; RUN: %clang %s -target wasm32-unknown-unknown -fwasm-exceptions -c -S -o - | FileCheck %s
4 ; This tests whether clang driver can take -fwasm-exceptions and compile bitcode
10 ; CHECK: catch __cpp_exception
12 define void @test() personality ptr @__gxx_wasm_personality_v0 {
15 to label %try.cont unwind label %catch.dispatch
17 catch.dispatch: ; preds = %entry
18 %0 = catchswitch within none [label %catch.start] unwind to caller
20 catch.start: ; preds = %catch.dispatch
21 %1 = catchpad within %0 [ptr null]
22 %2 = call ptr @llvm.wasm.get.exception(token %1)
23 %3 = call i32 @llvm.wasm.get.ehselector(token %1)
24 %4 = call ptr @__cxa_begin_catch(ptr %2) #2 [ "funclet"(token %1) ]
25 call void @__cxa_end_catch() [ "funclet"(token %1) ]
26 catchret from %1 to label %try.cont
28 try.cont: ; preds = %entry, %catch.start
33 declare i32 @__gxx_wasm_personality_v0(...)
34 declare ptr @llvm.wasm.get.exception(token)
35 declare i32 @llvm.wasm.get.ehselector(token)
36 declare ptr @__cxa_begin_catch(ptr)
37 declare void @__cxa_end_catch()