summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeComplete.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-01-12 18:30:08 +0000
committerSam McCall <sam.mccall@gmail.com>2018-01-12 18:30:08 +0000
commit3d139c527be3f29b8cfc78cba90a9b2b26374820 (patch)
treeba2fb3c7cce6e78d0262946e6e5eec09c2520ff8 /clang-tools-extra/clangd/CodeComplete.cpp
parent5e102eeee6ef0b6da3a4d683469e9954c000a09c (diff)
downloadbcm5719-llvm-3d139c527be3f29b8cfc78cba90a9b2b26374820.tar.gz
bcm5719-llvm-3d139c527be3f29b8cfc78cba90a9b2b26374820.zip
[clangd] Code completion uses Sema for NS-level things in the current file.
Summary: To stay fast, it avoids deserializing anything outside the current file, by disabling the LoadExternal code completion option added in r322377, when the index is enabled. Reviewers: hokein Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41996 llvm-svn: 322387
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index e2fc5019708..fa6c5d18a71 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -642,8 +642,10 @@ clang::CodeCompleteOptions CodeCompleteOptions::getClangCompleteOpts() const {
Result.IncludeGlobals = IncludeGlobals;
Result.IncludeBriefComments = IncludeBriefComments;
- // Enable index-based code completion when Index is provided.
- Result.IncludeNamespaceLevelDecls = !Index;
+ // When an is used, Sema is responsible for completing the main file,
+ // the index can provide results from the preamble.
+ // Tell Sema not to deserialize the preamble to look for results.
+ Result.LoadExternal = !Index;
return Result;
}
OpenPOWER on IntegriCloud