[clang-tools-extra] [clangd] Make clangd-indexer respect .clangd configuration files (PR #214951)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 31 23:04:27 PDT 2026
================
@@ -0,0 +1,25 @@
+# Test that clangd-indexer respects CompileFlags
+
+# RUN: rm -rf %t.dir && mkdir -p %t.dir
+# RUN: split-file %s %t.dir
+
+# By default config is disabled, so the .clangd file's CompileFlags.Add is not
+# applied and the #error below must fire.
+# RUN: clangd-indexer %t.dir/test.cpp 2>&1 | FileCheck --check-prefix=DISABLED %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: clangd-indexer --enable-config %t.dir/test.cpp 2>&1 \
----------------
HighCommander4 wrote:
another nit: it doesn't hurt to separate the indexer's stdout (which contains the index contents) from the stderr (which contains status / diagnostic messages), so that the former (which is binary data) is not passed through `FileCheck`
See how the test I've pushed does it.
https://github.com/llvm/llvm-project/pull/214951
More information about the cfe-commits
mailing list