[PATCH] D133607: Improve ArchiveWriter diagnostics
Yi Kong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 10 06:08:48 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc0725a43763: [Object] Improve ArchiveWriter diagnostics (authored by kongyi).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133607/new/
https://reviews.llvm.org/D133607
Files:
llvm/lib/Object/ArchiveWriter.cpp
llvm/test/Object/archive-malformed-object.test
Index: llvm/test/Object/archive-malformed-object.test
===================================================================
--- llvm/test/Object/archive-malformed-object.test
+++ llvm/test/Object/archive-malformed-object.test
@@ -10,13 +10,13 @@
# RUN: %python -c "with open('input.bc', 'a') as f: f.truncate(10)"
# RUN: not llvm-ar rc bad.a input.bc 2>&1 | FileCheck %s --check-prefix=ERR1
-# ERR1: error: bad.a: Invalid bitcode signature
+# ERR1: error: bad.a: 'input.bc': Invalid bitcode signature
## Non-bitcode malformed file.
# RUN: yaml2obj input.yaml -o input.o
# RUN: not llvm-ar rc bad.a input.o 2>&1 | FileCheck %s --check-prefix=ERR2
-# ERR2: error: bad.a: section header table goes past the end of the file: e_shoff = 0x9999
+# ERR2: error: bad.a: 'input.o': section header table goes past the end of the file: e_shoff = 0x9999
## Don't emit an error if the symbol table is not required.
# RUN: llvm-ar rcS good.a input.o input.bc
Index: llvm/lib/Object/ArchiveWriter.cpp
===================================================================
--- llvm/lib/Object/ArchiveWriter.cpp
+++ llvm/lib/Object/ArchiveWriter.cpp
@@ -598,8 +598,8 @@
if (NeedSymbols) {
Expected<std::vector<unsigned>> SymbolsOrErr =
getSymbols(Buf, SymNames, HasObject);
- if (auto E = SymbolsOrErr.takeError())
- return std::move(E);
+ if (!SymbolsOrErr)
+ return createFileError(M.MemberName, SymbolsOrErr.takeError());
Symbols = std::move(*SymbolsOrErr);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133607.459284.patch
Type: text/x-patch
Size: 1516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220910/b4cdb20e/attachment.bin>
More information about the llvm-commits
mailing list