This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Switch command-line parsing from llvm::cl to OptTable
ClosedPublic

Authored by thakis on Apr 13 2021, 6:56 PM.

Details

Summary

This is similar to D83530, but for llvm-objdump.

The motivation is the desire to add an llvm-otool symlink to
llvm-objdump that behaves like macOS's otool, using the same
technique the at llvm-objcopy uses to behave like strip (etc).

This change for the most part preserves behavior. In some cases,
it increases compatibility with GNU objdump a bit. For example,
the long options now require two dashes, and the long options
taking arguments for the most part now require a = in front
of the value. Exceptions are flags where tests passed the
value separately, for these the separate form is kept as
an alias to the = form.

The one-letter short form args are now joined or separate
and long longer accept a =, which also matches GNU objdump.

cl::opt<>s in libraries now have to be explicitly plumbed
through. This patch does that for --x86-asm-syntax=, but
there's hope that we can remove that again.

Diff Detail

Event Timeline

thakis created this revision.Apr 13 2021, 6:56 PM
thakis requested review of this revision.Apr 13 2021, 6:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2021, 6:56 PM
MaskRay accepted this revision.Apr 13 2021, 7:58 PM
MaskRay added inline comments.
llvm/tools/llvm-objdump/ObjdumpOpts.td
10

This needs a test in llvm-objdump/help.test

This revision is now accepted and ready to land.Apr 13 2021, 7:58 PM
thakis marked an inline comment as done.Apr 14 2021, 5:12 PM

Thanks!

This revision was landed with ongoing or failed builds.Apr 14 2021, 5:12 PM
This revision was automatically updated to reflect the committed changes.