[PATCH] D62105: [CommandLine] Remove OptionCategory and SubCommand caches from the Option class.

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 09:25:10 PDT 2019


hintonda added a comment.

Even though this patch has been accepted, I've made 2 additional changes, and would 
like to have them reviewed as well.

The first just reduces the compile-time default container sizes for the get* methods, 
which shouldn't be too controversial.

However, the second is a bit more involved, and can be viewed in the following two 
diffs -- the second of which just makes addArgument virtual.

  https://reviews.llvm.org/D62105?vs=201049&id=202622&whitespace=ignore-most#toc
  https://reviews.llvm.org/D62105?vs=204984&id=205092&whitespace=ignore-most#toc

It fixes bugs in the following two use cases (please see the two additional uinittests that 
cover these):

- When a users incorrectly passes a `cl::sub` argument to an Alias ctor:

  Since Alias's use the SubCommands of the Option they alias, this argument should be ignored, or assert.



- When using SubCommands with duplicate Alias's, within the scope of a SubCommand:

  In order to distinguish which SubCommand the matching Alias belongs, it is necessary to compare the found option to `this`.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62105





More information about the llvm-commits mailing list