Skip to content

Commit 863ead2

Browse files
authored
[libc][bazel] Add a helper library with all deps of generated headers. (#136582)
Create "public_header_deps" that is a convenient way to express dependencies of a generated headers as a single (and same) target. It's also convenient to use it in unit tests - which is also demonstrated in this PR by adding the BUILD.bazel placeholder for test/include unit tests, and creating a libc_test target for one of these tests. See issue #134780.
1 parent 56bf0e7 commit 863ead2

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ py_binary(
9090
main = "utils/hdrgen/hdrgen/main.py",
9191
)
9292

93+
# Library containing all headers that can be transitively included by generated llvm-libc
94+
# public headers (or by the unit tests).
95+
libc_support_library(
96+
name = "public_headers_deps",
97+
textual_hdrs = [
98+
"include/__llvm-libc-common.h",
99+
] + glob([
100+
"include/llvm-libc-types/**/*.h",
101+
"include/llvm-libc-macros/**/*.h",
102+
]),
103+
)
104+
93105
################################## Base Config #################################
94106

95107
libc_support_library(
@@ -1898,11 +1910,11 @@ libc_support_library(
18981910
name = "atan_utils",
18991911
hdrs = ["src/math/generic/atan_utils.h"],
19001912
deps = [
1901-
":__support_integer_literals",
19021913
":__support_fputil_double_double",
19031914
":__support_fputil_dyadic_float",
19041915
":__support_fputil_multiply_add",
19051916
":__support_fputil_polyeval",
1917+
":__support_integer_literals",
19061918
":__support_macros_optimization",
19071919
],
19081920
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
# Tests for LLVM libc public headers.
6+
7+
load("//libc/test:libc_test_rules.bzl", "libc_test")
8+
9+
licenses(["notice"])
10+
11+
libc_test(
12+
name = "stdbit_test",
13+
srcs = [
14+
"stdbit_stub.h",
15+
"stdbit_test.cpp",
16+
],
17+
deps = [
18+
"//libc:public_headers_deps",
19+
],
20+
)

0 commit comments

Comments
 (0)