[clang-tools-extra] 79ed24e - [clangd] Enable standard library index by default.

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 21:46:48 PDT 2022


Author: Sam McCall
Date: 2022-10-08T06:45:59+02:00
New Revision: 79ed24eea37f00b02d427f8ca59570546a5037a4

URL: https://github.com/llvm/llvm-project/commit/79ed24eea37f00b02d427f8ca59570546a5037a4
DIFF: https://github.com/llvm/llvm-project/commit/79ed24eea37f00b02d427f8ca59570546a5037a4.diff

LOG: [clangd] Enable standard library index by default.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h
index b34f96bc1206a..9e482fa4bdcda 100644
--- a/clang-tools-extra/clangd/Config.h
+++ b/clang-tools-extra/clangd/Config.h
@@ -85,7 +85,7 @@ struct Config {
     /// Whether this TU should be background-indexed.
     BackgroundPolicy Background = BackgroundPolicy::Build;
     ExternalIndexSpec External;
-    bool StandardLibrary = false;
+    bool StandardLibrary = true;
   } Index;
 
   enum UnusedIncludesPolicy { Strict, None };

diff  --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 4280e810a412d..68c0a51a2d74d 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -360,6 +360,7 @@ opt<bool> Test{
     cat(Misc),
     desc("Abbreviation for -input-style=delimited -pretty -sync "
          "-enable-test-scheme -enable-config=0 -log=verbose -crash-pragmas. "
+         "Also sets config options: Index.StandardLibrary=false. "
          "Intended to simplify lit tests"),
     init(false),
     Hidden,
@@ -697,6 +698,9 @@ class FlagsConfigProvider : public config::Provider {
         C.Index.Background = *BGPolicy;
       if (AllScopesCompletion.getNumOccurrences())
         C.Completion.AllScopes = AllScopesCompletion;
+
+      if (Test)
+        C.Index.StandardLibrary = false;
       return true;
     };
   }


        


More information about the cfe-commits mailing list