[clang-tools-extra] r366575 - [clangd] Disable background-index on lit-tests by default

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 06:40:30 PDT 2019


Author: kadircet
Date: Fri Jul 19 06:40:30 2019
New Revision: 366575

URL: http://llvm.org/viewvc/llvm-project?rev=366575&view=rev
Log:
[clangd] Disable background-index on lit-tests by default

Summary:
Since background-index can perform disk writes, we don't want to turn
it on tests that won't clear it.

Reviewers: sammccall

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

Tags: #clang

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

Modified:
    clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp

Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=366575&r1=366574&r2=366575&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Fri Jul 19 06:40:30 2019
@@ -355,8 +355,12 @@ int main(int argc, char *argv[]) {
     InputStyle = JSONStreamStyle::Delimited;
     LogLevel = Logger::Verbose;
     PrettyPrint = true;
+    // Disable background index on lit tests by default to prevent disk writes.
+    if (!EnableBackgroundIndex.getNumOccurrences())
+      EnableBackgroundIndex = false;
     // Ensure background index makes progress.
-    BackgroundQueue::preventThreadStarvationInTests();
+    else if (EnableBackgroundIndex)
+      BackgroundQueue::preventThreadStarvationInTests();
   }
   if (Test || EnableTestScheme) {
     static URISchemeRegistry::Add<TestScheme> X(




More information about the cfe-commits mailing list