Skip to content

Commit 8de802e

Browse files
committed
[bazel] Add layering-check
In the same vein as https://reviews.llvm.org/D141553 Enable the feature globally to ensure layering and catch circular dependencies (https://llvm.org/docs/CodingStandards.html#library-layering). Differential Revision: https://reviews.llvm.org/D143678
1 parent 8fe1144 commit 8de802e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Diff for: utils/bazel/.bazelrc

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ build --dynamic_mode=off
2222
# based on compilation_mode.
2323
build --strip=never
2424

25+
# Add layering check to all projects.
26+
build --features=layering_check
27+
2528
###############################################################################
2629
# Options to select different strategies for linking potential dependent
2730
# libraries. The default leaves it disabled.

Diff for: utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ cc_library(
2727
name = "mpfr_wrapper",
2828
srcs = ["MPFRUtils.cpp"],
2929
hdrs = ["MPFRUtils.h"],
30+
# Disable layering check when using mpfr_system.
31+
features = select(
32+
{
33+
"//conditions:default": [],
34+
"//libc:mpfr_system": ["-layering_check"],
35+
},
36+
),
3037
deps = [
3138
"//libc:__support_common",
3239
"//libc:__support_cpp_bit",
@@ -36,9 +43,9 @@ cc_library(
3643
"//libc:__support_fputil_fp_bits",
3744
"//libc:__support_fputil_platform_defs",
3845
"//libc:libc_root",
39-
"//libc/utils/MPFRWrapper:mpfr_impl",
4046
"//libc/test/UnitTest:LibcUnitTest",
4147
"//libc/test/UnitTest:fp_test_helpers",
48+
"//libc/utils/MPFRWrapper:mpfr_impl",
4249
"//libc/utils/testutils:libc_test_utils",
4350
],
4451
)

0 commit comments

Comments
 (0)