[llvm] [bazel] Use rules_cc everywhere and reformat (PR #149584)
Jordan Rupprecht via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 18 13:31:33 PDT 2025
https://github.com/rupprecht created https://github.com/llvm/llvm-project/pull/149584
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.
>From 509c74a13b7368c19e1a5ab01347662b650f0fa0 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht <rupprecht at google.com>
Date: Fri, 18 Jul 2025 13:26:27 -0700
Subject: [PATCH] [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.
---
.../llvm-project-overlay/bolt/BUILD.bazel | 1 +
.../clang-tools-extra/clangd/BUILD.bazel | 2 +
.../include-cleaner/BUILD.bazel | 2 +-
.../clang-tools-extra/unittests/BUILD.bazel | 2 +-
.../llvm-project-overlay/clang/BUILD.bazel | 1 +
.../clang/unittests/BUILD.bazel | 2 +
.../compiler-rt/BUILD.bazel | 2 +
.../lib/orc/tests/unit/BUILD.bazel | 2 +
.../llvm-project-overlay/libc/BUILD.bazel | 54 +++++++++----------
.../libc/libc_build_rules.bzl | 13 +++--
.../libc/test/libc_test_rules.bzl | 6 +--
.../libc/test/src/wchar/BUILD.bazel | 1 -
.../libc/utils/MPCWrapper/BUILD.bazel | 1 +
.../libc/utils/MPFRWrapper/BUILD.bazel | 1 +
.../libunwind/BUILD.bazel | 2 +
.../llvm-project-overlay/lld/BUILD.bazel | 1 +
.../llvm-project-overlay/lldb/BUILD.bazel | 1 +
.../lldb/source/Plugins/BUILD.bazel | 1 +
.../llvm-project-overlay/llvm/BUILD.bazel | 7 ++-
.../llvm-project-overlay/llvm/driver.bzl | 3 +-
.../llvm/unittests/BUILD.bazel | 1 +
.../llvm-project-overlay/mlir/BUILD.bazel | 1 +
.../llvm-project-overlay/mlir/build_defs.bzl | 8 +--
.../mlir/examples/toy/Ch1/BUILD.bazel | 2 +
.../mlir/examples/toy/Ch2/BUILD.bazel | 1 +
.../mlir/examples/toy/Ch3/BUILD.bazel | 1 +
.../mlir/examples/toy/Ch4/BUILD.bazel | 1 +
.../mlir/examples/toy/Ch5/BUILD.bazel | 1 +
.../mlir/examples/toy/Ch6/BUILD.bazel | 1 +
.../mlir/examples/toy/Ch7/BUILD.bazel | 1 +
.../llvm-project-overlay/mlir/linalggen.bzl | 4 +-
.../llvm-project-overlay/mlir/tblgen.bzl | 3 +-
.../mlir/test/BUILD.bazel | 1 +
.../mlir/unittests/BUILD.bazel | 1 +
.../third-party/siphash/BUILD.bazel | 10 ++--
.../third-party/unittest/BUILD.bazel | 2 +
36 files changed, 92 insertions(+), 52 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel b/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
index 97c25bcdece7b..167447db86f0f 100644
--- a/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/bolt/BUILD.bazel
@@ -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(
diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel
index 2ec99aaa2f374..4151e55a938d9 100644
--- a/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/clangd/BUILD.bazel
@@ -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"],
diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel
index e34fbe55cb781..6f1f5b8d21556 100644
--- a/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/include-cleaner/BUILD.bazel
@@ -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(
diff --git a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel
index c169529b91533..62bac7471c7b0 100644
--- a/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang-tools-extra/unittests/BUILD.bazel
@@ -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"],
diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
index 3598944381900..e175b987daef1 100644
--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -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",
diff --git a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
index 58bcf3abfbe5d..fc4df435d1047 100644
--- a/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/unittests/BUILD.bazel
@@ -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"],
)
diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
index bcf947a230144..f34d56dd39447 100644
--- a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
@@ -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"],
diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel
index 520bf2ab397a0..e3233a19da896 100644
--- a/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel
@@ -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"],
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index f0b45a99aae40..5e0ecfc802935 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -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",
],
)
@@ -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",
],
)
@@ -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",
],
)
@@ -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",
@@ -2130,9 +2129,10 @@ 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",
],
)
@@ -2140,8 +2140,8 @@ 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",
],
)
@@ -2149,10 +2149,10 @@ 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",
],
)
@@ -2170,7 +2170,7 @@ libc_support_library(
deps = [
":__support_fputil_manipulation_functions",
":__support_macros_properties_types",
- ":llvm_libc_types_float128"
+ ":llvm_libc_types_float128",
],
)
@@ -2178,9 +2178,9 @@ 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",
],
)
@@ -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",
],
)
@@ -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",
@@ -2226,9 +2225,10 @@ 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",
],
)
@@ -2236,8 +2236,6 @@ 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",
@@ -2247,6 +2245,8 @@ libc_support_library(
":__support_fputil_triple_double",
":__support_integer_literals",
":__support_macros_optimization",
+ ":__support_math_exp_constants",
+ ":__support_math_exp_utils",
],
)
@@ -2254,12 +2254,12 @@ 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",
],
)
@@ -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",
],
)
@@ -2289,9 +2289,9 @@ 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",
],
)
@@ -2299,13 +2299,13 @@ 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",
],
)
@@ -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",
],
)
@@ -3446,7 +3446,7 @@ libc_math_function(
name = "ldexpf",
additional_deps = [
":__support_math_ldexpf",
- ]
+ ],
)
libc_math_function(name = "ldexpl")
diff --git a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
index e123e4d32b785..0f2965369c296 100644
--- a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
@@ -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")
@@ -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,
@@ -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"],
)
@@ -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(),
@@ -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
diff --git a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
index 41a706d2d92fb..25a12a6c31979 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+++ b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
@@ -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")
@@ -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,
@@ -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(),
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel
index b6d6b8f778a4a..dbe069f6e60f3 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/wchar/BUILD.bazel
@@ -83,7 +83,6 @@ libc_test(
],
)
-
libc_test(
name = "wcslcat_test",
srcs = ["wcslcat_test.cpp"],
diff --git a/utils/bazel/llvm-project-overlay/libc/utils/MPCWrapper/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/MPCWrapper/BUILD.bazel
index 0fc6aa4e10616..cb42f9b1ac684 100644
--- a/utils/bazel/llvm-project-overlay/libc/utils/MPCWrapper/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/utils/MPCWrapper/BUILD.bazel
@@ -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"])
diff --git a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel
index 6fd88211a4ba3..7a547308cda01 100644
--- a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel
@@ -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"])
diff --git a/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel b/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel
index f8448fb0e7268..c9fdc819c04e5 100644
--- a/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libunwind/BUILD.bazel
@@ -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"],
)
diff --git a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel
index 76957a95a544a..162c4f955d150 100644
--- a/utils/bazel/llvm-project-overlay/lld/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lld/BUILD.bazel
@@ -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_library")
load(
"//:vars.bzl",
"LLVM_VERSION",
diff --git a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
index 202f224b07982..7aa7be6dbc5c6 100644
--- a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
@@ -6,6 +6,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@build_bazel_apple_support//rules:apple_genrule.bzl", "apple_genrule")
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_python//python:defs.bzl", "py_binary")
load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH", "LLVM_VERSION_SUFFIX", "PACKAGE_VERSION")
load("//lldb/source/Plugins:plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS")
diff --git a/utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel b/utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel
index caf609fd172ea..1db8244036888 100644
--- a/utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel
@@ -2,6 +2,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# 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_library")
load("//mlir:tblgen.bzl", "gentbl_cc_library")
load(":plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS")
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index 37e79db376b40..d4ae58e8732ac 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4,6 +4,7 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_python//python:defs.bzl", "py_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "gentbl_filegroup", "td_library")
load(":binary_alias.bzl", "binary_alias")
@@ -548,8 +549,10 @@ cc_library(
cc_library(
name = "DWARFCFIChecker",
- srcs = glob(["lib/DWARFCFIChecker/*.cpp",
- "lib/DWARFCFIChecker/*.h",]),
+ srcs = glob([
+ "lib/DWARFCFIChecker/*.cpp",
+ "lib/DWARFCFIChecker/*.h",
+ ]),
hdrs = glob(["include/llvm/DWARFCFIChecker/*.h"]),
copts = llvm_copts,
deps = [
diff --git a/utils/bazel/llvm-project-overlay/llvm/driver.bzl b/utils/bazel/llvm-project-overlay/llvm/driver.bzl
index 66e8af7db7d0e..39093db5f73b0 100644
--- a/utils/bazel/llvm-project-overlay/llvm/driver.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/driver.bzl
@@ -6,6 +6,7 @@
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+load("@rules_cc//cc:defs.bzl", "cc_binary")
# Mapping from every tool to the cc_library that implements the tool's entrypoint.
_TOOLS = {
@@ -175,7 +176,7 @@ def llvm_driver_cc_binary(
template = "//llvm:cmake/modules/llvm-driver-template.cpp.in",
)
deps = deps or []
- native.cc_binary(
+ cc_binary(
name = name,
srcs = [name + "-driver.cpp"],
deps = deps + ["//llvm:Support"],
diff --git a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
index 142b39823ed63..813fd0cbc24d7 100644
--- a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
@@ -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_library", "cc_test")
load("//mlir:tblgen.bzl", "gentbl_cc_library")
package(
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index 683885e1d4123..187b3a24d810b 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -7,6 +7,7 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load(
":build_defs.bzl",
"cc_headers_only",
diff --git a/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl b/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl
index 53767fd03c44a..b3fb4fcc32338 100644
--- a/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl
+++ b/utils/bazel/llvm-project-overlay/mlir/build_defs.bzl
@@ -4,6 +4,8 @@
"""Rules and macros for MLIR"""
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
def if_cuda_available(if_true, if_false = []):
return select({
# CUDA auto-detection is not yet supported.
@@ -49,20 +51,20 @@ def mlir_c_api_cc_library(
"""
capi_header_deps = ["%sHeaders" % d for d in capi_deps]
capi_object_deps = ["%sObjects" % d for d in capi_deps]
- native.cc_library(
+ cc_library(
name = name,
srcs = srcs,
hdrs = hdrs,
deps = deps + capi_deps + header_deps,
**kwargs
)
- native.cc_library(
+ cc_library(
name = name + "Headers",
hdrs = hdrs,
deps = header_deps + capi_header_deps,
**kwargs
)
- native.cc_library(
+ cc_library(
name = name + "Objects",
srcs = srcs,
hdrs = hdrs,
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel
index 2d4e1b5d6986e..3b41b86c1545a 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch1/BUILD.bazel
@@ -1,3 +1,5 @@
+load("@rules_cc//cc:defs.bzl", "cc_binary")
+
# Description:
# MLIR Tutorial
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel
index 0fdda77771438..98be2623ee3bd 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch2/BUILD.bazel
@@ -1,6 +1,7 @@
# Description:
# MLIR Tutorial
+load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel
index 62e1d68cf6860..853db9d931f40 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch3/BUILD.bazel
@@ -1,6 +1,7 @@
# Description:
# MLIR Tutorial
+load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel
index 3ac6ddca29818..0d71c4f4632d0 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch4/BUILD.bazel
@@ -1,6 +1,7 @@
# Description:
# MLIR Tutorial
+load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel
index 34b7487bdf69c..2624375a67cd6 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch5/BUILD.bazel
@@ -1,6 +1,7 @@
# Description:
# MLIR Tutorial
+load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel
index ea1ef88151891..6427c2aab0638 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch6/BUILD.bazel
@@ -1,6 +1,7 @@
# Description:
# MLIR Tutorial
+load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel
index 6e67715468c05..07ebbb18c8998 100644
--- a/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/examples/toy/Ch7/BUILD.bazel
@@ -1,6 +1,7 @@
# Description:
# MLIR Tutorial
+load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
licenses(["notice"])
diff --git a/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl b/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl
index d893471e6249f..7e21ac4995b11 100644
--- a/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl
+++ b/utils/bazel/llvm-project-overlay/mlir/linalggen.bzl
@@ -4,6 +4,8 @@
"""BUILD extensions for MLIR linalg generation."""
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
def genlinalg(name, linalggen, src, linalg_outs):
"""genlinalg() generates code from a tc spec file.
@@ -35,7 +37,7 @@ def genlinalg(name, linalggen, src, linalg_outs):
)
hdrs = [f for (opts, f) in linalg_outs]
- native.cc_library(
+ cc_library(
name = name,
hdrs = hdrs,
textual_hdrs = hdrs,
diff --git a/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl b/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
index 89b17735e005b..2213d220da269 100644
--- a/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
+++ b/utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
@@ -4,6 +4,7 @@
"""BUILD extensions for MLIR table generation."""
load("@bazel_skylib//lib:paths.bzl", "paths")
+load("@rules_cc//cc:defs.bzl", "cc_library")
TdInfo = provider(
"Holds TableGen files and the dependencies and include paths necessary to" +
@@ -424,7 +425,7 @@ def gentbl_cc_library(
skip_opts = ["-gen-op-doc"],
**kwargs
)
- native.cc_library(
+ cc_library(
name = name,
# strip_include_prefix does not apply to textual_hdrs.
# https://github.com/bazelbuild/bazel/issues/12424
diff --git a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
index 95e3ee4df7bc5..4e069c22608ee 100644
--- a/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
@@ -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_library")
load("//llvm:lit_test.bzl", "package_path")
load("//mlir:tblgen.bzl", "gentbl_cc_library", "gentbl_sharded_ops", "td_library")
diff --git a/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel
index 02dc408813d27..b908aa8ada7f0 100644
--- a/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/unittests/BUILD.bazel
@@ -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_test")
load("//mlir:tblgen.bzl", "gentbl_cc_library")
package(
diff --git a/utils/bazel/llvm-project-overlay/third-party/siphash/BUILD.bazel b/utils/bazel/llvm-project-overlay/third-party/siphash/BUILD.bazel
index d5b9631e7d2ab..fcea6188e5017 100644
--- a/utils/bazel/llvm-project-overlay/third-party/siphash/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/third-party/siphash/BUILD.bazel
@@ -2,12 +2,14 @@
# 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"])
licenses(["notice"])
cc_library(
- name = "siphash",
- hdrs = ["include/siphash/SipHash.h"],
- strip_include_prefix = "include",
-)
\ No newline at end of file
+ name = "siphash",
+ hdrs = ["include/siphash/SipHash.h"],
+ strip_include_prefix = "include",
+)
diff --git a/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel b/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel
index 0b5c084086ed9..ff179a71ec113 100644
--- a/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/third-party/unittest/BUILD.bazel
@@ -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"])
licenses(["notice"])
More information about the llvm-commits
mailing list