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

Yu Jian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 18:13:39 PDT 2019


wyjw updated this revision to Diff 220782.
wyjw marked 4 inline comments as done.
wyjw added a comment.

remove a period


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-object-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
@@ -927,8 +927,7 @@
   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);
Index: llvm/test/tools/llvm-ar/invalid-object-file.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ar/invalid-object-file.test
@@ -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 %t1.txt
+RUN: touch %t1.txt
+RUN: not llvm-ar sc %t1.txt 2>&1 > /dev/null | FileCheck %s
+
+CHECK: llvm-ar{{(.exe|.EXE)?}}: error: unable to load '{{[^']+}}': File too small to be an archive
+CHECK-NOT: {{.}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67038.220782.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190919/8da4a07d/attachment.bin>


More information about the llvm-commits mailing list