Bitcode: Change the materializer interface to return llvm::Error.

Differential Revision: https://reviews.llvm.org/D26439

llvm-svn: 286382
This commit is contained in:
Peter Collingbourne
2016-11-09 17:49:19 +00:00
parent 9934c54cca
commit 7f00d0a125
19 changed files with 112 additions and 103 deletions

View File

@@ -22,6 +22,7 @@
#include "llvm/IRReader/IRReader.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
@@ -222,12 +223,9 @@ int main(int argc, char **argv) {
}
}
auto Materialize = [&](GlobalValue &GV) {
if (std::error_code EC = GV.materialize()) {
errs() << argv[0] << ": error reading input: " << EC.message() << "\n";
exit(1);
}
};
ExitOnError ExitOnErr(std::string(argv[0]) + ": error reading input: ");
auto Materialize = [&](GlobalValue &GV) { ExitOnErr(GV.materialize()); };
// Materialize requisite global values.
if (!DeleteFn) {
@@ -251,7 +249,7 @@ int main(int argc, char **argv) {
// Now that we have all the GVs we want, mark the module as fully
// materialized.
// FIXME: should the GVExtractionPass handle this?
M->materializeAll();
ExitOnErr(M->materializeAll());
}
// In addition to deleting all other functions, we also want to spiff it