[clang] [WebAssembly] Refactor Wasm EH/SjLj error checking (PR #122466)
Heejin Ahn via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 10 06:55:21 PST 2025
================
@@ -413,53 +422,11 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs,
}
}
- if (Opt.starts_with("-wasm-enable-sjlj")) {
- // '-mllvm -wasm-enable-sjlj' is not compatible with
- // '-mno-exception-handling'
- if (DriverArgs.hasFlag(options::OPT_mno_exception_handing,
- options::OPT_mexception_handing, false))
- getDriver().Diag(diag::err_drv_argument_not_allowed_with)
- << "-mllvm -wasm-enable-sjlj"
- << "-mno-exception-handling";
- // '-mllvm -wasm-enable-sjlj' is not compatible with
- // '-mllvm -enable-emscripten-cxx-exceptions'
- // because we don't allow Emscripten EH + Wasm SjLj
- for (const Arg *A : DriverArgs.filtered(options::OPT_mllvm)) {
- if (StringRef(A->getValue(0)) == "-enable-emscripten-cxx-exceptions")
- getDriver().Diag(diag::err_drv_argument_not_allowed_with)
- << "-mllvm -wasm-enable-sjlj"
- << "-mllvm -enable-emscripten-cxx-exceptions";
+ for (const auto *Option : {"-wasm-enable-eh", "-wasm-enable-sjlj"}) {
----------------
aheejin wrote:
We were not checking `-wasm-enable-eh` before because emscripten does not set it directly; it sets `-fwasm-exceptions`, which sets `-wasm-enable-eh`:
https://github.com/llvm/llvm-project/blob/9c85cdec4ad29389c27cc2372d45f73d1ca8053a/clang/lib/Driver/ToolChains/WebAssembly.cpp#L365-L367
But this adds checks for it too for symmetry because it's not hard and users can in theory give that to clang too.
https://github.com/llvm/llvm-project/pull/122466
More information about the cfe-commits
mailing list