[llvm] r372370 - [llvm-ar] Removes repetition in the error message
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 21:40:45 PDT 2019
Author: maskray
Date: Thu Sep 19 21:40:44 2019
New Revision: 372370
URL: http://llvm.org/viewvc/llvm-project?rev=372370&view=rev
Log:
[llvm-ar] Removes repetition in the error message
As per bug 40244, fixed an error where the error message was repeated.
Differential Revision: https://reviews.llvm.org/D67038
Patch by Yu Jian (wyjw)
Added:
llvm/trunk/test/tools/llvm-ar/invalid-object-file.test
Modified:
llvm/trunk/tools/llvm-ar/llvm-ar.cpp
Added: llvm/trunk/test/tools/llvm-ar/invalid-object-file.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/invalid-object-file.test?rev=372370&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-ar/invalid-object-file.test (added)
+++ llvm/trunk/test/tools/llvm-ar/invalid-object-file.test Thu Sep 19 21:40:44 2019
@@ -0,0 +1,8 @@
+## Test that we get a proper error message with a file that is not a recognized object file.
+
+# RUN: rm -f %t.txt
+# RUN: touch %t.txt
+# RUN: not llvm-ar sc %t.txt 2>&1 > /dev/null | FileCheck %s -DFILE=%t.txt
+
+# CHECK: error: unable to load '[[FILE]]': file too small to be an archive
+# CHECK-NOT: {{.}}
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=372370&r1=372369&r2=372370&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Thu Sep 19 21:40:44 2019
@@ -927,8 +927,7 @@ static int performOperation(ArchiveOpera
if (!EC) {
Error Err = Error::success();
object::Archive Archive(Buf.get()->getMemBufferRef(), Err);
- EC = errorToErrorCode(std::move(Err));
- failIfError(EC, "error loading '" + ArchiveName + "': " + EC.message());
+ failIfError(std::move(Err), "unable to load '" + ArchiveName + "'");
if (Archive.isThin())
CompareFullPath = true;
performOperation(Operation, &Archive, std::move(Buf.get()), NewMembers);
More information about the llvm-commits
mailing list