diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -291,6 +291,24 @@ ], ) +libc_support_library( + name = "__support_str_to_float", + hdrs = [ + "src/__support/detailed_powers_of_ten.h", + "src/__support/high_precision_decimal.h", + "src/__support/str_to_float.h", + ], + deps = [ + ":__support_builtin_wrappers", + ":__support_common", + ":__support_cpp_limits", + ":__support_ctype_utils", + ":__support_fputil_fp_bits", + ":__support_str_to_integer", + ":__support_uint128", + ], +) + libc_support_library( name = "__support_fputil_basic_operations", hdrs = ["src/__support/FPUtil/BasicOperations.h"], @@ -1323,6 +1341,16 @@ ], ) +libc_function( + name = "atof", + srcs = ["src/stdlib/atof.cpp"], + hdrs = ["src/stdlib/atof.h"], + deps = [ + ":__support_common", + ":__support_str_to_float", + ], +) + libc_function( name = "bsearch", srcs = ["src/stdlib/bsearch.cpp"], @@ -1381,6 +1409,36 @@ ], ) +libc_function( + name = "strtof", + srcs = ["src/stdlib/strtof.cpp"], + hdrs = ["src/stdlib/strtof.h"], + deps = [ + ":__support_common", + ":__support_str_to_float", + ], +) + +libc_function( + name = "strtod", + srcs = ["src/stdlib/strtod.cpp"], + hdrs = ["src/stdlib/strtod.h"], + deps = [ + ":__support_common", + ":__support_str_to_float", + ], +) + +libc_function( + name = "strtold", + srcs = ["src/stdlib/strtold.cpp"], + hdrs = ["src/stdlib/strtold.h"], + deps = [ + ":__support_common", + ":__support_str_to_float", + ], +) + ############################### string targets ############################### no_sanitize_features = [ 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 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel @@ -45,6 +45,15 @@ ], ) +libc_test( + name = "atof_test", + srcs = ["atof_test.cpp"], + deps = ["//libc:__support_fputil_fp_bits"], + libc_function_deps = [ + "//libc:atof", + ], +) + libc_test( name = "bsearch_test", srcs = ["bsearch_test.cpp"], @@ -105,3 +114,39 @@ "//libc:strtoull", ], ) + +libc_test( + name = "strtof_test", + srcs = ["strtof_test.cpp"], + deps = [ + "//libc:__support_fputil_fp_bits", + "//libc/utils/testutils:libc_test_utils", + ], + libc_function_deps = [ + "//libc:strtof", + ], +) + +libc_test( + name = "strtod_test", + srcs = ["strtod_test.cpp"], + deps = [ + "//libc:__support_fputil_fp_bits", + "//libc/utils/testutils:libc_test_utils", + ], + libc_function_deps = [ + "//libc:strtod", + ], +) + +libc_test( + name = "strtold_test", + srcs = ["strtold_test.cpp"], + deps = [ + "//libc:__support_fputil_fp_bits", + "//libc:__support_uint128", + ], + libc_function_deps = [ + "//libc:strtold", + ], +)