[PATCH] D148088: [RFC][clangd] Move preamble index task to a seperate task

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 14:05:46 PDT 2023


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:88
+    if (PreambleIndexTask)
+      PreambleIndexTask->runAsync("task:" + Path + Version,
+                                  std::move(Task));
----------------
ilya-biryukov wrote:
> This definitely does not work. After `onPreambleAST` returns, the AST will be destroyed and async tasks may access it afterwards.
> 
https://reviews.llvm.org/D115768 is a very rough prototype from a couple of years ago of how to keep the preamble AST alive in a separate object that I believe would be safe to index from even after returning from onPreambleAST.
(Though the patch doesn't actually do that, that was the idea)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148088/new/

https://reviews.llvm.org/D148088



More information about the cfe-commits mailing list