-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[libc][bazel] Enable __support tests #73125
Conversation
@llvm/pr-subscribers-libc Author: Guillaume Chatelet (gchatelet) ChangesFull diff: https://github.com/llvm/llvm-project/pull/73125.diff 3 Files Affected:
diff --git a/libc/src/__support/char_vector.h b/libc/src/__support/char_vector.h
index ed55c48cc94cc9b..955abdc1fa5ae08 100644
--- a/libc/src/__support/char_vector.h
+++ b/libc/src/__support/char_vector.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
#define LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
-#include "src/__support/common.h"
+#include "src/__support/common.h" // LIBC_INLINE
#include <stddef.h>
#include <stdlib.h> // For allocation.
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c89c1f7950b974e..748bf160b4df410 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -338,6 +338,15 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_blockstore",
+ hdrs = ["src/__support/blockstore.h"],
+ deps = [
+ ":__support_cpp_new",
+ ":__support_libc_assert",
+ ],
+)
+
libc_support_library(
name = "__support_arg_list",
hdrs = ["src/__support/arg_list.h"],
@@ -354,6 +363,22 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_fixedvector",
+ hdrs = ["src/__support/fixedvector.h"],
+ deps = [
+ ":__support_cpp_array",
+ ],
+)
+
+libc_support_library(
+ name = "__support_char_vector",
+ hdrs = ["src/__support/char_vector.h"],
+ deps = [
+ ":__support_common",
+ ],
+)
+
libc_support_library(
name = "__support_error_or",
hdrs = ["src/__support/error_or.h"],
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
new file mode 100644
index 000000000000000..b286eb70d8c7cb5
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
@@ -0,0 +1,90 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+# Tests for LLVM libc __support functions.
+
+load("//libc/test:libc_test_rules.bzl", "libc_test")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+# This test is currently disabled because of an issue in
+# `libc/src/__support/CPP/new.h` which currently fails with
+# "error: cannot apply asm label to function after its first use"
+# libc_test(
+# name = "blockstore_test",
+# srcs = ["blockstore_test.cpp"],
+# deps = ["//libc:__support_blockstore"],
+# )
+
+libc_test(
+ name = "endian_test",
+ srcs = ["endian_test.cpp"],
+ deps = ["//libc:__support_common"],
+)
+
+libc_test(
+ name = "high_precision_decimal_test",
+ srcs = ["high_precision_decimal_test.cpp"],
+ deps = [
+ "//libc:__support_str_to_float",
+ "//libc:__support_uint128",
+ ],
+)
+
+libc_test(
+ name = "str_to_float_test",
+ srcs = ["str_to_float_test.cpp"],
+ deps = [
+ "//libc:__support_fputil_fp_bits",
+ "//libc:__support_str_to_float",
+ "//libc:__support_uint128",
+ ],
+)
+
+libc_test(
+ name = "integer_to_string_test",
+ srcs = ["integer_to_string_test.cpp"],
+ deps = [
+ "//libc:__support_cpp_span",
+ "//libc:__support_cpp_string_view",
+ "//libc:__support_integer_to_string",
+ "//libc:__support_uint",
+ "//libc:__support_uint128",
+ ],
+)
+
+libc_test(
+ name = "arg_list_test",
+ srcs = ["arg_list_test.cpp"],
+ deps = [
+ "//libc:__support_arg_list",
+ ],
+)
+
+libc_test(
+ name = "uint_test",
+ srcs = ["uint_test.cpp"],
+ deps = [
+ "//libc:__support_cpp_optional",
+ "//libc:__support_uint",
+ ],
+)
+
+libc_test(
+ name = "fixedvector_test",
+ srcs = ["fixedvector_test.cpp"],
+ deps = [
+ "//libc:__support_fixedvector",
+ ],
+)
+
+libc_test(
+ name = "char_vector_test",
+ srcs = ["char_vector_test.cpp"],
+ deps = [
+ "//libc:__support_char_vector",
+ ],
+)
|
|
||
load("//libc/test:libc_test_rules.bzl", "libc_test") | ||
|
||
package(default_visibility = ["//visibility:public"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Do we need public here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this in a separate patch if you don't mind since there are several other files to fix.
Also I need to make sure that it doesn't break things downstream (like the need to have a package
statement).
No description provided.