[PATCH] D104363: [llvm] Mark more internal command line optins as cl::Hidden

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 10:54:50 PDT 2021


MaskRay added a comment.

In D104363#2835868 <https://reviews.llvm.org/D104363#2835868>, @tbaeder wrote:

> The email thread about the llvm busybox implementation contains this paragraph:
>
>> One implementation detail we think will be an issue is merging arguments in individual tools that use `cl::opt`. `cl::opt` works by maintaining a global state of flags, but we aren’t confident of what the resulting behavior will be when merging them together in the dispatching `main`. What we would like to avoid is having flags used by one specific tool available on other tools. To address this issue, we would like to migrate all tools to use `OptTable` which doesn't have this issue and has been the general direction most tools have been already moving into.
>
> So, should all tools use `OptTable` instead?

Many `llvm/tools/*` tools are really internal testing tools. Some are user-facing tools (llvm-objdump, llvm-readelf, llvm-objcopy, llvm-nm, ...).
For user-facing tools, I think it makes sense to convert them to `OptTable`. `cl::opt` can emulate GNU style `getopt_long` which we may be familiar with but there are some rough corners (see the description of D83530 <https://reviews.llvm.org/D83530>).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104363/new/

https://reviews.llvm.org/D104363



More information about the llvm-commits mailing list