[clang-tools-extra] r338015 - [clangd] Give an example for symbol-builder usage

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 26 02:41:24 PDT 2018


Author: omtcyfz
Date: Thu Jul 26 02:41:24 2018
New Revision: 338015

URL: http://llvm.org/viewvc/llvm-project?rev=338015&view=rev
Log:
[clangd] Give an example for symbol-builder usage

`global-symbol-builder` help message mentions `-executor=<string>`
option, but doesn't give any example of what the value could be

Assuming the most popular use case to be building the whole project
index, help message should probably give an example of such usage.

Reviewers: ioeric

Subscribers: cfe-commits

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

Modified:
    clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp

Modified: clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp?rev=338015&r1=338014&r2=338015&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp Thu Jul 26 02:41:24 2018
@@ -150,10 +150,23 @@ SymbolSlab mergeSymbols(tooling::ToolRes
 int main(int argc, const char **argv) {
   llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
 
-  const char* Overview =
-      "This is an **experimental** tool to generate YAML-format "
-      "project-wide symbols for clangd (global code completion). It would be "
-      "changed and deprecated eventually. Don't use it in production code!";
+  const char *Overview = R"(
+  This is an **experimental** tool to generate YAML-format project-wide symbols
+  for clangd (global code completion). It would be changed and deprecated
+  eventually. Don't use it in production code!
+
+  Example usage for building index for the whole project using CMake compile
+  commands:
+
+  $ global-symbol-builder --executor=all-TUs compile_commands.json > index.yaml
+
+  Example usage for file sequence index without flags:
+
+  $ global-symbol-builder File1.cpp File2.cpp ... FileN.cpp > index.yaml
+
+  Note: only symbols from header files will be collected.
+  )";
+
   auto Executor = clang::tooling::createExecutorFromCommandLineArgs(
       argc, argv, cl::GeneralCategory, Overview);
 




More information about the cfe-commits mailing list