You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[1] Support C++20 modules in the rules-based toolchain API
The rules-based cc/toolchains toolchain API was missing several pieces
needed to drive Bazel's C++20 modules pipeline (clang-scan-deps -> .ddi
-> aggregate-ddi -> generate-modmap -> module compile):
- Add a cpp20_module_actions action type set grouping the module
interface compile, codegen and dependency scanning actions. These are
deliberately kept out of compile_actions/source_compile_actions so that
flags incompatible with C++20 modules can keep targeting only the
non-module compiles.
- Register the cpp_module_output_file and cpp_module_modmap_file build
variables and make dependency_file, output_file, source_file and
user_compile_flags available to the C++20 module actions.
- Extend the legacy compile features (compiler_input_flags,
compiler_output_flags, dependency_file, user_compile_flags) to the C++20
module actions, so the generic -c / -o / -MD -MF / user-copt flags are
emitted for module interface compile, codegen and dependency scanning
the same way they are for ordinary compiles. Toolchains that use these
features then need no module-specific source/output/dependency/copt args
of their own.
- Include the C++20 module actions in the compiler_files legacy file
group so their tools (e.g. the dependency scanner) are available to the
compile actions.
The C++20 modules pipeline lives only in rules_cc's compile.bzl (Bazel's
native rules do not implement it), and was previously untested here:
Bazel's CppModulesConfiguredTargetTest only checks the
--experimental_cpp_modules / cpp_modules gating, and the shell
integration test self-skips unless a host clang >= 17 is present. Add an
analysis test that drives the module interface compile + dependency
scanning actions with a mock toolchain (no real compiler needed) and
asserts the scanning action emits both the P1689 .ddi file and the
Make-style .ddi.d dependency file. This test fails without the fixes in
the preceding commit.
0 commit comments