summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-07-30 15:30:45 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-07-30 15:30:45 +0000
commit19874c05bf8ced0e0d45e229b5c9a5d058432caf (patch)
tree358807881ae28c000ecb7bd5a4ff6e91d074bcbd
parentba5e25cf78b01b5319e5fd23107de97373bfa176 (diff)
[clangd] Do not remove AST from cache if nothing changed
We were previously clearing the AST cache if the inputs and the preamble were the same, which is not desired. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@338256 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--clangd/TUScheduler.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clangd/TUScheduler.cpp b/clangd/TUScheduler.cpp
index feacd358..b1ccaf7c 100644
--- a/clangd/TUScheduler.cpp
+++ b/clangd/TUScheduler.cpp
@@ -331,8 +331,6 @@ void ASTWorker::update(
tooling::CompileCommand OldCommand = std::move(FileInputs.CompileCommand);
FileInputs = Inputs;
- // Remove the old AST if it's still in cache.
- IdleASTs.take(this);
log("Updating file {0} with command [{1}] {2}", FileName,
Inputs.CompileCommand.Directory,
@@ -342,6 +340,8 @@ void ASTWorker::update(
buildCompilerInvocation(Inputs);
if (!Invocation) {
elog("Could not build CompilerInvocation for file {0}", FileName);
+ // Remove the old AST if it's still in cache.
+ IdleASTs.take(this);
// Make sure anyone waiting for the preamble gets notified it could not
// be built.
PreambleWasBuilt.notify();
@@ -380,6 +380,9 @@ void ASTWorker::update(
FileName);
return;
}
+ // Remove the old AST if it's still in cache.
+ IdleASTs.take(this);
+
// Build the AST for diagnostics.
llvm::Optional<ParsedAST> AST =
buildAST(FileName, std::move(Invocation), Inputs, NewPreamble, PCHs);