diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-09 17:49:19 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-11-09 17:49:19 +0000 |
commit | 7f00d0a125b98a1c68b05e7b6be4e89f39bf8240 (patch) | |
tree | b13eb173d29b968498f03be9eceaf03f58752d76 /llvm/tools/llvm-link/llvm-link.cpp | |
parent | 9934c54cca1bc94e02f58c3fe1209e72312c115b (diff) | |
download | llvm-7f00d0a125b98a1c68b05e7b6be4e89f39bf8240.zip llvm-7f00d0a125b98a1c68b05e7b6be4e89f39bf8240.tar.gz llvm-7f00d0a125b98a1c68b05e7b6be4e89f39bf8240.tar.bz2 |
Bitcode: Change the materializer interface to return llvm::Error.
Differential Revision: https://reviews.llvm.org/D26439
llvm-svn: 286382
Diffstat (limited to 'llvm/tools/llvm-link/llvm-link.cpp')
-rw-r--r-- | llvm/tools/llvm-link/llvm-link.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index 0868220..91e6008 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -108,6 +108,8 @@ static cl::opt<bool> PreserveAssemblyUseListOrder( cl::desc("Preserve use-list order when writing LLVM assembly."), cl::init(false), cl::Hidden); +static ExitOnError ExitOnErr; + // Read the specified bitcode file in and return it. This routine searches the // link path for the specified file to try to find it... // @@ -129,7 +131,7 @@ static std::unique_ptr<Module> loadFile(const char *argv0, } if (MaterializeMetadata) { - Result->materializeMetadata(); + ExitOnErr(Result->materializeMetadata()); UpgradeDebugInfo(*Result); } @@ -264,7 +266,7 @@ static bool importFunctions(const char *argv0, LLVMContext &Context, auto &Entry = ModuleToGlobalsToImportMap[SrcModule.getModuleIdentifier()]; Entry.insert(F); - F->materialize(); + ExitOnErr(F->materialize()); } // Do the actual import of globals now, one Module at a time @@ -277,7 +279,7 @@ static bool importFunctions(const char *argv0, LLVMContext &Context, // If modules were created with lazy metadata loading, materialize it // now, before linking it (otherwise this will be a noop). - SrcModule->materializeMetadata(); + ExitOnErr(SrcModule->materializeMetadata()); UpgradeDebugInfo(*SrcModule); // Linkage Promotion and renaming @@ -348,6 +350,8 @@ int main(int argc, char **argv) { sys::PrintStackTraceOnErrorSignal(argv[0]); PrettyStackTraceProgram X(argc, argv); + ExitOnErr.setBanner(std::string(argv[0]) + ": "); + LLVMContext Context; Context.setDiagnosticHandler(diagnosticHandlerWithContext, nullptr, true); |