From 19874c05bf8ced0e0d45e229b5c9a5d058432caf Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 30 Jul 2018 15:30:45 +0000 Subject: [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 --- clangd/TUScheduler.cpp | 7 +++++-- 1 file 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 AST = buildAST(FileName, std::move(Invocation), Inputs, NewPreamble, PCHs); -- cgit v1.2.3