[PATCH] D59746: [LibTooling] Fix '-h' option
Don Hinton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 8 08:24:59 PDT 2019
hintonda added a comment.
In D59746#1458432 <https://reviews.llvm.org/D59746#1458432>, @klimek wrote:
> In D59746#1458424 <https://reviews.llvm.org/D59746#1458424>, @hintonda wrote:
>
> > In D59746#1458086 <https://reviews.llvm.org/D59746#1458086>, @klimek wrote:
> >
> > > In D59746#1440756 <https://reviews.llvm.org/D59746#1440756>, @hintonda wrote:
> > >
> > > > A better alternative would have been to add a cl::aliasopt for '-h' in llvm's CommandLineParser when '-help' was first added. However, that's no longer possible since some llvm based tools already use '-h' for other purposes.
> > >
> > >
> > > Is that intentional? Can you point at samples?
> >
> >
> > A quick grep found these -- there could be more.
> >
> > llvm-opt-report adds `-h` for help and handles it after `ParseCommandLineOptions` returns.
> > llvm-objdump adds `-h` as an alias for `--section-headers`.
> > dsymutil adds `-h` for help and handles it after `ParseCommandLineOptions` returns.
> > llvm-readobj adds `-h` as an alias for `--file-headers`.
> > llvm-dwarfdump adds `-h` for help and handles it after `ParseCommandLineOptions` returns.
> > llvm-mt rolls its own via llvm-tblgen.
> >
> > So, the only ones I found that aren't essentially aliases for help are in llvm-objdump and llvm-readobj.
>
>
> If we make it an alias by default, can somebody overwrite that?
Unfortunately, that produces a runtime error:
lan1:/Users/dhinton/projects/llvm_project/monorepo/build/Debug $ bin/llvm-objdump -h
: CommandLine Error: Option 'h' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
The operative lines:
llvm/tools/llvm-objdump/llvm-objdump.cpp:187:static cl::alias SectionHeadersShorter("h",
llvm/lib/Support/CommandLine.cpp:2149:static cl::alias HOpA("h", cl::desc("Alias for -help"), cl::aliasopt(HOp));
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59746/new/
https://reviews.llvm.org/D59746
More information about the cfe-commits
mailing list