aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Error.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-05-05 12:10:03 +0200
committerGitHub <noreply@github.com>2025-05-05 12:10:03 +0200
commitb492ec5899082af9f34d79be9750b5e5c5d082e1 (patch)
treefbf33cfd2104f16d3a847c9cf6d02575b3318042 /llvm/lib/Support/Error.cpp
parent3416d4fcee01b63002b95774e9aff35a0ab8ef9e (diff)
downloadllvm-b492ec5899082af9f34d79be9750b5e5c5d082e1.zip
llvm-b492ec5899082af9f34d79be9750b5e5c5d082e1.tar.gz
llvm-b492ec5899082af9f34d79be9750b5e5c5d082e1.tar.bz2
[ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (#138251)
This implements the result of the discussion at: https://discourse.llvm.org/t/rfc-report-fatal-error-and-the-default-value-of-gencrashdialog/73587 There are two different use cases for report_fatal_error, so replace it with two functions reportFatalInternalError() and reportFatalUsageError(). The former indicates a bug in LLVM and generates a crash dialog. The latter does not. The names have been suggested by rnk and people seemed to like them. This replaces a lot of the usages that passed an explicit value for GenCrashDiag. I did not bulk replace remaining report_fatal_error usage -- they probably require case by case review for which function to use.
Diffstat (limited to 'llvm/lib/Support/Error.cpp')
-rw-r--r--llvm/lib/Support/Error.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp
index baa3c32..d168b46 100644
--- a/llvm/lib/Support/Error.cpp
+++ b/llvm/lib/Support/Error.cpp
@@ -174,6 +174,13 @@ void report_fatal_error(Error Err, bool GenCrashDiag) {
report_fatal_error(Twine(ErrMsg), GenCrashDiag);
}
+void reportFatalInternalError(Error Err) {
+ report_fatal_error(std::move(Err), /*GenCrashDiag=*/true);
+}
+void reportFatalUsageError(Error Err) {
+ report_fatal_error(std::move(Err), /*GenCrashDiag=*/false);
+}
+
} // end namespace llvm
LLVMErrorTypeId LLVMGetErrorTypeId(LLVMErrorRef Err) {