[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 02:30:33 PDT 2026
https://github.com/Fil-Den updated https://github.com/llvm/llvm-project/pull/228683
>From 0aa73ca1dfd22e642c0baf80c49bada5fad39c52 Mon Sep 17 00:00:00 2001
From: Fil-Den <ffil.denn at gmail.com>
Date: Sat, 3 Oct 2026 11:54:39 +0300
Subject: [PATCH 1/2] [clangd-indexer] Enable config files by default
---
clang-tools-extra/clangd/indexer/IndexerMain.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 {
>From 4b81efe1a9c3cde11472ee5f7d0fc9c1e97ee58f Mon Sep 17 00:00:00 2001
From: Fil-Den <ffil.denn at gmail.com>
Date: Sat, 3 Oct 2026 12:30:16 +0300
Subject: [PATCH 2/2] fix test
---
.../clangd/test/indexer-clangd-config.test | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
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
More information about the cfe-commits
mailing list