Files
nixpkgs/pkgs/development/compilers/llvm/common/clang-tools/wrapper
T
Jörg Thalheim 91bc3381e4 clang-tools: handle -cxx-isystem in wrapper
The libcxx-cxxflags file uses -cxx-isystem instead of -isystem for C++
include paths. Without handling this flag, the CPLUS_INCLUDE_PATH was
not being set correctly, causing clang-tidy to fail finding standard
library headers like <iostream> and <cstring>.
2025-12-29 15:41:08 +00:00

28 lines
962 B
Bash
Executable File

#!/bin/sh
buildcpath() {
local path after
while (( $# )); do
case $1 in
-isystem|-cxx-isystem)
shift
path=$path${path:+':'}$1
;;
-idirafter)
shift
after=$after${after:+':'}$1
;;
esac
shift
done
echo $path${after:+':'}$after
}
export CPATH=${CPATH}${CPATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libc-cflags)):@clang@/resource-root/include
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+':'}$(buildcpath ${NIX_CFLAGS_COMPILE} \
$(<@clang@/nix-support/libcxx-cxxflags) \
$(<@clang@/nix-support/libc-cflags)):@clang@/resource-root/include
exec -a "$0" @unwrapped@/bin/$(basename $0) "$@"