[llvm] [LLVM] Parametrize hardcoded behaviors in diagnostics error handling. (PR #156439)
Manuel Carrasco via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 4 03:27:07 PDT 2025
================
@@ -264,8 +288,19 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) {
errs() << getDiagnosticMessagePrefix(DI.getSeverity()) << ": ";
DI.print(DP);
errs() << "\n";
- if (DI.getSeverity() == DS_Error)
- exit(1);
+
+ if (DI.getSeverity() == DS_Error) {
+ switch (opts::HaltOnFirstDiagErrorOpt) {
+ case opts::HaltOnFirstDiagErrorAction::Exit:
+ exit(1);
+ break;
+ case opts::HaltOnFirstDiagErrorAction::Abort:
+ abort();
+ break;
+ case opts::HaltOnFirstDiagErrorAction::None:
+ break;
----------------
mgcarrasco wrote:
Thanks. No, it is not used, it was there to avoid warnings. I have refactored the switch into its own function and replaced it with default to avoid warnings.
https://github.com/llvm/llvm-project/pull/156439
More information about the llvm-commits
mailing list