[Object] Re-apply r275316 now that I have the corresponding LLD patch ready.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275361 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames
2016-07-14 02:24:01 +00:00
parent 0e9e4ecaa4
commit aacf2fbfe4
15 changed files with 235 additions and 196 deletions
+11
View File
@@ -64,6 +64,7 @@ void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner) {
});
}
std::error_code ErrorList::convertToErrorCode() const {
return std::error_code(static_cast<int>(ErrorErrorCode::MultipleErrors),
*ErrorErrorCat);
@@ -99,4 +100,14 @@ std::error_code StringError::convertToErrorCode() const {
return EC;
}
void report_fatal_error(Error Err, bool GenCrashDiag) {
assert(Err && "report_fatal_error called with success value");
std::string ErrMsg;
{
raw_string_ostream ErrStream(ErrMsg);
logAllUnhandledErrors(std::move(Err), ErrStream, "");
}
report_fatal_error(ErrMsg);
}
}