[Serialization] Route error() through fatal().

...for slightly better diagnostics before we crash. See e831dca9 and
7e8d642e.
This commit is contained in:
Jordan Rose
2017-04-13 15:52:51 -07:00
parent 5659f481fd
commit fb2db91a9d

View File

@@ -430,11 +430,13 @@ public:
/// as being malformed.
Status error(Status issue = Status::Malformed) {
assert(issue != Status::Valid);
// This would normally be an assertion but it's more useful to print the
// PrettyStackTrace here even in no-asserts builds. Malformed modules are
// generally unrecoverable.
if (FileContext && issue == Status::Malformed)
abort();
if (FileContext && issue == Status::Malformed) {
// This would normally be an assertion but it's more useful to print the
// PrettyStackTrace here even in no-asserts builds. Malformed modules are
// generally unrecoverable.
fatal(llvm::make_error<llvm::StringError>(
"(see \"While...\" info below)", llvm::inconvertibleErrorCode()));
}
setStatus(issue);
return getStatus();
}