Author: ibiryukov Date: Mon Jul 30 08:30:45 2018 New Revision: 338256 URL: http://llvm.org/viewvc/llvm-project?rev=338256&view=rev Log: [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. Modified: clang-tools-extra/trunk/clangd/TUScheduler.cpp Modified: clang-tools-extra/trunk/clangd/TUScheduler.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/TUScheduler.cpp?rev=338256&r1=338255&r2=338256&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/TUScheduler.cpp (original) +++ clang-tools-extra/trunk/clangd/TUScheduler.cpp Mon Jul 30 08:30:45 2018 @@ -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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits