[clang-tools-extra] r323734 - [clangd] Enable completion index by default, limit results to 100.

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 01:21:30 PST 2018


Author: sammccall
Date: Tue Jan 30 01:21:30 2018
New Revision: 323734

URL: http://llvm.org/viewvc/llvm-project?rev=323734&view=rev
Log:
[clangd] Enable completion index by default, limit results to 100.

Summary:
This should speed up global code completion by avoiding deserializing
preamble declarations to look up names. The tradeoff is memory usage.
Currently the index is fairly naive and may not be much faster, but there's lots
of performance headroom.

These two changes go together because results from the index get copied a couple
of times, so we should avoid it for huge sets.

Also the flag should be -completion-limit, rather than -limit-completion.

Reviewers: hokein, ioeric, ilya-biryukov

Subscribers: klimek, jkorous-apple, cfe-commits

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

Modified:
    clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp

Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=323734&r1=323733&r2=323734&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Tue Jan 30 01:21:30 2018
@@ -87,10 +87,10 @@ static llvm::cl::opt<PCHStorageFlag> PCH
     llvm::cl::init(PCHStorageFlag::Disk));
 
 static llvm::cl::opt<int> LimitCompletionResult(
-    "limit-completion",
+    "completion-limit",
     llvm::cl::desc("Limit the number of completion results returned by clangd. "
                    "0 means no limit."),
-    llvm::cl::init(0));
+    llvm::cl::init(100));
 
 static llvm::cl::opt<bool> RunSynchronously(
     "run-synchronously",
@@ -117,9 +117,9 @@ static llvm::cl::opt<Path> TraceFile(
 static llvm::cl::opt<bool> EnableIndexBasedCompletion(
     "enable-index-based-completion",
     llvm::cl::desc(
-        "Enable index-based global code completion (experimental). Clangd will "
-        "use index built from symbols in opened files"),
-    llvm::cl::init(false), llvm::cl::Hidden);
+        "Enable index-based global code completion. "
+        "Clang uses an index built from symbols in opened files"),
+    llvm::cl::init(true));
 
 static llvm::cl::opt<Path> YamlSymbolFile(
     "yaml-symbol-file",




More information about the cfe-commits mailing list