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

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 18:56:15 PDT 2021


thakis created this revision.
thakis added reviewers: jhenderson, MaskRay.
Herald added subscribers: pengfei, mgorny.
Herald added a reviewer: alexshap.
thakis requested review of this revision.
Herald added a project: LLVM.

This is similar to D83530 <https://reviews.llvm.org/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.


https://reviews.llvm.org/D100433

Files:
  llvm/test/Support/check-default-options.txt
  llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
  llvm/test/tools/llvm-objdump/help.test
  llvm/test/tools/llvm-objdump/section-filter.test
  llvm/tools/llvm-objdump/CMakeLists.txt
  llvm/tools/llvm-objdump/MachODump.cpp
  llvm/tools/llvm-objdump/MachODump.h
  llvm/tools/llvm-objdump/ObjdumpOptID.h
  llvm/tools/llvm-objdump/ObjdumpOpts.td
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.h
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/utils/gn/secondary/llvm/tools/llvm-objdump/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100433.337307.patch
Type: text/x-patch
Size: 57557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210414/f061df27/attachment.bin>


More information about the llvm-commits mailing list