Skip to content

Commit 732b172

Browse files
disable module for all stdlib (#544)
Fix #510
1 parent de2ead9 commit 732b172

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

toolchain/cc_toolchain_config.bzl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,6 @@ def cc_toolchain_config(
259259
"-std=" + cxx_standard,
260260
"-stdlib=libc++",
261261
]
262-
if major_llvm_version >= 14:
263-
# With C++20, Clang defaults to using C++ rather than Clang modules,
264-
# which breaks Bazel's `use_module_maps` feature, which is used by
265-
# `layering_check`. Since Bazel doesn't support C++ modules yet, it
266-
# is safe to disable them globally until the toolchain shipped by
267-
# Bazel sets this flag on `use_module_maps`.
268-
# https://github.com/llvm/llvm-project/commit/0556138624edf48621dd49a463dbe12e7101f17d
269-
cxx_flags.append("-Xclang")
270-
cxx_flags.append("-fno-cxx-modules")
271262
if use_lld:
272263
# For single-platform builds, we can statically link the bundled
273264
# libraries.
@@ -343,6 +334,16 @@ def cc_toolchain_config(
343334
else:
344335
fail("Unknown value passed for stdlib: {stdlib}".format(stdlib = stdlib))
345336

337+
if major_llvm_version >= 14:
338+
# With C++20, Clang defaults to using C++ rather than Clang modules,
339+
# which breaks Bazel's `use_module_maps` feature, which is used by
340+
# `layering_check`. Since Bazel doesn't support C++ modules yet, it
341+
# is safe to disable them globally until the toolchain shipped by
342+
# Bazel sets this flag on `use_module_maps`.
343+
# https://github.com/llvm/llvm-project/commit/0556138624edf48621dd49a463dbe12e7101f17d
344+
cxx_flags.append("-Xclang")
345+
cxx_flags.append("-fno-cxx-modules")
346+
346347
opt_link_flags = ["-Wl,--gc-sections"] if target_os == "linux" else []
347348

348349
# Coverage flags:

0 commit comments

Comments
 (0)