diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-07-30 15:30:45 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-07-30 15:30:45 +0000 |
commit | 24ec072e18c29a82ac8bc8f2aeed7460be18c456 (patch) | |
tree | 8397aaeb2f720b3f0c1ba612e422a13d74e2cb43 | |
parent | 55b1b157b67c90b8e1adb70226fb9b39200eaf40 (diff) | |
download | llvm-24ec072e18c29a82ac8bc8f2aeed7460be18c456.zip llvm-24ec072e18c29a82ac8bc8f2aeed7460be18c456.tar.gz llvm-24ec072e18c29a82ac8bc8f2aeed7460be18c456.tar.bz2 |
[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
-rw-r--r-- | clang-tools-extra/clangd/TUScheduler.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index feacd35..b1ccaf7 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/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); |