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:
parent
3e22de98ba
commit
31c9428919
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user