https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/233031
>From cf9313c17220e28838d8fe7f9f8be008f4fdb8ee Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Thu, 15 Oct 2026 09:45:12 +0200 Subject: [PATCH] WebAssembly: Use reportFatalUsageError for eh option errors Avoid using the deprecated report_fatal_error, and add missing error test coverage. Co-authored-by: Claude Opus 5.5 <[email protected]> --- .../WebAssemblyLowerEmscriptenEHSjLj.cpp | 4 +-- .../WebAssembly/WebAssemblyTargetMachine.cpp | 2 +- .../CodeGen/WebAssembly/eh-option-errors.ll | 25 ++++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp index e8ac89570741f1..7ad8d2ba7800f3 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp @@ -920,13 +920,13 @@ bool WebAssemblyLowerEmscriptenEHSjLjImpl::runOnModule(Module &M) { ExceptionHandling EH = M.getExceptionModel(); if (EH != ExceptionHandling::None && EH != ExceptionHandling::Wasm && EH != ExceptionHandling::Emscripten) - report_fatal_error( + reportFatalUsageError( "-exception-model should be either 'none', 'wasm', or 'emscripten'"); EnableEmEH = EH == ExceptionHandling::Emscripten; // You can't mix Emscripten EH with Wasm SjLj. if (EnableEmEH && EnableWasmSjLj) - report_fatal_error( + reportFatalUsageError( "-exception-model=emscripten not allowed with -wasm-enable-sjlj"); bool Changed = false; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 742c2541a2d58e..39e683c3c6d0fb 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -131,7 +131,7 @@ using WebAssembly::WasmEnableSjLj; static void basicCheckForEHAndSjLj() { // You can't enable two modes of SjLj at the same time if (WasmEnableEmSjLj && WasmEnableSjLj) - report_fatal_error( + reportFatalUsageError( "-enable-emscripten-sjlj not allowed with -wasm-enable-sjlj"); } diff --git a/llvm/test/CodeGen/WebAssembly/eh-option-errors.ll b/llvm/test/CodeGen/WebAssembly/eh-option-errors.ll index b78b2d32918f75..12ed2897cc53b4 100644 --- a/llvm/test/CodeGen/WebAssembly/eh-option-errors.ll +++ b/llvm/test/CodeGen/WebAssembly/eh-option-errors.ll @@ -1,10 +1,27 @@ -target triple = "wasm32-unknown-unknown" +; RUN: split-file %s %t -; RUN: not --crash llc < %s -enable-emscripten-sjlj -wasm-enable-sjlj 2>&1 | FileCheck %s --check-prefix=EM_SJLJ_W_WASM_SJLJ +; RUN: not llc < %t/noflag.ll -enable-emscripten-sjlj -wasm-enable-sjlj 2>&1 | FileCheck %s --check-prefix=EM_SJLJ_W_WASM_SJLJ ; EM_SJLJ_W_WASM_SJLJ: LLVM ERROR: -enable-emscripten-sjlj not allowed with -wasm-enable-sjlj -; RUN: not --crash llc < %s -exception-model=emscripten -wasm-enable-sjlj 2>&1 | FileCheck %s --check-prefix=EM_EH_W_WASM_SJLJ +; RUN: not llc < %t/noflag.ll -exception-model=emscripten -wasm-enable-sjlj 2>&1 | FileCheck %s --check-prefix=EM_EH_W_WASM_SJLJ +; RUN: not opt -passes=wasm-lower-em-ehsjlj -wasm-enable-sjlj -disable-output %t/emscripten.ll 2>&1 | FileCheck %s --check-prefix=EM_EH_W_WASM_SJLJ ; EM_EH_W_WASM_SJLJ: LLVM ERROR: -exception-model=emscripten not allowed with -wasm-enable-sjlj -; RUN: not --crash llc < %s -exception-model=dwarf 2>&1 | FileCheck %s --check-prefix=EH_MODEL_DWARF +; RUN: not llc < %t/noflag.ll -exception-model=dwarf 2>&1 | FileCheck %s --check-prefix=EH_MODEL_DWARF +; RUN: not opt -passes=wasm-lower-em-ehsjlj -disable-output %t/dwarf.ll 2>&1 | FileCheck %s --check-prefix=EH_MODEL_DWARF ; EH_MODEL_DWARF: LLVM ERROR: -exception-model should be either 'none', 'wasm', or 'emscripten' + +;--- noflag.ll +target triple = "wasm32-unknown-unknown" + +;--- emscripten.ll +target triple = "wasm32-unknown-emscripten" + +!llvm.module.flags = !{!0} +!0 = !{i32 1, !"exception-model", !"emscripten"} + +;--- dwarf.ll +target triple = "wasm32-unknown-unknown" + +!llvm.module.flags = !{!0} +!0 = !{i32 1, !"exception-model", !"dwarf"} _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
