[RFC][clangd] Move preamble index out of document open critical path
authorKugan Vivekanandarajah <kuganv@gmail.com>
Mon, 12 Jun 2023 11:55:29 +0000 (12:55 +0100)
committerIvan Murashko <ivan.murashko@gmail.com>
Mon, 12 Jun 2023 11:56:41 +0000 (12:56 +0100)
commita8ad413f0d18c07a4adaa0d547e0096874d809c5
tree6065db7d45c994057ca3956d9000b93f134885f6
parent45902a25fa19f50f1475c100a2b314346249bb26
[RFC][clangd] Move preamble index out of document open critical path

We would like to move the preamble index out of the critical path.
This patch is an RFC to get feedback on the correct implementation and potential pitfalls to keep into consideration.

I am not entirely sure if the lazy AST initialisation would create using Preamble AST in parallel. I tried with tsan enabled clangd but it seems to work OK (at least for the cases I tried)

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D148088
12 files changed:
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/ParsedAST.cpp
clang-tools-extra/clangd/Preamble.cpp
clang-tools-extra/clangd/Preamble.h
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/TUScheduler.h
clang-tools-extra/clangd/tool/Check.cpp
clang-tools-extra/clangd/unittests/FileIndexTests.cpp
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
clang-tools-extra/clangd/unittests/TestWorkspace.cpp
clang/include/clang/Frontend/CompilerInstance.h