[PATCH] D51989: [clangd] dexp tool uses llvm::cl to parse its flags.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 12 07:45:26 PDT 2018


sammccall created this revision.
sammccall added a reviewer: kbobyrev.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov.

We can use cl::ResetCommandLineParser() to support different types of
command-lines, as long as we're careful about option lifetimes.
(I tried using subcommands, but the error messages were bad)
I found a mostly-reasonable pattern to isolate the fiddly parts.

Added -scope and -limit flags to the `find` command to demonstrate.
(Note that scope support seems to be broken in dex?)

Fixed symbol lookup to parse symbol IDs.

Caveats:

- with command help (e.g. `find -help`), you also get some spam about required arguments. This is a bug in llvm::cl, which prints these to errs() rather than the designated stream.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51989

Files:
  clangd/index/dex/dexp/Dexp.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51989.165088.patch
Type: text/x-patch
Size: 8430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180912/c557cb9c/attachment-0001.bin>


More information about the cfe-commits mailing list