-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a clang subcommand. #4322
base: trunk
Are you sure you want to change the base?
Add a clang subcommand. #4322
Conversation
Note, I'm sending this to you as-is because I want to make sure the subprocessing behavior aligns with your expectations. I believe this is getting equivalent behavior as to clang:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, all of this matches my expectation.
Worth adding a small test that checks the whole -c
flow maybe? Also left an optional TODO idea, but that's not blocking or especially important.
// When there's only one command being run, this will run it in-process. | ||
// However, a `clang` invocation may cause multiple `cc1` invocations, which | ||
// still subprocess. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me.
I have an idea of another step we may want to eventually try to take here, but emphasis on "may" (not at all sure) and "eventually". =] Suggesting as a TODO in case you want to capture it and/or tweak the wording in the code. But also happy to just leave for discussion or the future.
// When there's only one command being run, this will run it in-process. | |
// However, a `clang` invocation may cause multiple `cc1` invocations, which | |
// still subprocess. | |
// When there's only one command being run, this will run it in-process. | |
// However, a `clang` invocation may cause multiple `cc1` invocations, which | |
// still subprocess. | |
// | |
// TODO: It would be nice to find a way to set up the driver's understanding | |
// of the executable name in a way that causes the multiple `cc1` invocations | |
// to actually result in `carbon clang -- ...` invocations (even if as | |
// subprocesses). This may dovetail with having symlinks that redirect to a | |
// busybox of LLD as well, and having even the subprocesses consistently run | |
// the Carbon install toolchain and not a system toolchain whenever possible. |
Maybe this is already part of what you're thinking about with busyboxing the linker too, feel free to skip the TODO if already part of your larger plans.
This makes something like
bazel run :toolchain -- clang -- -c test.cpp
work, because that can be run in-process. Note thatbazel run :toolchain -- clang -- test.cpp
still requires subprocessing, and does not work.Note, the vision here is that we are trying to align how clang and carbon compile c++ code. This is work towards intertwining command execution.