aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Error.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-11-19 20:06:13 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-19 20:06:13 +0000
commitc0981da47d5696fe36474fcf86b4ce03ae3ff818 (patch)
treef42add1021b9f2ac6a69ac7cf6c4499962739a45 /llvm/lib/Support/Error.cpp
parent344a3780b2e33f6ca763666c380202b18aab72a3 (diff)
Diffstat (limited to 'llvm/lib/Support/Error.cpp')
-rw-r--r--llvm/lib/Support/Error.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp
index e7ab4387dfd1..8bfc8ee7a8cc 100644
--- a/llvm/lib/Support/Error.cpp
+++ b/llvm/lib/Support/Error.cpp
@@ -80,8 +80,11 @@ std::error_code inconvertibleErrorCode() {
}
std::error_code FileError::convertToErrorCode() const {
- return std::error_code(static_cast<int>(ErrorErrorCode::FileError),
- *ErrorErrorCat);
+ std::error_code NestedEC = Err->convertToErrorCode();
+ if (NestedEC == inconvertibleErrorCode())
+ return std::error_code(static_cast<int>(ErrorErrorCode::FileError),
+ *ErrorErrorCat);
+ return NestedEC;
}
Error errorCodeToError(std::error_code EC) {
@@ -96,7 +99,7 @@ std::error_code errorToErrorCode(Error Err) {
EC = EI.convertToErrorCode();
});
if (EC == inconvertibleErrorCode())
- report_fatal_error(EC.message());
+ report_fatal_error(Twine(EC.message()));
return EC;
}
@@ -144,7 +147,7 @@ void report_fatal_error(Error Err, bool GenCrashDiag) {
raw_string_ostream ErrStream(ErrMsg);
logAllUnhandledErrors(std::move(Err), ErrStream);
}
- report_fatal_error(ErrMsg);
+ report_fatal_error(Twine(ErrMsg));
}
} // end namespace llvm