diff options
author | Amir Ayupov <aaupov@fb.com> | 2022-02-23 19:30:30 -0800 |
---|---|---|
committer | Amir Ayupov <aaupov@fb.com> | 2022-02-23 20:42:39 -0800 |
commit | af6e66f44cf0829caceb06929d5cb43e718b9ca0 (patch) | |
tree | b03ca301e1fa59f3682625c18c1d51bcc04d926e /bolt/tools/driver | |
parent | ba061713d3103c1f84312901d7ad29f39a700616 (diff) | |
download | llvm-af6e66f44cf0829caceb06929d5cb43e718b9ca0.zip llvm-af6e66f44cf0829caceb06929d5cb43e718b9ca0.tar.gz llvm-af6e66f44cf0829caceb06929d5cb43e718b9ca0.tar.bz2 |
[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
Diffstat (limited to 'bolt/tools/driver')
-rw-r--r-- | bolt/tools/driver/llvm-bolt.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp index 2c8d1d2..24e10c7 100644 --- a/bolt/tools/driver/llvm-bolt.cpp +++ b/bolt/tools/driver/llvm-bolt.cpp @@ -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); |