Index: clangd/tool/ClangdMain.cpp =================================================================== --- clangd/tool/ClangdMain.cpp +++ clangd/tool/ClangdMain.cpp @@ -280,11 +280,12 @@ Opts.ResourceDir = ResourceDir; Opts.BuildDynamicSymbolIndex = EnableIndex; std::unique_ptr StaticIdx; + std::future 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())); - runAsync([Placeholder] { + AsyncIndexLoad = runAsync([Placeholder] { if (auto Idx = loadIndex(YamlSymbolFile)) Placeholder->reset(std::move(Idx)); });