Skip to content

Commit 33f53d8

Browse files
michaelrj-googlejoaosaffran
authored andcommitted
[libc][bazel] Add targets for strfrom<float> (llvm#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.
1 parent 3c090ab commit 33f53d8

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,6 +3571,49 @@ libc_function(
35713571
],
35723572
)
35733573

3574+
libc_support_library(
3575+
name = "str_from_util",
3576+
hdrs = ["src/stdlib/str_from_util.h"],
3577+
deps = [
3578+
":__support_common",
3579+
":__support_cpp_type_traits",
3580+
":__support_str_to_integer",
3581+
":printf_converter",
3582+
":printf_core_structs",
3583+
":printf_writer",
3584+
],
3585+
)
3586+
3587+
libc_function(
3588+
name = "strfromf",
3589+
srcs = ["src/stdlib/strfromf.cpp"],
3590+
hdrs = ["src/stdlib/strfromf.h"],
3591+
deps = [
3592+
":__support_common",
3593+
":str_from_util",
3594+
],
3595+
)
3596+
3597+
libc_function(
3598+
name = "strfromd",
3599+
srcs = ["src/stdlib/strfromd.cpp"],
3600+
hdrs = ["src/stdlib/strfromd.h"],
3601+
deps = [
3602+
":__support_common",
3603+
":str_from_util",
3604+
],
3605+
)
3606+
3607+
libc_function(
3608+
name = "strfroml",
3609+
srcs = ["src/stdlib/strfroml.cpp"],
3610+
hdrs = ["src/stdlib/strfroml.h"],
3611+
deps = [
3612+
":__support_common",
3613+
":str_from_util",
3614+
],
3615+
)
3616+
35743617
libc_function(
35753618
name = "strtol",
35763619
srcs = ["src/stdlib/strtol.cpp"],

utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,37 @@ libc_test(
149149
deps = ["//libc:types_size_t"],
150150
)
151151

152+
libc_support_library(
153+
name = "strfrom_test_helper",
154+
hdrs = ["StrfromTest.h"],
155+
deps = [
156+
"//libc:__support_cpp_type_traits",
157+
"//libc:__support_fputil_fp_bits",
158+
"//libc/test/UnitTest:LibcUnitTest",
159+
],
160+
)
161+
162+
libc_test(
163+
name = "strfromf_test",
164+
srcs = ["strfromf_test.cpp"],
165+
libc_function_deps = ["//libc:strfromf"],
166+
deps = [":strfrom_test_helper"],
167+
)
168+
169+
libc_test(
170+
name = "strfromd_test",
171+
srcs = ["strfromd_test.cpp"],
172+
libc_function_deps = ["//libc:strfromd"],
173+
deps = [":strfrom_test_helper"],
174+
)
175+
176+
libc_test(
177+
name = "strfroml_test",
178+
srcs = ["strfroml_test.cpp"],
179+
libc_function_deps = ["//libc:strfroml"],
180+
deps = [":strfrom_test_helper"],
181+
)
182+
152183
libc_support_library(
153184
name = "strtol_test_helper",
154185
hdrs = ["StrtolTest.h"],

0 commit comments

Comments
 (0)