llvm-ar: Output the file we errored on.
authorFilipe Cabecinhas <me@filcab.net>
Fri, 23 May 2014 05:52:12 +0000 (05:52 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Fri, 23 May 2014 05:52:12 +0000 (05:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209500 91177308-0d34-0410-b5e6-96231b3b80d8

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

diff --git a/test/Object/ar-error.test b/test/Object/ar-error.test
new file mode 100644 (file)
index 0000000..9b8ddbd
--- /dev/null
@@ -0,0 +1,5 @@
+Test if we get a proper error with a filename that doesn't exist
+
+RUN: not llvm-ar r %t.out.a sparkle.o %t 2>&1 | FileCheck %s
+
+CHECK: llvm-ar{{(.exe|.EXE)?}}: sparkle.o: No such file or directory
index db95674d36ad8126f559df86419dd468ccff9cda..ed7291ea0c9187aec0e9ffb059128f45d18a966e 100644 (file)
@@ -516,7 +516,7 @@ computeInsertAction(ArchiveOperation Operation,
     // We could try to optimize this to a fstat, but it is not a common
     // operation.
     sys::fs::file_status Status;
-    failIfError(sys::fs::status(*MI, Status));
+    failIfError(sys::fs::status(*MI, Status), *MI);
     if (Status.getLastModificationTime() < I->getLastModified()) {
       if (PosName.empty())
         return IA_AddOldMember;