Skip to content

Commit f6a2194

Browse files
comiuscopybara-github
authored andcommitted
Replace CppSemantics mechanism with semantics.bzl.
The proper values for toolchain type and include validation are passed through to CppCompileActionBuilder from semantics.bzl This change removes `getCppToolchainType`, `language`, and `needsIncludeValidation` from the `CppSemantics` interface and its implementations. There's no need to pass through `CppSemantics` in `compile.bzl` anymore. The change could be further simplified by setting needsIncludeValidation always to true. PiperOrigin-RevId: 820281232 Change-Id: Ia51992e836a68a91d7387722fe170d53a1285ee2
1 parent ac2a7b9 commit f6a2194

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cc/common/semantics.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ def _validate_cc_compile_call(
155155
fail("The 'additional_include_scanning_roots' parameter doesn't do anything useful. " +
156156
"This is only used internally for a mechanism we'd like to get rid of.")
157157

158+
def _needs_include_validation(language):
159+
return language == "c++" or language == "cpp" or language == None
160+
158161
semantics = struct(
159162
toolchain = "@bazel_tools//tools/cpp:toolchain_type",
160163
validate = _validate,
@@ -199,6 +202,7 @@ semantics = struct(
199202
CC_PROTO_TOOLCHAIN = "@rules_cc//cc/proto:toolchain_type",
200203
is_bazel = True,
201204
validate_cc_compile_call = _validate_cc_compile_call,
205+
needs_include_validation = _needs_include_validation,
202206
extra_exec_groups = {},
203207
stamp_extra_docs = "",
204208
malloc_docs = """

0 commit comments

Comments
 (0)