Skip to content

Commit 987cc82

Browse files
committed
fix: preserve build action compiler driver
1 parent cc146a6 commit 987cc82

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/build/ninja_backend.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ std::string emit_ninja_string(const BuildPlan& plan) {
642642
if (needs_compiler_launcher(plan))
643643
return shell_quote_arg(escape_ninja_chars(
644644
compiler_launcher_path(plan, cxx).string()));
645-
return shell_quote_arg(escape_ninja_chars(binary.string()));
645+
return escape_ninja_path(binary);
646646
};
647647
append(std::format("cxx = {}\n", compiler_command(flags.cxxBinary, /*cxx=*/true)));
648648
// clang-scan-deps receives the driver after `--` as argv, not as a shell

tests/e2e/188_build_actions.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,11 @@ EOF
279279
printf 'int main() { return 0; }\n' > src/main.cpp
280280
"$MCPP" build > o0.log 2>&1 || { cat o0.log; echo "FAIL: probe build failed"; exit 1; }
281281
OBJ_NINJA=$(find target -name build.ninja | head -1)
282-
OBJ_CXX=$(sed -n 's/^cxx *= *//p' "$OBJ_NINJA" | head -1)
283-
[ -n "$OBJ_CXX" ] || { cat "$OBJ_NINJA"; echo "FAIL: could not read the compiler out of build.ninja"; exit 1; }
282+
# `cxx` may be a fingerprint-scoped launcher. This action is deliberately
283+
# retained after that build directory is removed below, so use the stable raw
284+
# driver exported for clang-scan-deps instead.
285+
OBJ_CXX=$(sed -n 's/^cxx_driver *= *//p' "$OBJ_NINJA" | head -1)
286+
[ -n "$OBJ_CXX" ] || { cat "$OBJ_NINJA"; echo "FAIL: could not read the compiler driver out of build.ninja"; exit 1; }
284287

285288
cat > src/main.cpp <<'EOF'
286289
#include <cstdio>

tests/unit/test_toolchain_detect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ if [[ "$1" != "--library-path" || "$2" != ")" << wanted.string() << R"(" ]]; the
116116
exit 127
117117
fi
118118
printf '%s\n' "$*" >> ")" << trace.string() << R"("
119-
shift 3
119+
shift 2
120120
exec env -u LD_LIBRARY_PATH "$@"
121121
)";
122122
loaderOs.close();

0 commit comments

Comments
 (0)