[clangd] Prevent thread starvation in tests on loaded systems.

Summary:
Background index deliberately runs low-priority, but for tests this may stop
them making progress.

Reviewers: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D54938

llvm-svn: 347655
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index e349ee0..ea542c1 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -254,6 +254,7 @@
     RunSynchronously = true;
     InputStyle = JSONStreamStyle::Delimited;
     PrettyPrint = true;
+    preventThreadStarvationInTests(); // Ensure background index makes progress.
   }
   if (Test || EnableTestScheme) {
     static URISchemeRegistry::Add<TestScheme> X(