Unverified Commit 0273d9ce authored by Yuxuan Shui's avatar Yuxuan Shui
Browse files

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
parent 10b12020
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ for arg in "$@"; do
done

if [ "$extendcpath" = true ]; then
  export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
  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} \