[clang] [lld] [llvm] [LLVM][Windows] Elide `PrettyStackTrace` output for usage errors (PR #140956)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 21 13:04:23 PDT 2025


================
@@ -61,11 +61,14 @@ struct ScopedFatalErrorHandler {
 /// @deprecated Use reportFatalInternalError() or reportFatalUsageError()
 /// instead.
 [[noreturn]] LLVM_ABI void report_fatal_error(const char *reason,
-                                              bool gen_crash_diag = true);
+                                              bool gen_crash_diag = true,
+                                              bool is_usage_error = false);
 [[noreturn]] LLVM_ABI void report_fatal_error(StringRef reason,
-                                              bool gen_crash_diag = true);
+                                              bool gen_crash_diag = true,
+                                              bool is_usage_error = false);
 [[noreturn]] LLVM_ABI void report_fatal_error(const Twine &reason,
-                                              bool gen_crash_diag = true);
+                                              bool gen_crash_diag = true,
+                                              bool is_usage_error = false);
----------------
bd1976bris wrote:

Thanks. I thought that adding a new flag would mean that the behaviours of 1. `report_fatal_error` calling `abort()` and 2. The signal handler having usage or internal error behaviour were independent - which might be required. I'll update to just use gen_crash_diag - that will make for a smaller patch anyway.

As to why Windows has different behaviour - on Linux LLVM once called the signal handler for `report_fatal_error` IIUC but this seems to have changed in: https://github.com/llvm/llvm-project/commit/288999b82959d6a057bfd478a196961215baf792.

https://github.com/llvm/llvm-project/pull/140956


More information about the cfe-commits mailing list