[PATCH] D59746: [LibTooling] Fix '-h' option

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 08:19:43 PDT 2019


hintonda added a comment.

In D59746#1459826 <https://reviews.llvm.org/D59746#1459826>, @hintonda wrote:

> In D59746#1459672 <https://reviews.llvm.org/D59746#1459672>, @klimek wrote:
>
> > In D59746#1458539 <https://reviews.llvm.org/D59746#1458539>, @hintonda wrote:
> >
> > > In D59746#1458461 <https://reviews.llvm.org/D59746#1458461>, @hintonda wrote:
> > >
> > > > In D59746#1458432 <https://reviews.llvm.org/D59746#1458432>, @klimek wrote:
> > > >
> > > > > 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));
> > > >
> > >
> > >
> > > The other problem is that these are statics, so you can't count on the order, i.e., did the user overwrite get processed before or after the one in `CommandLine.cpp`?
> >
> >
> > If we can extend cl::alias to support this, we could give it a priority and take the highest prio :)
>
>
> Okay, I'll give it that old college try, and see if I can come up with something not too kludgy.  ;-)


Btw, do you just want default aliases, or default options in general?


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