[PATCH] D90751: [clangd] Use ProjectAwareIndex
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 20 01:37:55 PST 2020
kadircet updated this revision to Diff 306621.
kadircet added a comment.
- Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90751/new/
https://reviews.llvm.org/D90751
Files:
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -13,6 +13,9 @@
#include "Protocol.h"
#include "Transport.h"
#include "index/Background.h"
+#include "index/Index.h"
+#include "index/Merge.h"
+#include "index/ProjectAware.h"
#include "index/Serialization.h"
#include "index/remote/Client.h"
#include "refactor/Rename.h"
@@ -40,6 +43,7 @@
#include <mutex>
#include <string>
#include <thread>
+#include <vector>
#ifndef _WIN32
#include <unistd.h>
@@ -726,6 +730,7 @@
Opts.ResourceDir = ResourceDir;
Opts.BuildDynamicSymbolIndex = EnableIndex;
Opts.CollectMainFileRefs = CollectMainFileRefs;
+ std::vector<std::unique_ptr<SymbolIndex>> IdxStack;
std::unique_ptr<SymbolIndex> StaticIdx;
std::future<void> AsyncIndexLoad; // Block exit while loading the index.
if (EnableIndex && !IndexFile.empty()) {
@@ -757,7 +762,15 @@
}
#endif
Opts.BackgroundIndex = EnableBackgroundIndex;
- Opts.StaticIndex = StaticIdx.get();
+ auto PAI = createProjectAwareIndex();
+ if (StaticIdx) {
+ IdxStack.emplace_back(std::move(StaticIdx));
+ IdxStack.emplace_back(
+ std::make_unique<MergedIndex>(PAI.get(), IdxStack.back().get()));
+ Opts.StaticIndex = IdxStack.back().get();
+ } else {
+ Opts.StaticIndex = PAI.get();
+ }
Opts.AsyncThreadsCount = WorkerThreadsCount;
Opts.BuildRecoveryAST = RecoveryAST;
Opts.PreserveRecoveryASTType = RecoveryASTType;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90751.306621.patch
Type: text/x-patch
Size: 1576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201120/ba97a462/attachment.bin>
More information about the cfe-commits
mailing list