[llvm] [libc][bazel] Add targets for strfrom<float> (PR #128956)
Michael Jones via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 14:58:42 PST 2025
https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/128956
Add targets and tests for strfromf, strfromd and strfroml.
No idea why the standard committee decided that the long double function
should be "strfroml" instead of "strfromld" which would match "strtold"
and leave them space to add string from integer functions in future.
>From 84b6bcbb108a68df0b9282529d60bf36a563a0f5 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Wed, 26 Feb 2025 14:53:59 -0800
Subject: [PATCH] [libc][bazel] Add targets for strfrom<float>
Add targets and tests for strfromf, strfromd and strfroml.
No idea why the standard committee decided that the long double function
should be "strfroml" instead of "strfromld" which would match "strtold"
and leave them space to add string from integer functions in future.
---
.../llvm-project-overlay/libc/BUILD.bazel | 43 +++++++++++++++++++
.../libc/test/src/stdlib/BUILD.bazel | 31 +++++++++++++
2 files changed, 74 insertions(+)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c7654ed0b8797..b45145acc2cfe 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3571,6 +3571,49 @@ libc_function(
],
)
+libc_support_library(
+ name = "str_from_util",
+ hdrs = ["src/stdlib/str_from_util.h"],
+ deps = [
+ ":__support_common",
+ ":__support_cpp_type_traits",
+ ":__support_str_to_integer",
+ ":printf_converter",
+ ":printf_core_structs",
+ ":printf_writer",
+ ],
+)
+
+libc_function(
+ name = "strfromf",
+ srcs = ["src/stdlib/strfromf.cpp"],
+ hdrs = ["src/stdlib/strfromf.h"],
+ deps = [
+ ":__support_common",
+ ":str_from_util",
+ ],
+)
+
+libc_function(
+ name = "strfromd",
+ srcs = ["src/stdlib/strfromd.cpp"],
+ hdrs = ["src/stdlib/strfromd.h"],
+ deps = [
+ ":__support_common",
+ ":str_from_util",
+ ],
+)
+
+libc_function(
+ name = "strfroml",
+ srcs = ["src/stdlib/strfroml.cpp"],
+ hdrs = ["src/stdlib/strfroml.h"],
+ deps = [
+ ":__support_common",
+ ":str_from_util",
+ ],
+)
+
libc_function(
name = "strtol",
srcs = ["src/stdlib/strtol.cpp"],
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel
index a8b37c5ddcc2c..2566607fc053b 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel
@@ -149,6 +149,37 @@ libc_test(
deps = ["//libc:types_size_t"],
)
+libc_support_library(
+ name = "strfrom_test_support",
+ hdrs = ["StrfromTest.h"],
+ deps = [
+ "//libc:__support_cpp_type_traits",
+ "//libc:__support_fputil_fp_bits",
+ "//libc/test/UnitTest:LibcUnitTest",
+ ],
+)
+
+libc_test(
+ name = "strfromf_test",
+ srcs = ["strfromf_test.cpp"],
+ libc_function_deps = ["//libc:strfromf"],
+ deps = [":strfrom_test_support"],
+)
+
+libc_test(
+ name = "strfromd_test",
+ srcs = ["strfromd_test.cpp"],
+ libc_function_deps = ["//libc:strfromd"],
+ deps = [":strfrom_test_support"],
+)
+
+libc_test(
+ name = "strfroml_test",
+ srcs = ["strfroml_test.cpp"],
+ libc_function_deps = ["//libc:strfroml"],
+ deps = [":strfrom_test_support"],
+)
+
libc_support_library(
name = "strtol_test_helper",
hdrs = ["StrtolTest.h"],
More information about the llvm-commits
mailing list