ilya-biryukov created this revision. ilya-biryukov added a reviewer: ioeric. Herald added subscribers: arphaman, jkorous, MaskRay, javed.absar.
It can be washed out from the cache before first access anyway, so building it can just be a waste of time. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D49991 Files: clangd/TUScheduler.cpp Index: clangd/TUScheduler.cpp =================================================================== --- clangd/TUScheduler.cpp +++ clangd/TUScheduler.cpp @@ -383,6 +383,14 @@ // Remove the old AST if it's still in cache. IdleASTs.take(this); + if (WantDiags == WantDiagnostics::No) { + // If no diagnostics were requested, building it in advance might be a + // waste if it will be removed from the cache before it is first accessed. + // So we choose to avoid building it in the first place, the rebuild will + // happen on first access instead. + return; + } + // Build the AST for diagnostics. llvm::Optional<ParsedAST> AST = buildAST(FileName, std::move(Invocation), Inputs, NewPreamble, PCHs);
Index: clangd/TUScheduler.cpp =================================================================== --- clangd/TUScheduler.cpp +++ clangd/TUScheduler.cpp @@ -383,6 +383,14 @@ // Remove the old AST if it's still in cache. IdleASTs.take(this); + if (WantDiags == WantDiagnostics::No) { + // If no diagnostics were requested, building it in advance might be a + // waste if it will be removed from the cache before it is first accessed. + // So we choose to avoid building it in the first place, the rebuild will + // happen on first access instead. + return; + } + // 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