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

Yu Jian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 18:58:05 PDT 2019


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

Made changes to wording and to the test file.


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,9 +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.220420.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190917/505a606c/attachment.bin>


More information about the llvm-commits mailing list