[PATCH] D67038: [llvm-ar] Removes repetition in the error message

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 21:40:22 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372370: [llvm-ar] Removes repetition in the error message (authored by MaskRay, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67038?vs=220782&id=220944#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67038

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


Index: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
===================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp
+++ llvm/trunk/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/trunk/test/tools/llvm-ar/invalid-object-file.test
===================================================================
--- llvm/trunk/test/tools/llvm-ar/invalid-object-file.test
+++ llvm/trunk/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 %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: {{.}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67038.220944.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/dbf7deb6/attachment-0001.bin>


More information about the llvm-commits mailing list