1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[llvm-opt-report] Improve error handling

* std::move the error extracted from the parsing creation to avoid asserts
* print a newline after the error message
* create the parser from the metadata

llvm-svn: 371895
This commit is contained in:
Francis Visoiu Mistrih 2019-09-13 20:52:04 +00:00
parent 3e22de98ba
commit 31c9428919

View File

@ -158,16 +158,17 @@ static bool readLocationInfo(LocationInfoTy &LocationInfo) {
if (!Format) {
handleAllErrors(Format.takeError(), [&](const ErrorInfoBase &PE) {
PE.log(WithColor::error());
WithColor::error() << '\n';
errs() << '\n';
});
return false;
}
Expected<std::unique_ptr<remarks::RemarkParser>> MaybeParser =
remarks::createRemarkParser(*Format, (*Buf)->getBuffer());
remarks::createRemarkParserFromMeta(*Format, (*Buf)->getBuffer());
if (!MaybeParser) {
handleAllErrors(MaybeParser.takeError(), [&](const ErrorInfoBase &PE) {
PE.log(WithColor::error());
errs() << '\n';
});
return false;
}
@ -182,8 +183,9 @@ static bool readLocationInfo(LocationInfoTy &LocationInfo) {
consumeError(std::move(E));
break;
}
handleAllErrors(MaybeRemark.takeError(), [&](const ErrorInfoBase &PE) {
handleAllErrors(std::move(E), [&](const ErrorInfoBase &PE) {
PE.log(WithColor::error());
errs() << '\n';
});
return false;
}