Add a missing error handling to llvm-lto.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 11 Jan 2016 22:08:22 +0000 (22:08 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 11 Jan 2016 22:08:22 +0000 (22:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257395 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-lto/error.ll [new file with mode: 0644]
tools/llvm-lto/llvm-lto.cpp

diff --git a/test/tools/llvm-lto/error.ll b/test/tools/llvm-lto/error.ll
new file mode 100644 (file)
index 0000000..8f11270
--- /dev/null
@@ -0,0 +1,2 @@
+; RUN: not llvm-lto foobar 2>&1 | FileCheck %s
+; CHECK: llvm-lto: error loading file 'foobar': No such file or directory
index 4bc6922..2320511 100644 (file)
@@ -289,6 +289,7 @@ int main(int argc, char **argv) {
     CurrentActivity = "loading file '" + InputFilenames[i] + "'";
     ErrorOr<std::unique_ptr<LTOModule>> ModuleOrErr =
         LTOModule::createFromFile(Context, InputFilenames[i].c_str(), Options);
+    error(ModuleOrErr, "error " + CurrentActivity);
     std::unique_ptr<LTOModule> &Module = *ModuleOrErr;
     CurrentActivity = "";