Revert "[clangd] Always run preamble indexing on a separate thread"
authorKadir Cetinkaya <kadircet@google.com>
Wed, 19 Jul 2023 07:14:23 +0000 (09:14 +0200)
committerKadir Cetinkaya <kadircet@google.com>
Wed, 19 Jul 2023 08:38:23 +0000 (10:38 +0200)
This reverts commit 036a1b2202cb71aacfa72ef15145a88dc50a02cf.

Triggering failures under tsan, https://lab.llvm.org/buildbot/#/builders/131/builds/48349

clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h

index 763fea6..cbcc902 100644 (file)
@@ -93,7 +93,7 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
                              ASTCtx.getPreprocessor(), *CanonIncludes);
     };
 
-    if (Tasks) {
+    if (Opts.AsyncPreambleIndexing && Tasks) {
       Tasks->runAsync("Preamble indexing for:" + Path + Version,
                       std::move(Task));
     } else
index 2bc8f02..88b6d2f 100644 (file)
@@ -185,6 +185,10 @@ public:
     /// regions in the document.
     bool PublishInactiveRegions = false;
 
+    /// Whether to run preamble indexing asynchronously in an independent
+    /// thread.
+    bool AsyncPreambleIndexing = false;
+
     explicit operator TUScheduler::Options() const;
   };
   // Sensible default options for use in tests.