[PATCH] D106783: [AIX][XCOFF][llvm-readobj] Replace unwrapOrError with reportUniqueWarning
Maryam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 00:56:26 PDT 2021
MaryamBen updated this revision to Diff 362294.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106783/new/
https://reviews.llvm.org/D106783
Files:
llvm/tools/llvm-readobj/XCOFFDumper.cpp
Index: llvm/tools/llvm-readobj/XCOFFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/XCOFFDumper.cpp
+++ llvm/tools/llvm-readobj/XCOFFDumper.cpp
@@ -134,16 +134,27 @@
if (Sec.Flags != XCOFF::STYP_TEXT && Sec.Flags != XCOFF::STYP_DATA &&
Sec.Flags != XCOFF::STYP_TDATA && Sec.Flags != XCOFF::STYP_DWARF)
continue;
- auto Relocations = unwrapOrError(Obj.getFileName(), Obj.relocations(Sec));
+ auto ErrOrRelocations = Obj.relocations(Sec);
+ if (Error E = ErrOrRelocations.takeError()) {
+ reportUniqueWarning(std::move(E));
+ continue;
+ }
+
+ auto Relocations = *ErrOrRelocations;
if (Relocations.empty())
continue;
W.startLine() << "Section (index: " << Index << ") " << Sec.getName()
<< " {\n";
for (auto Reloc : Relocations) {
- StringRef SymbolName = unwrapOrError(
- Obj.getFileName(), Obj.getSymbolNameByIndex(Reloc.SymbolIndex));
+ Expected<StringRef> ErrOrSymbolName =
+ Obj.getSymbolNameByIndex(Reloc.SymbolIndex);
+ if (Error E = ErrOrSymbolName.takeError()) {
+ reportUniqueWarning(std::move(E));
+ continue;
+ }
+ StringRef SymbolName = *ErrOrSymbolName;
DictScope RelocScope(W, "Relocation");
W.printHex("Virtual Address", Reloc.VirtualAddress);
W.printNumber("Symbol", SymbolName, Reloc.SymbolIndex);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106783.362294.patch
Type: text/x-patch
Size: 1442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210728/b947f22b/attachment.bin>
More information about the llvm-commits
mailing list