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 @@ -1678,8 +1678,90 @@ libc_math_function(name = "scalbnl") +############################## inttypes targets ############################## + +libc_function( + name = "imaxabs", + srcs = ["src/inttypes/imaxabs.cpp"], + hdrs = ["src/inttypes/imaxabs.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + +libc_function( + name = "imaxdiv", + srcs = ["src/inttypes/imaxdiv.cpp"], + hdrs = ["src/inttypes/imaxdiv.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + ############################### stdlib targets ############################### +libc_function( + name = "abs", + srcs = ["src/stdlib/abs.cpp"], + hdrs = ["src/stdlib/abs.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + +libc_function( + name = "labs", + srcs = ["src/stdlib/labs.cpp"], + hdrs = ["src/stdlib/labs.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + +libc_function( + name = "llabs", + srcs = ["src/stdlib/llabs.cpp"], + hdrs = ["src/stdlib/llabs.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + +libc_function( + name = "div", + srcs = ["src/stdlib/div.cpp"], + hdrs = ["src/stdlib/div.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + +libc_function( + name = "ldiv", + srcs = ["src/stdlib/ldiv.cpp"], + hdrs = ["src/stdlib/ldiv.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + +libc_function( + name = "lldiv", + srcs = ["src/stdlib/lldiv.cpp"], + hdrs = ["src/stdlib/lldiv.h"], + deps = [ + ":__support_common", + ":__support_integer_operations", + ], +) + libc_function( name = "atoi", srcs = ["src/stdlib/atoi.cpp"], diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel new file mode 100644 --- /dev/null +++ b/utils/bazel/llvm-project-overlay/libc/test/src/inttypes/BUILD.bazel @@ -0,0 +1,30 @@ +# 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 inttypes.h functions. + +load("//libc/test:libc_test_rules.bzl", "libc_test") + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +libc_test( + name = "imaxabs_test", + srcs = ["imaxabs_test.cpp"], + libc_function_deps = [ + "//libc:imaxabs", + ], +) + +libc_test( + name = "imaxdiv_test", + srcs = ["imaxdiv_test.cpp"], + libc_function_deps = [ + "//libc:imaxdiv", + ], + deps = [ + "//libc/test/src/stdlib:div_test_helper", + ], +) 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 @@ -10,6 +10,71 @@ licenses(["notice"]) +libc_test( + name = "abs_test", + srcs = ["abs_test.cpp"], + libc_function_deps = [ + "//libc:abs", + ], +) + +libc_test( + name = "labs_test", + srcs = ["labs_test.cpp"], + libc_function_deps = [ + "//libc:labs", + ], +) + +libc_test( + name = "llabs_test", + srcs = ["llabs_test.cpp"], + libc_function_deps = [ + "//libc:llabs", + ], +) + +cc_library( + name = "div_test_helper", + hdrs = ["DivTest.h"], + deps = [ + "//libc/test/UnitTest:LibcUnitTest", + ], +) + +libc_test( + name = "div_test", + srcs = ["div_test.cpp"], + libc_function_deps = [ + "//libc:div", + ], + deps = [ + ":div_test_helper", + ], +) + +libc_test( + name = "ldiv_test", + srcs = ["ldiv_test.cpp"], + libc_function_deps = [ + "//libc:ldiv", + ], + deps = [ + ":div_test_helper", + ], +) + +libc_test( + name = "lldiv_test", + srcs = ["lldiv_test.cpp"], + libc_function_deps = [ + "//libc:lldiv", + ], + deps = [ + ":div_test_helper", + ], +) + cc_library( name = "atoi_test_helper", hdrs = ["AtoiTest.h"],