qihang-app/.tools/clang-shim/clang

29 lines
629 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
args=()
skip_next=0
for arg in "$@"; do
if [ "$skip_next" = "1" ]; then
args+=("-isystem" "$arg")
skip_next=0
elif [ "$arg" = "/imsvc" ]; then
skip_next=1
else
args+=("$arg")
fi
done
# 找到真正的 clang跳过我们自己的 shim
real_clang=""
IFS=':' read -ra PATHS <<< "$PATH"
for p in "${PATHS[@]}"; do
if [ "$p" != "/Users/cyh/app-template/packages/qihang-app/.tools/clang-shim" ] && [ -x "$p/clang" ]; then
real_clang="$p/clang"
break
fi
done
if [ -z "$real_clang" ]; then
echo "Error: cannot find real clang" >&2
exit 1
fi
exec "$real_clang" "${args[@]}"