[clang-tools-extra] [clangd] Enable config files by default in clangd-indexer (PR #228683)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 3 03:09:45 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: Denis (Fil-Den)

<details>
<summary>Changes</summary>

This is a continuation of #<!-- -->214951. It enables config file support by default. The change is small, so it can be easily reverted if needed.

---
Full diff: https://github.com/llvm/llvm-project/pull/228683.diff


2 Files Affected:

- (modified) clang-tools-extra/clangd/indexer/IndexerMain.cpp (+1-1) 
- (modified) clang-tools-extra/clangd/test/indexer-clangd-config.test (+6-6) 


``````````diff
diff --git a/clang-tools-extra/clangd/indexer/IndexerMain.cpp b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
index f0812995520648..9dcbfe28a25cc0 100644
--- a/clang-tools-extra/clangd/indexer/IndexerMain.cpp
+++ b/clang-tools-extra/clangd/indexer/IndexerMain.cpp
@@ -58,7 +58,7 @@ static llvm::cl::list<std::string> QueryDriverGlobs{
 static llvm::cl::opt<bool> EnableConfig{
     "enable-config",
     llvm::cl::desc(config::Provider::EnableConfigFlagDesc),
-    llvm::cl::init(false),
+    llvm::cl::init(true),
 };
 
 class IndexActionFactory : public tooling::FrontendActionFactory {
diff --git a/clang-tools-extra/clangd/test/indexer-clangd-config.test b/clang-tools-extra/clangd/test/indexer-clangd-config.test
index ce67f9d1eb183a..f56237ae502485 100644
--- a/clang-tools-extra/clangd/test/indexer-clangd-config.test
+++ b/clang-tools-extra/clangd/test/indexer-clangd-config.test
@@ -9,16 +9,16 @@
 # RUN: split-file %s %t.dir
 # RUN: echo '[{"directory":"%/t.dir/proj","command":"clang++ -c test.cpp","file":"%/t.dir/proj/test.cpp"}]' > %t.dir/compile_commands.json
 
-# By default config is disabled, so the .clangd file's CompileFlags.Add is not
+# With config explicitly disabled, the .clangd file's CompileFlags.Add is not
 # applied and the #error below must fire.
-# RUN: env XDG_CONFIG_HOME=%t clangd-indexer %t.dir/proj/test.cpp \
-# RUN:     > %t.dir/disabled.idx 2> %t.dir/disabled.log
+# RUN: env XDG_CONFIG_HOME=%t clangd-indexer --enable-config=false \
+# RUN:     %t.dir/proj/test.cpp > %t.dir/disabled.idx 2> %t.dir/disabled.log
 # RUN: FileCheck --check-prefix=DISABLED --input-file=%t.dir/disabled.log %s
 # DISABLED: error: "FROM_CLANGD_FILE not defined - .clangd file was not applied"
 
-# With config enabled, the .clangd file's CompileFlags.Add should define
-# FROM_CLANGD_FILE, so the #error below must not fire.
-# RUN: env XDG_CONFIG_HOME=%t clangd-indexer --enable-config --executor=all-TUs \
+# By default config is enabled, so the .clangd file's CompileFlags.Add should
+# define FROM_CLANGD_FILE, and the #error below must not fire.
+# RUN: env XDG_CONFIG_HOME=%t clangd-indexer --executor=all-TUs \
 # RUN:     %t.dir/compile_commands.json > %t.dir/enabled.idx 2> %t.dir/enabled.log
 # RUN: FileCheck --check-prefix=ENABLED --input-file=%t.dir/enabled.log %s
 # ENABLED: Processing file {{.*}}test.cpp

``````````

</details>


https://github.com/llvm/llvm-project/pull/228683


More information about the cfe-commits mailing list