[PATCH] D83530: [llvm-symbolizer] Switch command line parsing from llvm::cl to OptTable

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 10:04:42 PDT 2020


MaskRay added a comment.

Many thanks to @lichray's feedback!

> 1. Response file usage.
> 2. Spell-checking of option names.
> 3. Argument type checking and conversion (e.g. to integer, enum etc).
> 4. Integer argument signedness checking.
> 5. Unknown argument handling.
> 6. Options specified via environment variables.
> 7. Help text printing.

1, 2, 5 and 6 are handled by the new high-level API OptTable::parseArgs.

For 7, I think `printHelp` is as simple as if we handle it in the library.

For 3 and 4, they are handled by the same function `parseIntArg` and the underlying `llvm::to_integer`.
We could save some code by adding a new class representing the option type to .td files.
The appropriate abstraction requires more thoughts and probably needs some a few more cases
for us to form an opinion.

FWIW, llvm-symbolizer.cpp is 17 lines shorter than the previous revision.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83530



More information about the llvm-commits mailing list