wrappers: Don't explicitly pass -target in clang-scan-deps-wrapper.sh

clang-scan-deps can pick it up automatically from the first argument
now.

For the windows wrapper, keep passing -target, to allow running with
a potentially foreign clang-scan-deps.exe.
This commit is contained in:
Martin Storsjö committed 2024-10-02 16:06:01 +03:00
1 parent 570fdcd251
commit c34dc64028
2 files changed
+9 -8

No files matched your search

+6 -3
View File
@@ -63,7 +63,7 @@ int _tmain(int argc, TCHAR *argv[]) {
if (sep) if (sep)
*sep = '\0'; *sep = '\0';
TCHAR *dash = _tcsrchr(cmd_exe, '-'); TCHAR *dash = _tcsrchr(cmd_exe, '-');
const TCHAR *target = NULL; int has_target = 0;
if (dash) { if (dash) {
*dash = '\0'; *dash = '\0';
const TCHAR *cmd_exe_suffix = dash + 1; const TCHAR *cmd_exe_suffix = dash + 1;
@@ -76,14 +76,15 @@ int _tmain(int argc, TCHAR *argv[]) {
!_tcscmp(cmd_exe_suffix, _T("cc")) || !_tcscmp(cmd_exe_suffix, _T("cc")) ||
!_tcscmp(cmd_exe_suffix, _T("c99")) || !_tcscmp(cmd_exe_suffix, _T("c99")) ||
!_tcscmp(cmd_exe_suffix, _T("c11"))) { !_tcscmp(cmd_exe_suffix, _T("c11"))) {
target = cmd_exe; has_target = 1;
} }
} }
const TCHAR *target = NULL;
#ifdef _WIN32 #ifdef _WIN32
// On Windows, we want to set our default target even if no target // On Windows, we want to set our default target even if no target
// was found in cmd_exe, as we want to support running with a foreign // was found in cmd_exe, as we want to support running with a foreign
// clang-scan-deps-real.exe binary, that could have any default. // clang-scan-deps-real.exe binary, that could have any default.
if (!target) if (!has_target)
target = _T(DEFAULT_TARGET); target = _T(DEFAULT_TARGET);
#endif #endif
@@ -92,6 +93,8 @@ int _tmain(int argc, TCHAR *argv[]) {
// -target after cmd_exe. // -target after cmd_exe.
exec_argv[arg++] = _T("-target"); exec_argv[arg++] = _T("-target");
exec_argv[arg++] = target; exec_argv[arg++] = target;
}
if (target || has_target) {
exec_argv[arg++] = _T("-stdlib=libc++"); exec_argv[arg++] = _T("-stdlib=libc++");
} }
} }
+3 -5
View File
@@ -45,8 +45,6 @@ while [ $# -gt 0 ]; do
done done
if [ -n "$CMD_EXE" ]; then if [ -n "$CMD_EXE" ]; then
# If CMD_EXE is a <triple>-<exe> style command, pick up the
# target triple from there.
CMD_BASENAME="$(basename "$CMD_EXE")" CMD_BASENAME="$(basename "$CMD_EXE")"
CMD_BASENAME="${CMD_BASENAME%.*}" CMD_BASENAME="${CMD_BASENAME%.*}"
CMD_TARGET="${CMD_BASENAME%-*}" CMD_TARGET="${CMD_BASENAME%-*}"
@@ -54,14 +52,14 @@ if [ -n "$CMD_EXE" ]; then
if [ "$CMD_TARGET" != "$CMD_BASENAME" ]; then if [ "$CMD_TARGET" != "$CMD_BASENAME" ]; then
case $CMD_EXE_SUFFIX in case $CMD_EXE_SUFFIX in
clang|clang++|gcc|g++|c++|as|cc|c99|c11) clang|clang++|gcc|g++|c++|as|cc|c99|c11)
TARGET="$CMD_TARGET" IS_CLANG=1
;; ;;
esac esac
fi fi
fi fi
if [ -n "$TARGET" ]; then if [ -n "$IS_CLANG" ]; then
"$EXE" "${FLAGS[@]}" -target $TARGET -stdlib=libc++ "$@" "$EXE" "${FLAGS[@]}" -stdlib=libc++ "$@"
else else
"$EXE" "${FLAGS[@]}" "$@" "$EXE" "${FLAGS[@]}" "$@"
fi fi