[PATCH] D75131: [XCOFF][AIX] Enable -r option for llvm-objdump
Digger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 13:15:01 PST 2020
DiggerLin added inline comments.
================
Comment at: llvm/lib/BinaryFormat/XCOFF.cpp:65
+ default:
+ report_fatal_error("Unhandled relocation type.");
+ }
----------------
jhenderson wrote:
> This seems fishy. If I was to create a XCOFF object file with a relocation with an unknown type value, would I get this error when e.g. dumping relocations?
>
> My feeling is that anything that uses `report_fatal_error` is a bug waiting to happen. Better would be to return some string indicating an unknown relocation type.
for enum type , if your switch case has enumerate all the case,
please do not use the default, otherwise it will cause a compiler error with clang
================
Comment at: llvm/tools/llvm-objdump/XCOFFDump.cpp:25
+ if (!SymNameOrErr)
+ return SymNameOrErr.takeError();
+ StringRef SymName = *SymNameOrErr;
----------------
I think you can use function unwrapOrError()
something like
StringRef SymbolName =
unwrapOrError(Obj.getFileName(), Obj.getSymbolName(SymbolDRI));
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75131/new/
https://reviews.llvm.org/D75131
More information about the llvm-commits
mailing list