39 lines · plain
1; REQUIRES: webassembly-registered-target2; RUN: %clang %s -target wasm32-unknown-unknown -fwasm-exceptions -c -S -o - | FileCheck %s3 4; This tests whether clang driver can take -fwasm-exceptions and compile bitcode5; files using Wasm EH.6 7; CHECK-LABEL: test8; CHECK: try9; CHECK: call foo10; CHECK: catch __cpp_exception11; CHECK: end12define void @test() personality ptr @__gxx_wasm_personality_v0 {13entry:14 invoke void @foo()15 to label %try.cont unwind label %catch.dispatch16 17catch.dispatch: ; preds = %entry18 %0 = catchswitch within none [label %catch.start] unwind to caller19 20catch.start: ; preds = %catch.dispatch21 %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.cont27 28try.cont: ; preds = %entry, %catch.start29 ret void30}31 32declare void @foo()33declare i32 @__gxx_wasm_personality_v0(...)34declare ptr @llvm.wasm.get.exception(token)35declare i32 @llvm.wasm.get.ehselector(token)36declare ptr @__cxa_begin_catch(ptr)37declare void @__cxa_end_catch()38 39