[PATCH] D49991: [clangd] Do not build AST if no diagnostics were requested

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 31 06:46:08 PDT 2018

This revision was automatically updated to reflect the committed changes.
Closed by commit rL338378: [clangd] Do not build AST if no diagnostics were requested (authored by ibiryukov, committed by ).
Herald added a subscriber: llvm-commits.




Index: clang-tools-extra/trunk/clangd/TUScheduler.cpp
--- clang-tools-extra/trunk/clangd/TUScheduler.cpp
+++ clang-tools-extra/trunk/clangd/TUScheduler.cpp
@@ -391,19 +391,22 @@
+    // We only need to build the AST if diagnostics were requested.
+    if (WantDiags == WantDiagnostics::No)
+      return;
     // Get the AST for diagnostics.
     llvm::Optional<std::unique_ptr<ParsedAST>> AST = IdleASTs.take(this);
     if (!AST) {
       llvm::Optional<ParsedAST> NewAST =
           buildAST(FileName, std::move(Invocation), Inputs, NewPreamble, PCHs);
       AST = NewAST ? llvm::make_unique<ParsedAST>(std::move(*NewAST)) : nullptr;
     // We want to report the diagnostics even if this update was cancelled.
     // It seems more useful than making the clients wait indefinitely if they
     // spam us with updates.
     // Note *AST can be still be null if buildAST fails.
-    if (WantDiags != WantDiagnostics::No && *AST) {
+    if (*AST) {
       DiagsWereReported = true;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49991.158240.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180731/2d9ce133/attachment.bin>

More information about the cfe-commits mailing list