mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:40:11 +01:00
When the response file contains the subcommand itself, or when there are `-Xcarbon` flags within the response file that we need to re-organize, we need to hoist the expansion into the busybox itself. I've left the response file expansion in the `ClangRunner` so that library users can still use them, including in the VFS of the runner. It's also useful to handle `-Xcarbon`-style flags even when using subcommands rather than a symlink to the busybox: build systems often have a facility to append flags, but appending doesn't let us inject flags easily into the `carbon` driver itself. So this PR moves the `-Xcarbon` reorganization to happen in all cases, and to insert them before the first subcommand or positional parameter. When teaching Bazel to link by running `carbon link ...` commands, this lets us do things like `bazel build --linkopt=-Xcarbon=-v` to enable verbose logging. I've not added a test here as we don't really have much testing of the busybox. I can move the current symlinks test to be more of an integration test of the busybox logic if desired, but would be a somewhat larger change and maybe worth separating out. This will end up tested in the Bazel example in a subsequent PR that starts using it in the installed crosstool configuration.