[llvm-dev] PSA: llvm::cl now supports subcommands

Zachary Turner via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 30 10:54:01 PDT 2016


I submitted this yesterday in r274171.  I think this allows for a more
intuitive way to structure the options of command line tools.  It's
optional and if you do nothing llvm::cl will work as it always has for you.

Probably self explanatory, but here's some output of --help from
llvm-pdbdump, which was updated to use subcommands in r274247, in case
anyone wants to see what this looks like.

D:\src\llvmbuild\clang-selfhost>bin\llvm-pdbdump --help
OVERVIEW: LLVM PDB Dumper

USAGE: llvm-pdbdump.exe [subcommand] [options]

SUBCOMMANDS:

  pdb2yaml - Generate a detailed YAML description of a PDB File
  pretty   - Dump semantic information about types and symbols
  raw      - Dump raw structure of the PDB file
  yaml2pdb - Generate a PDB file from a YAML description

  Type "llvm-pdbdump.exe <subcommand> -help" to get more help on a specific
subcommand

OPTIONS:

Generic Options:

  -help      - Display available options (-help-hidden for more)
  -help-list - Display list of available options (-help-list-hidden for
more)
  -version   - Display the version of this program






D:\src\llvmbuild\clang-selfhost>bin\llvm-pdbdump pretty --help
OVERVIEW: LLVM PDB Dumper

SUBCOMMAND 'pretty': Dump semantic information about types and symbols

USAGE: llvm-pdbdump.exe pretty [options] <input PDB files>

OPTIONS:

Filtering Options:

  -exclude-compilands=<string> - Exclude compilands by regular expression
  -exclude-symbols=<string>    - Exclude symbols by regular expression
  -exclude-types=<string>      - Exclude types by regular expression
  -include-compilands=<string> - Include only compilands those which match
a regular expression
  -include-symbols=<string>    - Include only symbols which match a regular
expression
  -include-types=<string>      - Include only types which match a regular
expression
  -no-class-definitions        - Don't display full class definitions
  -no-compiler-generated       - Don't show compiler generated types and
symbols
  -no-enum-definitions         - Don't display full enum definitions
  -no-system-libs              - Don't show symbols from system libraries

Generic Options:

  -help                        - Display available options (-help-hidden
for more)
  -help-list                   - Display list of available options
(-help-list-hidden for more)

Other Options:

  -load-address=<uint>         - Assume the module is loaded at the
specified address

Symbol Type Options:

  -all                         - Implies all other options in 'Symbol
Types' category
  -compilands                  - Display compilands
  -externals                   - Dump external symbols
  -globals                     - Dump global symbols
  -lines                       - Line tables
  -symbols                     - Display symbols for each compiland
  -types                       - Display types





D:\src\llvmbuild\clang-selfhost>bin\llvm-pdbdump pdb2yaml --help
OVERVIEW: LLVM PDB Dumper

SUBCOMMAND 'pdb2yaml': Generate a detailed YAML description of a PDB File

USAGE: llvm-pdbdump.exe pdb2yaml [options] <input PDB file>

OPTIONS:

General options:

  -stream-directory - Dump each stream's block map (implies
-stream-metadata)
  -stream-metadata  - Dump the number of streams and each stream's size

Generic Options:

  -help             - Display available options (-help-hidden for more)
  -help-list        - Display list of available options (-help-list-hidden
for more)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160630/0ef66585/attachment.html>


More information about the llvm-dev mailing list