| 1 |
// REQUIRES: webassembly-registered-target |
| 2 |
// 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 %s |
| 3 |
|
| 4 |
// Check if __builtin_wasm_throw and __builtin_wasm_rethrow are correctly |
| 5 |
// invoked when placed in try-catch. |
| 6 |
|
| 7 |
void 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 |
|
| 15 |
void rethrow_in_try() { |
| 16 |
try { |
| 17 |
__builtin_wasm_rethrow(); |
| 18 |
} catch (...) { |
| 19 |
} |
| 20 |
// CHECK: invoke void @llvm.wasm.rethrow() |
| 21 |
} |