[BOLT][NFC] Report errors from RewriteInstance discoverStorage and run
Further improve error handling in BOLT by reporting `RewriteInstance` errors in a library and fuzzer-friendly way instead of exiting. Follow-up to D119658 Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D120224
This commit is contained in:
@@ -241,7 +241,8 @@ int main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
RI.run();
|
||||
if (Error E = RI.run())
|
||||
report_error(opts::InputFilename, std::move(E));
|
||||
} else if (auto *O = dyn_cast<MachOObjectFile>(&Binary)) {
|
||||
auto MachORIOrErr =
|
||||
MachORewriteInstance::createMachORewriteInstance(O, ToolPath);
|
||||
@@ -292,12 +293,14 @@ int main(int argc, char **argv) {
|
||||
<< "\n";
|
||||
outs() << "BOLT-DIFF: *** Binary 1 fdata: " << opts::InputDataFilename
|
||||
<< "\n";
|
||||
RI1.run();
|
||||
if (Error E = RI1.run())
|
||||
report_error(opts::InputFilename, std::move(E));
|
||||
outs() << "BOLT-DIFF: *** Analyzing binary 2: " << opts::InputFilename2
|
||||
<< "\n";
|
||||
outs() << "BOLT-DIFF: *** Binary 2 fdata: "
|
||||
<< opts::InputDataFilename2 << "\n";
|
||||
RI2.run();
|
||||
if (Error E = RI2.run())
|
||||
report_error(opts::InputFilename2, std::move(E));
|
||||
RI1.compare(RI2);
|
||||
} else {
|
||||
report_error(opts::InputFilename2, object_error::invalid_file_type);
|
||||
|
||||
Reference in New Issue
Block a user