[BOLT][NFC] Report errors from createBinaryContext and RewriteInstance ctor
authorAmir Ayupov <aaupov@fb.com>
Thu, 17 Feb 2022 04:39:59 +0000 (20:39 -0800)
committerAmir Ayupov <aaupov@fb.com>
Thu, 17 Feb 2022 08:50:52 +0000 (00:50 -0800)
commit32d2473a5dba417eb8d34146575289e4e53c91fa
tree880e28bcf166cf62a0f0fd372b10725e807c4f43
parent0ae2464fcd4d2c2f285b83d16ff6e2426dd722d2
[BOLT][NFC] Report errors from createBinaryContext and RewriteInstance ctor

Refactor createBinaryContext and RewriteInstance/MachORewriteInstance
constructors to report an error in a library and fuzzer-friendly way instead of
returning a nullptr or exiting.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D119658
bolt/include/bolt/Core/BinaryContext.h
bolt/include/bolt/Rewrite/MachORewriteInstance.h
bolt/include/bolt/Rewrite/RewriteInstance.h
bolt/lib/Core/BinaryContext.cpp
bolt/lib/Rewrite/DWARFRewriter.cpp
bolt/lib/Rewrite/MachORewriteInstance.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
bolt/tools/driver/llvm-bolt.cpp
bolt/tools/heatmap/heatmap.cpp
bolt/unittests/Core/MCPlusBuilder.cpp