clang-tools: use $C_INCLUDE_PATH for C includes

$CPATH is taken to mean the same thing as -I by clang, whereas
$C_INCLUDE_PATH is -isystem. Using $CPATH means tools like clangd will
generate warnings for problems in system headers, which is undesirable.

See llvm/llvm-project#154015
This commit is contained in:
Yuxuan Shui
2026-01-28 13:08:37 +00:00
parent 10b12020a8
commit 0273d9cedf
@@ -47,8 +47,8 @@ for arg in "$@"; do
done
if [ "$extendcpath" = true ]; then
export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libc-cflags))
export C_INCLUDE_PATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libc-cflags))
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+':'}$(buildcpluspath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libcxx-cxxflags) \