[PATCH] D83639: [OptTable] Support grouped short options

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 14:12:39 PDT 2020


MaskRay added a comment.

I have mentioned why I chose for a new parseOneArg rather than extending the existing ParseOneArg. I'll make more comments here:

On the interface side:

- ParseOneArg needs to work with a const reference and a DerivedArgList (only used in clang driver). clang driver has unique requirement that some features require to parse on argument on the fly.
- parseOneArg needs to work with a mutable ArgList. Since we don't need complex stuff in clang, I simply make the parameter `InputArgList &`. The function is only called/driven by OptTable::ParseArgs. The instance is mutable - so there is no point making `InputArgList &` const. It would made several called functions complex.

On the feature side:

- (a) ParseOneArg needs to deal with Windows specific stuff (clang-cl (FlagsToInclude/FlagsToExclude), lld COFF case-insensitive options).
- (b) parseOneArg deals with GNU getopt_long style command line.

(a) added sufficient complexity to ParseOneArg. I don't want to make it more complex. The duplicated stuff is small - just 50 lines of code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83639





More information about the llvm-commits mailing list