[PATCH] D67038: Removes repetition in the error message.

Yu Jian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 31 06:27:27 PDT 2019


wyjw updated this revision to Diff 218219.
wyjw added a comment.

Added test. The check-not is to make sure that the message is not repeated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67038/new/

https://reviews.llvm.org/D67038

Files:
  llvm/test/tools/llvm-ar/invalid-binary-file.test
  llvm/tools/llvm-ar/llvm-ar.cpp


Index: llvm/tools/llvm-ar/llvm-ar.cpp
===================================================================
--- llvm/tools/llvm-ar/llvm-ar.cpp
+++ llvm/tools/llvm-ar/llvm-ar.cpp
@@ -929,7 +929,7 @@
     object::Archive Archive(Buf.get()->getMemBufferRef(), Err);
     EC = errorToErrorCode(std::move(Err));
     failIfError(EC,
-                "error loading '" + ArchiveName + "': " + EC.message() + "!");
+                "error loading '" + ArchiveName + "'");
     if (Archive.isThin())
       CompareFullPath = true;
     performOperation(Operation, &Archive, std::move(Buf.get()), NewMembers);
Index: llvm/test/tools/llvm-ar/invalid-binary-file.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ar/invalid-binary-file.test
@@ -0,0 +1,7 @@
+Test if we get a proper error message with a file that is not a proper binary.
+
+RUN: touch %t1.txt
+RUN: not llvm-ar r %t1.txt 2>&1 | FileCheck %s
+
+CHECK: llvm-ar{{(.exe|.EXE)?}}: error: error loading '{{[^']+}}': The file was not recognized as a valid object file.
+CHECK-NOT: The file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67038.218219.patch
Type: text/x-patch
Size: 1098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190831/5a5b5a65/attachment.bin>


More information about the llvm-commits mailing list