[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.

llvm-svn: 338256
This commit is contained in:
Ilya Biryukov 2018-07-30 15:30:45 +00:00
parent 55b1b157b6
commit 24ec072e18
1 changed files with 5 additions and 2 deletions

View File

@ -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);