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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372370
91177308-0d34-0410-b5e6-
96231b3b80d8
--- /dev/null
+## 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: {{.}}
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);