[PATCH] D51638: [clangd] Load static index asynchronously, add tracing.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 00:18:47 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp:287
+    StaticIdx.reset(Placeholder = new SwapIndex(llvm::make_unique<MemIndex>()));
+    runAsync<void>([Placeholder] {
+      if (auto Idx = loadIndex(YamlSymbolFile))
----------------
Wouldn't the future returned by `runAsync` wait in destructor?


================
Comment at: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp:288
+    runAsync<void>([Placeholder] {
+      if (auto Idx = loadIndex(YamlSymbolFile))
+        Placeholder->reset(std::move(Idx));
----------------
What happens if clangd tries to exit before the index is loaded?
Could lead to crashes.


Repository:
  rL LLVM

https://reviews.llvm.org/D51638





More information about the cfe-commits mailing list