[PATCH] D51674: [clangd] Fix async index loading (from r341376).
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 10 03:02:09 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341797: [clangd] Fix async index loading (from r341376). (authored by sammccall, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51674?vs=164012&id=164638#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51674
Files:
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
@@ -270,14 +270,17 @@
Opts.ResourceDir = ResourceDir;
Opts.BuildDynamicSymbolIndex = EnableIndex;
std::unique_ptr<SymbolIndex> StaticIdx;
+ std::future<void> AsyncIndexLoad; // Block exit while loading the index.
if (EnableIndex && !YamlSymbolFile.empty()) {
// Load the index asynchronously. Meanwhile SwapIndex returns no results.
SwapIndex *Placeholder;
StaticIdx.reset(Placeholder = new SwapIndex(llvm::make_unique<MemIndex>()));
- runAsync<void>([Placeholder, &Opts] {
+ AsyncIndexLoad = runAsync<void>([Placeholder, &Opts] {
if (auto Idx = loadIndex(YamlSymbolFile, Opts.URISchemes, UseDex))
Placeholder->reset(std::move(Idx));
});
+ if (RunSynchronously)
+ AsyncIndexLoad.wait();
}
Opts.StaticIndex = StaticIdx.get();
Opts.AsyncThreadsCount = WorkerThreadsCount;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51674.164638.patch
Type: text/x-patch
Size: 1080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180910/5457d487/attachment.bin>
More information about the cfe-commits
mailing list