[clangd] dexp tool uses llvm::cl to parse its flags.
authorSam McCall <sam.mccall@gmail.com>
Tue, 18 Sep 2018 09:49:57 +0000 (09:49 +0000)
committerSam McCall <sam.mccall@gmail.com>
Tue, 18 Sep 2018 09:49:57 +0000 (09:49 +0000)
commit3bf9b6d920791417f285521d37d24deba5e0ac67
tree9a6848b78d5d8f09045a9284a3efcd65ac2eaa8c
parent85d6a5599509fef8f2b5fe72f4ee23187d65c68e
[clangd] dexp tool uses llvm::cl to parse its flags.

Summary:
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.

Reviewers: kbobyrev

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D51989

llvm-svn: 342456
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/test/CMakeLists.txt