[PATCH] D51628: [clangd] Implement a Proof-of-Concept tool for symbol index exploration
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 7 07:39:09 PDT 2018
ilya-biryukov added a comment.
Definitely like the idea of the tool. The main complication seems to be parsing of user input at this point.
I suggest we explore an option proposed before, that is reusing the LLVM command-line parser (see inline comment too).
If that turns out to be much work, we could explore rolling out a simple parser for commands on our own.
================
Comment at: clang-tools-extra/clangd/dexplorer/Dexplorer.cpp:39
+
+// FIXME(kbobyrev): Make this an actual REPL: probably use LLVM Command Line
+// library for parsing flags and arguments.
----------------
Maybe we could expose `CommandLineParser` from `llvm/lib/Support/CommandLine.cpp` as a public API and use it here?
Not sure if there are any obstacles to doing so or how much work is it, though.
E.g. `cl::opt` seem to rely on being registered in the global parser and I'm not sure if there's an easy way out of it.
================
Comment at: clang-tools-extra/clangd/dexplorer/Dexplorer.cpp:147
+
+ // FIXME(kbobyrev): Wrap time measurements into something like
+ // measureTime(Function, Arguments...).
----------------
+1 to this FIXME.
Something like:
```
template <class Func>
auto reportTime(StringRef Name, Func F) -> decltype(F()) {
auto Result = F();
llvm::outs() << Name << " took " << ...
return Result;
}
```
The code calling this API would be quite readable:
```
auto Index = reportTime("Build stage", []() {
return buildStaticIndex(...);
});
```
https://reviews.llvm.org/D51628
More information about the cfe-commits
mailing list