22 lines · cpp
1// REQUIRES: webassembly-registered-target2// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -target-feature +reference-types -target-feature +exception-handling -target-feature +multivalue -mllvm -wasm-enable-eh -exception-model=wasm -emit-llvm -o - %s | FileCheck %s3 4// Check if __builtin_wasm_throw and __builtin_wasm_rethrow are correctly5// invoked when placed in try-catch.6 7void throw_in_try(void *obj) {8 try {9 __builtin_wasm_throw(0, obj);10 } catch (...) {11 }12 // CHECK: invoke void @llvm.wasm.throw(i32 0, ptr %{{.*}})13}14 15void rethrow_in_try() {16 try {17 __builtin_wasm_rethrow();18 } catch (...) {19 }20 // CHECK: invoke void @llvm.wasm.rethrow()21}22