Skip to content

[bazel] Use rules_cc everywhere and reformat #149584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

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

package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@rules_cc//cc:defs.bzl", "cc_library")

package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("//llvm:lit_test.bzl", "lit_test", "package_path")

package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@rules_cc//cc:defs.bzl", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

package(
default_visibility = ["//visibility:public"],
Expand Down
1 change: 1 addition & 0 deletions utils/bazel/llvm-project-overlay/clang/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_python//python:defs.bzl", "py_binary")
load(
"//:vars.bzl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

package(
default_visibility = ["//visibility:public"],
)
Expand Down
2 changes: 2 additions & 0 deletions utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@rules_cc//cc:defs.bzl", "cc_library")

package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@rules_cc//cc:defs.bzl", "cc_test")

package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
Expand Down
54 changes: 27 additions & 27 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2002,9 +2002,9 @@ libc_support_library(
":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_math_exp_utils",
":__support_math_exp10f_utils",
":__support_macros_properties_cpu_features",
":__support_math_exp10f_utils",
":__support_math_exp_utils",
":common_constants",
],
)
Expand Down Expand Up @@ -2072,8 +2072,8 @@ libc_support_library(
":__support_fputil_cast",
":__support_fputil_fp_bits",
":__support_fputil_nearest_integer",
":__support_math_expf16_utils",
":__support_math_exp10_float16_constants",
":__support_math_expf16_utils",
],
)

Expand Down Expand Up @@ -2111,7 +2111,7 @@ libc_support_library(
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_macros_attributes",
":llvm_libc_macros_float16_macros"
":llvm_libc_macros_float16_macros",
],
)

Expand All @@ -2120,7 +2120,6 @@ libc_support_library(
hdrs = ["src/__support/math/expf16.h"],
deps = [
":__support_common",
":__support_libc_errno",
":__support_cpp_array",
":__support_fputil_cast",
":__support_fputil_except_value_utils",
Expand All @@ -2130,29 +2129,30 @@ libc_support_library(
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
":__support_libc_errno",
":__support_macros_optimization",
":__support_math_expf16_utils",
":llvm_libc_macros_float16_macros"
":llvm_libc_macros_float16_macros",
],
)

libc_support_library(
name = "__support_math_frexpf128",
hdrs = ["src/__support/math/frexpf128.h"],
deps = [
":__support_macros_properties_types",
":__support_fputil_manipulation_functions",
":__support_macros_properties_types",
],
)

libc_support_library(
name = "__support_math_frexpf16",
hdrs = ["src/__support/math/frexpf16.h"],
deps = [
":__support_fputil_manipulation_functions",
":__support_macros_config",
":__support_macros_properties_types",
":__support_fputil_manipulation_functions",
":llvm_libc_macros_float16_macros"
":llvm_libc_macros_float16_macros",
],
)

Expand All @@ -2170,17 +2170,17 @@ libc_support_library(
deps = [
":__support_fputil_manipulation_functions",
":__support_macros_properties_types",
":llvm_libc_types_float128"
":llvm_libc_types_float128",
],
)

libc_support_library(
name = "__support_math_ldexpf16",
hdrs = ["src/__support/math/ldexpf16.h"],
deps = [
":__support_macros_properties_types",
":__support_fputil_manipulation_functions",
":llvm_libc_macros_float16_macros"
":__support_macros_properties_types",
":llvm_libc_macros_float16_macros",
],
)

Expand All @@ -2204,8 +2204,8 @@ libc_support_library(
name = "__support_math_exp_utils",
hdrs = ["src/__support/math/exp_utils.h"],
deps = [
":__support_cpp_optional",
":__support_cpp_bit",
":__support_cpp_optional",
":__support_fputil_fp_bits",
],
)
Expand All @@ -2214,10 +2214,9 @@ libc_support_library(
name = "__support_math_exp",
hdrs = ["src/__support/math/exp.h"],
deps = [
":__support_math_exp_constants",
":__support_math_exp_utils",
":__support_cpp_bit",
":__support_cpp_optional",
":__support_fputil_double_double",
":__support_fputil_dyadic_float",
":__support_fputil_fenv_impl",
":__support_fputil_fp_bits",
Expand All @@ -2226,18 +2225,17 @@ libc_support_library(
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
":__support_fputil_triple_double",
":__support_fputil_double_double",
":__support_integer_literals",
":__support_macros_optimization",
":__support_math_exp_constants",
":__support_math_exp_utils",
],
)

libc_support_library(
name = "__support_math_exp10",
hdrs = ["src/__support/math/exp10.h"],
deps = [
":__support_math_exp_constants",
":__support_math_exp_utils",
":__support_fputil_double_double",
":__support_fputil_dyadic_float",
":__support_fputil_multiply_add",
Expand All @@ -2247,19 +2245,21 @@ libc_support_library(
":__support_fputil_triple_double",
":__support_integer_literals",
":__support_macros_optimization",
":__support_math_exp_constants",
":__support_math_exp_utils",
],
)

libc_support_library(
name = "__support_math_exp10f_utils",
hdrs = ["src/__support/math/exp10f_utils.h"],
deps = [
":__support_common",
":__support_fputil_basic_operations",
":__support_fputil_fenv_impl",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_common",
":__support_math_exp_utils",
],
)
Expand All @@ -2268,12 +2268,12 @@ libc_support_library(
name = "__support_math_exp10f",
hdrs = ["src/__support/math/exp10f.h"],
deps = [
":__support_math_exp10f_utils",
":__support_fputil_fenv_impl",
":__support_fputil_fp_bits",
":__support_fputil_multiply_add",
":__support_fputil_rounding_mode",
":__support_macros_optimization",
":__support_math_exp10f_utils",
],
)

Expand All @@ -2289,23 +2289,23 @@ libc_support_library(
name = "__support_math_exp10f16_utils",
hdrs = ["src/__support/math/exp10f16_utils.h"],
deps = [
":__support_fputil_fp_bits",
":__support_math_exp10_float16_constants",
":__support_math_expf16_utils",
":__support_fputil_fp_bits",
],
)

libc_support_library(
name = "__support_math_exp10f16",
hdrs = ["src/__support/math/exp10f16.h"],
deps = [
":__support_math_exp10f16_utils",
":__support_fputil_fp_bits",
":__support_fputil_cast",
":__support_fputil_rounding_mode",
":__support_fputil_except_value_utils",
":__support_fputil_fp_bits",
":__support_fputil_rounding_mode",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":__support_math_exp10f16_utils",
],
)

Expand Down Expand Up @@ -3353,13 +3353,13 @@ libc_math_function(
name = "frexpf128",
additional_deps = [
":__support_math_frexpf128",
]
],
)

libc_math_function(
name = "frexpf16",
additional_deps = [
":__support_math_frexpf16"
":__support_math_frexpf16",
],
)

Expand Down Expand Up @@ -3446,7 +3446,7 @@ libc_math_function(
name = "ldexpf",
additional_deps = [
":__support_math_ldexpf",
]
],
)

libc_math_function(name = "ldexpl")
Expand Down
13 changes: 6 additions & 7 deletions utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@rules_cc//cc:defs.bzl", "cc_library")
load(":libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")
load(":libc_namespace.bzl", "LIBC_NAMESPACE")
load(":platforms.bzl", "PLATFORM_CPU_X86_64")
Expand Down Expand Up @@ -52,7 +53,7 @@ def _libc_library(name, **kwargs):
for attr in ["copts", "local_defines"]:
if attr in kwargs:
fail("disallowed attribute: '{}' in rule: '{}'".format(attr, name))
native.cc_library(
cc_library(
name = name,
copts = libc_common_copts(),
local_defines = LIBC_CONFIGURE_OPTIONS,
Expand Down Expand Up @@ -188,7 +189,7 @@ def libc_release_library(
name = name + "_textual_hdrs",
libs = libc_functions,
)
native.cc_library(
cc_library(
name = name + "_textual_hdr_library",
textual_hdrs = [":" + name + "_textual_hdrs"],
)
Expand All @@ -197,8 +198,7 @@ def libc_release_library(
"LLVM_LIBC_FUNCTION_ATTR_" + name + "='LLVM_LIBC_EMPTY, [[gnu::weak]]'"
for name in weak_symbols
]

native.cc_library(
cc_library(
name = name,
srcs = [":" + name + "_srcs"],
copts = libc_common_copts() + libc_release_copts(),
Expand Down Expand Up @@ -229,12 +229,11 @@ def libc_header_library(name, hdrs, deps = [], **kwargs):
name = name + "_textual_hdrs",
libs = deps,
)
native.cc_library(
cc_library(
name = name + "_textual_hdr_library",
textual_hdrs = [":" + name + "_textual_hdrs"],
)

native.cc_library(
cc_library(
name = name,
hdrs = hdrs,
# We put _hdr_deps in srcs, as they are not a part of this cc_library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ They come in two flavors:
When performing tests we make sure to always use the internal version.
"""

load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("//libc:libc_build_rules.bzl", "libc_common_copts")
load("//libc:libc_configure_options.bzl", "LIBC_CONFIGURE_OPTIONS")

Expand Down Expand Up @@ -57,8 +58,7 @@ def libc_test(

if full_build:
copts = copts + _FULL_BUILD_COPTS

native.cc_test(
cc_test(
name = name,
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
deps = deps,
Expand All @@ -76,7 +76,7 @@ def libc_test_library(name, copts = [], local_defines = [], **kwargs):
local_defines: See cc_library.local_defines.
**kwargs: Other attributes relevant to cc_library (e.g. "deps").
"""
native.cc_library(
cc_library(
name = name,
testonly = True,
copts = copts + libc_common_copts(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ libc_test(
],
)


libc_test(
name = "wcslcat_test",
srcs = ["wcslcat_test.cpp"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# A wrapper library over MPC for use with LLVM libc math unittests.

load("@rules_cc//cc:defs.bzl", "cc_library")
load("//libc/test:libc_test_rules.bzl", "libc_test_library")

package(default_visibility = ["//visibility:public"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# A wrapper library over MPFR for use with LLVM libc math unittests.

load("@rules_cc//cc:defs.bzl", "cc_library")
load("//libc/test:libc_test_rules.bzl", "libc_test_library")

package(default_visibility = ["//visibility:public"])
Expand Down
Loading
Loading