[llvm] r371895 - [llvm-opt-report] Improve error handling
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 13:52:04 PDT 2019
Author: thegameg
Date: Fri Sep 13 13:52:04 2019
New Revision: 371895
URL: http://llvm.org/viewvc/llvm-project?rev=371895&view=rev
Log:
[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
Modified:
llvm/trunk/tools/llvm-opt-report/OptReport.cpp
Modified: llvm/trunk/tools/llvm-opt-report/OptReport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-opt-report/OptReport.cpp?rev=371895&r1=371894&r2=371895&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-opt-report/OptReport.cpp (original)
+++ llvm/trunk/tools/llvm-opt-report/OptReport.cpp Fri Sep 13 13:52:04 2019
@@ -158,16 +158,17 @@ static bool readLocationInfo(LocationInf
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(LocationInf
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;
}
More information about the llvm-commits
mailing list