-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[WebAssembly] Generate __clang_call_terminate for Emscripten EH #129020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5150,9 +5150,14 @@ WebAssemblyCXXABI::emitTerminateForUnexpectedException(CodeGenFunction &CGF, | |||||
| // Itanium ABI calls __clang_call_terminate(), which __cxa_begin_catch() on | ||||||
| // the violating exception to mark it handled, but it is currently hard to do | ||||||
| // with wasm EH instruction structure with catch/catch_all, we just call | ||||||
| // std::terminate and ignore the violating exception as in CGCXXABI. | ||||||
| // std::terminate and ignore the violating exception as in CGCXXABI in Wasm EH | ||||||
| // and calls __clang_call_terminate only in Emscripten EH. | ||||||
| // TODO Consider code transformation that makes calling __clang_call_terminate | ||||||
| // possible. | ||||||
| // in Wasm EH possible. | ||||||
| if (Exn && !EHPersonality::get(CGF).isWasmPersonality()) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't change anything in this case, and I checked now, and it is llvm-project/clang/lib/CodeGen/CGCleanup.h Line 680 in f3b1849
llvm-project/clang/lib/CodeGen/CGCleanup.h Line 701 in f3b1849
|
||||||
| assert(CGF.CGM.getLangOpts().CPlusPlus); | ||||||
| return CGF.EmitNounwindRuntimeCall(getClangCallTerminateFn(CGF.CGM), Exn); | ||||||
| } | ||||||
| return CGCXXABI::emitTerminateForUnexpectedException(CGF, Exn); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // RUN: %clang_cc1 %s -triple wasm32-unknown-unknown -fexceptions -fcxx-exceptions -emit-llvm -o - -std=c++11 2>&1 | FileCheck %s | ||
|
||
|
|
||
| // Test code generation for Wasm's Emscripten (JavaScript-style) EH. | ||
|
|
||
| void noexcept_throw() noexcept { | ||
| throw 3; | ||
| } | ||
|
|
||
| // CATCH-LABEL: define void @_Z14noexcept_throwv() | ||
| // CHECK: %[[LPAD:.*]] = landingpad { ptr, i32 } | ||
| // CHECK-NEXT: catch ptr null | ||
| // CHECK-NEXT: %[[EXN:.*]] = extractvalue { ptr, i32 } %[[LPAD]], 0 | ||
| // CHECK-NEXT: call void @__clang_call_terminate(ptr %[[EXN]]) | ||
Uh oh!
There was an error while loading. Please reload this page.