Skip to content

Commit 509c74a

Browse files
committed
[bazel] Use rules_cc everywhere and reformat
We already use cc rules from `@rules_cc//cc:defs.bzl` in a few files, but this uses it everywhere. Done automatically by running `buildifier --lint=fix --warnings=native-cc-binary,native-cc-library,native-cc-test,load` over all the files. I also ran `buildifier` once more to ensure there wasn't any missing formatting, so that caused a few unrelated diffs.
1 parent 4dc6dfd commit 509c74a

File tree

36 files changed

+92
-52
lines changed

36 files changed

+92
-52
lines changed

utils/bazel/llvm-project-overlay/bolt/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
6+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
67
load(":targets.bzl", "bolt_targets")
78

89
package(

utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_library")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
features = ["layering_check"],

utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
6-
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
6+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
77
load("//llvm:lit_test.bzl", "lit_test", "package_path")
88

99
package(

utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
6-
load("@rules_cc//cc:defs.bzl", "cc_test")
6+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
77

88
package(
99
default_visibility = ["//visibility:public"],

utils/bazel/llvm-project-overlay/clang/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
56
load("@rules_python//python:defs.bzl", "py_binary")
67
load(
78
"//:vars.bzl",

utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
)

utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_library")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
features = ["layering_check"],

utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
load("@rules_cc//cc:defs.bzl", "cc_test")
6+
57
package(
68
default_visibility = ["//visibility:public"],
79
features = ["layering_check"],

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,9 +2002,9 @@ libc_support_library(
20022002
":__support_fputil_fma",
20032003
":__support_fputil_multiply_add",
20042004
":__support_fputil_nearest_integer",
2005-
":__support_math_exp_utils",
2006-
":__support_math_exp10f_utils",
20072005
":__support_macros_properties_cpu_features",
2006+
":__support_math_exp10f_utils",
2007+
":__support_math_exp_utils",
20082008
":common_constants",
20092009
],
20102010
)
@@ -2072,8 +2072,8 @@ libc_support_library(
20722072
":__support_fputil_cast",
20732073
":__support_fputil_fp_bits",
20742074
":__support_fputil_nearest_integer",
2075-
":__support_math_expf16_utils",
20762075
":__support_math_exp10_float16_constants",
2076+
":__support_math_expf16_utils",
20772077
],
20782078
)
20792079

@@ -2111,7 +2111,7 @@ libc_support_library(
21112111
":__support_fputil_nearest_integer",
21122112
":__support_fputil_polyeval",
21132113
":__support_macros_attributes",
2114-
":llvm_libc_macros_float16_macros"
2114+
":llvm_libc_macros_float16_macros",
21152115
],
21162116
)
21172117

@@ -2120,7 +2120,6 @@ libc_support_library(
21202120
hdrs = ["src/__support/math/expf16.h"],
21212121
deps = [
21222122
":__support_common",
2123-
":__support_libc_errno",
21242123
":__support_cpp_array",
21252124
":__support_fputil_cast",
21262125
":__support_fputil_except_value_utils",
@@ -2130,29 +2129,30 @@ libc_support_library(
21302129
":__support_fputil_nearest_integer",
21312130
":__support_fputil_polyeval",
21322131
":__support_fputil_rounding_mode",
2132+
":__support_libc_errno",
21332133
":__support_macros_optimization",
21342134
":__support_math_expf16_utils",
2135-
":llvm_libc_macros_float16_macros"
2135+
":llvm_libc_macros_float16_macros",
21362136
],
21372137
)
21382138

21392139
libc_support_library(
21402140
name = "__support_math_frexpf128",
21412141
hdrs = ["src/__support/math/frexpf128.h"],
21422142
deps = [
2143-
":__support_macros_properties_types",
21442143
":__support_fputil_manipulation_functions",
2144+
":__support_macros_properties_types",
21452145
],
21462146
)
21472147

21482148
libc_support_library(
21492149
name = "__support_math_frexpf16",
21502150
hdrs = ["src/__support/math/frexpf16.h"],
21512151
deps = [
2152+
":__support_fputil_manipulation_functions",
21522153
":__support_macros_config",
21532154
":__support_macros_properties_types",
2154-
":__support_fputil_manipulation_functions",
2155-
":llvm_libc_macros_float16_macros"
2155+
":llvm_libc_macros_float16_macros",
21562156
],
21572157
)
21582158

@@ -2170,17 +2170,17 @@ libc_support_library(
21702170
deps = [
21712171
":__support_fputil_manipulation_functions",
21722172
":__support_macros_properties_types",
2173-
":llvm_libc_types_float128"
2173+
":llvm_libc_types_float128",
21742174
],
21752175
)
21762176

21772177
libc_support_library(
21782178
name = "__support_math_ldexpf16",
21792179
hdrs = ["src/__support/math/ldexpf16.h"],
21802180
deps = [
2181-
":__support_macros_properties_types",
21822181
":__support_fputil_manipulation_functions",
2183-
":llvm_libc_macros_float16_macros"
2182+
":__support_macros_properties_types",
2183+
":llvm_libc_macros_float16_macros",
21842184
],
21852185
)
21862186

@@ -2204,8 +2204,8 @@ libc_support_library(
22042204
name = "__support_math_exp_utils",
22052205
hdrs = ["src/__support/math/exp_utils.h"],
22062206
deps = [
2207-
":__support_cpp_optional",
22082207
":__support_cpp_bit",
2208+
":__support_cpp_optional",
22092209
":__support_fputil_fp_bits",
22102210
],
22112211
)
@@ -2214,10 +2214,9 @@ libc_support_library(
22142214
name = "__support_math_exp",
22152215
hdrs = ["src/__support/math/exp.h"],
22162216
deps = [
2217-
":__support_math_exp_constants",
2218-
":__support_math_exp_utils",
22192217
":__support_cpp_bit",
22202218
":__support_cpp_optional",
2219+
":__support_fputil_double_double",
22212220
":__support_fputil_dyadic_float",
22222221
":__support_fputil_fenv_impl",
22232222
":__support_fputil_fp_bits",
@@ -2226,18 +2225,17 @@ libc_support_library(
22262225
":__support_fputil_polyeval",
22272226
":__support_fputil_rounding_mode",
22282227
":__support_fputil_triple_double",
2229-
":__support_fputil_double_double",
22302228
":__support_integer_literals",
22312229
":__support_macros_optimization",
2230+
":__support_math_exp_constants",
2231+
":__support_math_exp_utils",
22322232
],
22332233
)
22342234

22352235
libc_support_library(
22362236
name = "__support_math_exp10",
22372237
hdrs = ["src/__support/math/exp10.h"],
22382238
deps = [
2239-
":__support_math_exp_constants",
2240-
":__support_math_exp_utils",
22412239
":__support_fputil_double_double",
22422240
":__support_fputil_dyadic_float",
22432241
":__support_fputil_multiply_add",
@@ -2247,19 +2245,21 @@ libc_support_library(
22472245
":__support_fputil_triple_double",
22482246
":__support_integer_literals",
22492247
":__support_macros_optimization",
2248+
":__support_math_exp_constants",
2249+
":__support_math_exp_utils",
22502250
],
22512251
)
22522252

22532253
libc_support_library(
22542254
name = "__support_math_exp10f_utils",
22552255
hdrs = ["src/__support/math/exp10f_utils.h"],
22562256
deps = [
2257+
":__support_common",
22572258
":__support_fputil_basic_operations",
22582259
":__support_fputil_fenv_impl",
22592260
":__support_fputil_multiply_add",
22602261
":__support_fputil_nearest_integer",
22612262
":__support_fputil_polyeval",
2262-
":__support_common",
22632263
":__support_math_exp_utils",
22642264
],
22652265
)
@@ -2268,12 +2268,12 @@ libc_support_library(
22682268
name = "__support_math_exp10f",
22692269
hdrs = ["src/__support/math/exp10f.h"],
22702270
deps = [
2271-
":__support_math_exp10f_utils",
22722271
":__support_fputil_fenv_impl",
22732272
":__support_fputil_fp_bits",
22742273
":__support_fputil_multiply_add",
22752274
":__support_fputil_rounding_mode",
22762275
":__support_macros_optimization",
2276+
":__support_math_exp10f_utils",
22772277
],
22782278
)
22792279

@@ -2289,23 +2289,23 @@ libc_support_library(
22892289
name = "__support_math_exp10f16_utils",
22902290
hdrs = ["src/__support/math/exp10f16_utils.h"],
22912291
deps = [
2292+
":__support_fputil_fp_bits",
22922293
":__support_math_exp10_float16_constants",
22932294
":__support_math_expf16_utils",
2294-
":__support_fputil_fp_bits",
22952295
],
22962296
)
22972297

22982298
libc_support_library(
22992299
name = "__support_math_exp10f16",
23002300
hdrs = ["src/__support/math/exp10f16.h"],
23012301
deps = [
2302-
":__support_math_exp10f16_utils",
2303-
":__support_fputil_fp_bits",
23042302
":__support_fputil_cast",
2305-
":__support_fputil_rounding_mode",
23062303
":__support_fputil_except_value_utils",
2304+
":__support_fputil_fp_bits",
2305+
":__support_fputil_rounding_mode",
23072306
":__support_macros_optimization",
23082307
":__support_macros_properties_cpu_features",
2308+
":__support_math_exp10f16_utils",
23092309
],
23102310
)
23112311

@@ -3353,13 +3353,13 @@ libc_math_function(
33533353
name = "frexpf128",
33543354
additional_deps = [
33553355
":__support_math_frexpf128",
3356-
]
3356+
],
33573357
)
33583358

33593359
libc_math_function(
33603360
name = "frexpf16",
33613361
additional_deps = [
3362-
":__support_math_frexpf16"
3362+
":__support_math_frexpf16",
33633363
],
33643364
)
33653365

@@ -3446,7 +3446,7 @@ libc_math_function(
34463446
name = "ldexpf",
34473447
additional_deps = [
34483448
":__support_math_ldexpf",
3449-
]
3449+
],
34503450
)
34513451

34523452
libc_math_function(name = "ldexpl")

utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
load("@bazel_skylib//lib:paths.bzl", "paths")
88
load("@bazel_skylib//lib:selects.bzl", "selects")
9+
load("@rules_cc//cc:defs.bzl", "cc_library")
910
load(":libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
1011
load(":libc_namespace.bzl", "LIBC_NAMESPACE")
1112
load(":platforms.bzl", "PLATFORM_CPU_X86_64")
@@ -52,7 +53,7 @@ def _libc_library(name, **kwargs):
5253
for attr in ["copts", "local_defines"]:
5354
if attr in kwargs:
5455
fail("disallowed attribute: '{}' in rule: '{}'".format(attr, name))
55-
native.cc_library(
56+
cc_library(
5657
name = name,
5758
copts = libc_common_copts(),
5859
local_defines = LIBC_CONFIGURE_OPTIONS,
@@ -188,7 +189,7 @@ def libc_release_library(
188189
name = name + "_textual_hdrs",
189190
libs = libc_functions,
190191
)
191-
native.cc_library(
192+
cc_library(
192193
name = name + "_textual_hdr_library",
193194
textual_hdrs = [":" + name + "_textual_hdrs"],
194195
)
@@ -197,8 +198,7 @@ def libc_release_library(
197198
"LLVM_LIBC_FUNCTION_ATTR_" + name + "='LLVM_LIBC_EMPTY, [[gnu::weak]]'"
198199
for name in weak_symbols
199200
]
200-
201-
native.cc_library(
201+
cc_library(
202202
name = name,
203203
srcs = [":" + name + "_srcs"],
204204
copts = libc_common_copts() + libc_release_copts(),
@@ -229,12 +229,11 @@ def libc_header_library(name, hdrs, deps = [], **kwargs):
229229
name = name + "_textual_hdrs",
230230
libs = deps,
231231
)
232-
native.cc_library(
232+
cc_library(
233233
name = name + "_textual_hdr_library",
234234
textual_hdrs = [":" + name + "_textual_hdrs"],
235235
)
236-
237-
native.cc_library(
236+
cc_library(
238237
name = name,
239238
hdrs = hdrs,
240239
# We put _hdr_deps in srcs, as they are not a part of this cc_library

0 commit comments

Comments
 (0)