From f97e200a98052d0f61711580b4f5142a59d9dc46 Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Fri, 23 May 2014 05:52:12 +0000 Subject: llvm-ar: Output the file we errored on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209500 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Object/ar-error.test | 5 +++++ tools/llvm-ar/llvm-ar.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test/Object/ar-error.test diff --git a/test/Object/ar-error.test b/test/Object/ar-error.test new file mode 100644 index 0000000000..9b8ddbd78f --- /dev/null +++ b/test/Object/ar-error.test @@ -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 diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index db95674d36..ed7291ea0c 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -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; -- cgit v1.2.3