kadircet created this revision.
kadircet added a reviewer: ilya-biryukov.
Herald added subscribers: usaxena95, arphaman, javed.absar.
Herald added a project: All.
kadircet requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang-tools-extra.

Retrieving compile flags might invalidate the environment of an update
request (e.g. generating build artifacts that wasn't captured at the time of
AddDocument notification). This enables clients with such behavior to optimize
away these intermediate AST builds.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131569

Files:
  clang-tools-extra/clangd/TUScheduler.cpp


Index: clang-tools-extra/clangd/TUScheduler.cpp
===================================================================
--- clang-tools-extra/clangd/TUScheduler.cpp
+++ clang-tools-extra/clangd/TUScheduler.cpp
@@ -894,6 +894,14 @@
       FileInputs = Inputs;
     }
 
+    if (isCancelled()) {
+      log("ASTWorker skipping update {0} for file {1}", Inputs.Version,
+          FileName);
+      // Don't even emplace a preamble, as we still want the first valid update
+      // to block any further reads.
+      return;
+    }
+
     log("ASTWorker building file {0} version {1} with command {2}\n[{3}]\n{4}",
         FileName, Inputs.Version, Inputs.CompileCommand.Heuristic,
         Inputs.CompileCommand.Directory,


Index: clang-tools-extra/clangd/TUScheduler.cpp
===================================================================
--- clang-tools-extra/clangd/TUScheduler.cpp
+++ clang-tools-extra/clangd/TUScheduler.cpp
@@ -894,6 +894,14 @@
       FileInputs = Inputs;
     }
 
+    if (isCancelled()) {
+      log("ASTWorker skipping update {0} for file {1}", Inputs.Version,
+          FileName);
+      // Don't even emplace a preamble, as we still want the first valid update
+      // to block any further reads.
+      return;
+    }
+
     log("ASTWorker building file {0} version {1} with command {2}\n[{3}]\n{4}",
         FileName, Inputs.Version, Inputs.CompileCommand.Heuristic,
         Inputs.CompileCommand.Directory,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to