[libcxx-commits] [libcxx] [libc++] Merge traits relating to arithemtic type into a single arithmetic_traits.h (PR #143757)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 11 10:47:25 PDT 2025


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/143757

None

>From 845631d576580c86da456cc1505ce5880d6c1d7e Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 11 Jun 2025 19:46:08 +0200
Subject: [PATCH] [libc++] Merge traits relating to arithemtic type into a
 single arithmetic_traits.h

---
 libcxx/include/CMakeLists.txt                 |   7 +-
 libcxx/include/__algorithm/comp.h             |   2 +-
 libcxx/include/__algorithm/find.h             |   3 +-
 libcxx/include/__algorithm/half_positive.h    |   2 +-
 .../__algorithm/lexicographical_compare.h     |   1 -
 libcxx/include/__algorithm/mismatch.h         |   2 +-
 libcxx/include/__algorithm/radix_sort.h       |   6 +-
 libcxx/include/__algorithm/ranges_minmax.h    |   3 +-
 libcxx/include/__algorithm/sort.h             |   2 +-
 libcxx/include/__atomic/atomic.h              |   5 +-
 libcxx/include/__bit/bit_ceil.h               |   2 +-
 libcxx/include/__bit/bit_floor.h              |   2 +-
 libcxx/include/__bit/bit_log2.h               |   2 +-
 libcxx/include/__bit/bit_width.h              |   2 +-
 libcxx/include/__bit/countl.h                 |   2 +-
 libcxx/include/__bit/countr.h                 |   2 +-
 libcxx/include/__bit/has_single_bit.h         |   2 +-
 libcxx/include/__bit/popcount.h               |   2 +-
 libcxx/include/__bit/rotate.h                 |   2 +-
 libcxx/include/__bit_reference                |   3 +-
 .../include/__charconv/from_chars_integral.h  |   4 +-
 libcxx/include/__charconv/to_chars_integral.h |   2 +-
 libcxx/include/__charconv/traits.h            |   2 +-
 libcxx/include/__chrono/duration.h            |   2 +-
 libcxx/include/__compare/strong_order.h       |   2 +-
 libcxx/include/__compare/weak_order.h         |   2 +-
 libcxx/include/__concepts/arithmetic.h        |   4 +-
 .../__condition_variable/condition_variable.h |   2 +-
 libcxx/include/__cstddef/byte.h               |   2 +-
 libcxx/include/__format/format_arg_store.h    |   2 +-
 libcxx/include/__functional/hash.h            |   3 +-
 libcxx/include/__functional/operations.h      |   2 +-
 libcxx/include/__iterator/advance.h           |   3 +-
 .../__iterator/cpp17_iterator_concepts.h      |   4 +-
 libcxx/include/__math/abs.h                   |   2 +-
 libcxx/include/__math/copysign.h              |   2 +-
 libcxx/include/__math/error_functions.h       |   2 +-
 libcxx/include/__math/exponential_functions.h |   3 +-
 libcxx/include/__math/fdim.h                  |   2 +-
 libcxx/include/__math/fma.h                   |   2 +-
 libcxx/include/__math/gamma.h                 |   2 +-
 libcxx/include/__math/hyperbolic_functions.h  |   2 +-
 libcxx/include/__math/hypot.h                 |   2 +-
 .../__math/inverse_hyperbolic_functions.h     |   2 +-
 .../__math/inverse_trigonometric_functions.h  |   3 +-
 libcxx/include/__math/logarithms.h            |   2 +-
 libcxx/include/__math/min_max.h               |   2 +-
 libcxx/include/__math/modulo.h                |   2 +-
 libcxx/include/__math/remainder.h             |   2 +-
 libcxx/include/__math/roots.h                 |   2 +-
 libcxx/include/__math/rounding_functions.h    |   3 +-
 libcxx/include/__math/special_functions.h     |   2 +-
 libcxx/include/__math/traits.h                |   3 +-
 .../include/__math/trigonometric_functions.h  |   2 +-
 libcxx/include/__mdspan/extents.h             |   2 +-
 libcxx/include/__numeric/gcd_lcm.h            |   5 +-
 libcxx/include/__numeric/midpoint.h           |   5 +-
 .../include/__numeric/saturation_arithmetic.h |   2 +-
 .../__pstl/cpu_algos/transform_reduce.h       |   2 +-
 libcxx/include/__random/is_valid.h            |   2 +-
 .../__random/linear_congruential_engine.h     |   2 +-
 libcxx/include/__random/seed_seq.h            |   3 +-
 .../include/__string/constexpr_c_functions.h  |   2 +-
 .../include/__type_traits/arithmetic_traits.h | 226 ++++++++++++++++++
 libcxx/include/__type_traits/integer_traits.h |  73 ------
 .../__type_traits/is_always_bitcastable.h     |   2 +-
 libcxx/include/__type_traits/is_arithmetic.h  |  34 ---
 .../__type_traits/is_equality_comparable.h    |   3 +-
 .../include/__type_traits/is_floating_point.h |  39 ---
 libcxx/include/__type_traits/is_integral.h    |  74 ------
 libcxx/include/__type_traits/is_scalar.h      |   2 +-
 libcxx/include/__type_traits/is_signed.h      |  52 ----
 ...s_trivially_lexicographically_comparable.h |   2 +-
 libcxx/include/__type_traits/is_unsigned.h    |  52 ----
 .../__type_traits/make_32_64_or_128_bit.h     |   3 +-
 libcxx/include/__type_traits/make_signed.h    |   2 +-
 libcxx/include/__type_traits/make_unsigned.h  |   3 +-
 libcxx/include/__type_traits/promote.h        |   2 +-
 libcxx/include/__utility/cmp.h                |   3 +-
 .../include/__utility/convert_to_integral.h   |   2 +-
 libcxx/include/__utility/integer_sequence.h   |   2 +-
 libcxx/include/cmath                          |   5 +-
 libcxx/include/forward_list                   |   1 +
 libcxx/include/limits                         |   4 +-
 libcxx/include/math.h                         |   3 +-
 libcxx/include/module.modulemap.in            |  25 +-
 libcxx/include/tuple                          |   1 -
 libcxx/include/type_traits                    |   6 +-
 libcxx/include/unordered_map                  |   2 +-
 89 files changed, 310 insertions(+), 472 deletions(-)
 create mode 100644 libcxx/include/__type_traits/arithmetic_traits.h
 delete mode 100644 libcxx/include/__type_traits/integer_traits.h
 delete mode 100644 libcxx/include/__type_traits/is_arithmetic.h
 delete mode 100644 libcxx/include/__type_traits/is_floating_point.h
 delete mode 100644 libcxx/include/__type_traits/is_integral.h
 delete mode 100644 libcxx/include/__type_traits/is_signed.h
 delete mode 100644 libcxx/include/__type_traits/is_unsigned.h

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 8931a1b35f6d3..e69d1255f932f 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -782,6 +782,7 @@ set(files
   __type_traits/aligned_storage.h
   __type_traits/aligned_union.h
   __type_traits/alignment_of.h
+  __type_traits/arithmetic_traits.h
   __type_traits/can_extract_key.h
   __type_traits/common_reference.h
   __type_traits/common_type.h
@@ -800,14 +801,12 @@ set(files
   __type_traits/extent.h
   __type_traits/has_unique_object_representation.h
   __type_traits/has_virtual_destructor.h
-  __type_traits/integer_traits.h
   __type_traits/integral_constant.h
   __type_traits/invoke.h
   __type_traits/is_abstract.h
   __type_traits/is_aggregate.h
   __type_traits/is_allocator.h
   __type_traits/is_always_bitcastable.h
-  __type_traits/is_arithmetic.h
   __type_traits/is_array.h
   __type_traits/is_assignable.h
   __type_traits/is_base_of.h
@@ -827,12 +826,10 @@ set(files
   __type_traits/is_equality_comparable.h
   __type_traits/is_execution_policy.h
   __type_traits/is_final.h
-  __type_traits/is_floating_point.h
   __type_traits/is_function.h
   __type_traits/is_fundamental.h
   __type_traits/is_implicit_lifetime.h
   __type_traits/is_implicitly_default_constructible.h
-  __type_traits/is_integral.h
   __type_traits/is_literal_type.h
   __type_traits/is_member_pointer.h
   __type_traits/is_nothrow_assignable.h
@@ -850,7 +847,6 @@ set(files
   __type_traits/is_replaceable.h
   __type_traits/is_same.h
   __type_traits/is_scalar.h
-  __type_traits/is_signed.h
   __type_traits/is_specialization.h
   __type_traits/is_standard_layout.h
   __type_traits/is_swappable.h
@@ -863,7 +859,6 @@ set(files
   __type_traits/is_trivially_relocatable.h
   __type_traits/is_unbounded_array.h
   __type_traits/is_union.h
-  __type_traits/is_unsigned.h
   __type_traits/is_valid_expansion.h
   __type_traits/is_void.h
   __type_traits/is_volatile.h
diff --git a/libcxx/include/__algorithm/comp.h b/libcxx/include/__algorithm/comp.h
index ab3c598418828..fd651608cca1a 100644
--- a/libcxx/include/__algorithm/comp.h
+++ b/libcxx/include/__algorithm/comp.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___ALGORITHM_COMP_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/desugars_to.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__algorithm/find.h b/libcxx/include/__algorithm/find.h
index a7d9374b3a1c8..5fc3c147ef4d6 100644
--- a/libcxx/include/__algorithm/find.h
+++ b/libcxx/include/__algorithm/find.h
@@ -20,11 +20,10 @@
 #include <__fwd/bit_reference.h>
 #include <__iterator/segmented_iterator.h>
 #include <__string/constexpr_c_functions.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/invoke.h>
 #include <__type_traits/is_equality_comparable.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_signed.h>
 #include <__utility/move.h>
 #include <limits>
 
diff --git a/libcxx/include/__algorithm/half_positive.h b/libcxx/include/__algorithm/half_positive.h
index ebda0da372369..90306dc9e1bf4 100644
--- a/libcxx/include/__algorithm/half_positive.h
+++ b/libcxx/include/__algorithm/half_positive.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___ALGORITHM_HALF_POSITIVE_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/make_unsigned.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/lexicographical_compare.h b/libcxx/include/__algorithm/lexicographical_compare.h
index ebe7e3b56a292..b76bfd320b1fe 100644
--- a/libcxx/include/__algorithm/lexicographical_compare.h
+++ b/libcxx/include/__algorithm/lexicographical_compare.h
@@ -22,7 +22,6 @@
 #include <__type_traits/enable_if.h>
 #include <__type_traits/invoke.h>
 #include <__type_traits/is_equality_comparable.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_trivially_lexicographically_comparable.h>
 #include <__type_traits/is_volatile.h>
 
diff --git a/libcxx/include/__algorithm/mismatch.h b/libcxx/include/__algorithm/mismatch.h
index a6836792c0581..1f34fb478388e 100644
--- a/libcxx/include/__algorithm/mismatch.h
+++ b/libcxx/include/__algorithm/mismatch.h
@@ -19,12 +19,12 @@
 #include <__functional/identity.h>
 #include <__iterator/aliasing_iterator.h>
 #include <__iterator/iterator_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/desugars_to.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/invoke.h>
 #include <__type_traits/is_constant_evaluated.h>
 #include <__type_traits/is_equality_comparable.h>
-#include <__type_traits/is_integral.h>
 #include <__utility/move.h>
 #include <__utility/pair.h>
 
diff --git a/libcxx/include/__algorithm/radix_sort.h b/libcxx/include/__algorithm/radix_sort.h
index 055d8a0765d7c..0e884fee426b9 100644
--- a/libcxx/include/__algorithm/radix_sort.h
+++ b/libcxx/include/__algorithm/radix_sort.h
@@ -37,21 +37,17 @@
 #include <__iterator/access.h>
 #include <__iterator/distance.h>
 #include <__iterator/iterator_traits.h>
-#include <__iterator/move_iterator.h>
 #include <__iterator/next.h>
 #include <__iterator/reverse_iterator.h>
 #include <__numeric/partial_sum.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/decay.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/invoke.h>
-#include <__type_traits/is_assignable.h>
 #include <__type_traits/is_enum.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/make_unsigned.h>
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
-#include <__utility/forward.h>
 #include <__utility/integer_sequence.h>
 #include <__utility/move.h>
 #include <__utility/pair.h>
diff --git a/libcxx/include/__algorithm/ranges_minmax.h b/libcxx/include/__algorithm/ranges_minmax.h
index 5f2e5cb2a1eea..5db9f9be7545b 100644
--- a/libcxx/include/__algorithm/ranges_minmax.h
+++ b/libcxx/include/__algorithm/ranges_minmax.h
@@ -23,14 +23,13 @@
 #include <__iterator/projected.h>
 #include <__ranges/access.h>
 #include <__ranges/concepts.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/desugars_to.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_reference.h>
 #include <__type_traits/is_trivially_copyable.h>
 #include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <__utility/pair.h>
 #include <initializer_list>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h
index 06cb5b8ce7057..64d1e14883194 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -27,11 +27,11 @@
 #include <__functional/operations.h>
 #include <__functional/ranges_operations.h>
 #include <__iterator/iterator_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/desugars_to.h>
 #include <__type_traits/disjunction.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_constant_evaluated.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/is_trivially_copyable.h>
diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h
index eead49dde6192..f4c79a392291f 100644
--- a/libcxx/include/__atomic/atomic.h
+++ b/libcxx/include/__atomic/atomic.h
@@ -17,16 +17,13 @@
 #include <__config>
 #include <__cstddef/ptrdiff_t.h>
 #include <__memory/addressof.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_floating_point.h>
 #include <__type_traits/is_function.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_nothrow_constructible.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/is_trivially_copyable.h>
-#include <__type_traits/remove_const.h>
 #include <__type_traits/remove_pointer.h>
-#include <__type_traits/remove_volatile.h>
 #include <__utility/forward.h>
 #include <cstring>
 
diff --git a/libcxx/include/__bit/bit_ceil.h b/libcxx/include/__bit/bit_ceil.h
index 99881a8538290..6f0da5b1ea451 100644
--- a/libcxx/include/__bit/bit_ceil.h
+++ b/libcxx/include/__bit/bit_ceil.h
@@ -12,7 +12,7 @@
 #include <__assert>
 #include <__bit/countl.h>
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__bit/bit_floor.h b/libcxx/include/__bit/bit_floor.h
index 799a064130b4b..4049c3e27a4a3 100644
--- a/libcxx/include/__bit/bit_floor.h
+++ b/libcxx/include/__bit/bit_floor.h
@@ -11,7 +11,7 @@
 
 #include <__bit/bit_log2.h>
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__bit/bit_log2.h b/libcxx/include/__bit/bit_log2.h
index 8077cd91d6fd7..0d57477f083fa 100644
--- a/libcxx/include/__bit/bit_log2.h
+++ b/libcxx/include/__bit/bit_log2.h
@@ -11,7 +11,7 @@
 
 #include <__bit/countl.h>
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__bit/bit_width.h b/libcxx/include/__bit/bit_width.h
index 75050acabbe88..fc255a0fc2ce8 100644
--- a/libcxx/include/__bit/bit_width.h
+++ b/libcxx/include/__bit/bit_width.h
@@ -11,7 +11,7 @@
 
 #include <__bit/bit_log2.h>
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__bit/countl.h b/libcxx/include/__bit/countl.h
index 075914020879a..f9a249763d13c 100644
--- a/libcxx/include/__bit/countl.h
+++ b/libcxx/include/__bit/countl.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___BIT_COUNTL_H
 
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__bit/countr.h b/libcxx/include/__bit/countr.h
index f6c98695d3d06..aa0338a8fc4a3 100644
--- a/libcxx/include/__bit/countr.h
+++ b/libcxx/include/__bit/countr.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___BIT_COUNTR_H
 
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__bit/has_single_bit.h b/libcxx/include/__bit/has_single_bit.h
index b43e69323e77b..3bd1387f3991b 100644
--- a/libcxx/include/__bit/has_single_bit.h
+++ b/libcxx/include/__bit/has_single_bit.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___BIT_HAS_SINGLE_BIT_H
 
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__bit/popcount.h b/libcxx/include/__bit/popcount.h
index 8d9ba09938482..4b5a4403d4dc1 100644
--- a/libcxx/include/__bit/popcount.h
+++ b/libcxx/include/__bit/popcount.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___BIT_POPCOUNT_H
 
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__bit/rotate.h b/libcxx/include/__bit/rotate.h
index c6f34bdaf6e63..55254dc0396b7 100644
--- a/libcxx/include/__bit/rotate.h
+++ b/libcxx/include/__bit/rotate.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___BIT_ROTATE_H
 
 #include <__config>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index a3e6defd405f8..f0c24bf3d951f 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -29,12 +29,11 @@
 #include <__iterator/iterator_traits.h>
 #include <__memory/construct_at.h>
 #include <__memory/pointer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/desugars_to.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_constant_evaluated.h>
-#include <__type_traits/is_same.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/void_t.h>
 #include <__utility/pair.h>
 #include <__utility/swap.h>
diff --git a/libcxx/include/__charconv/from_chars_integral.h b/libcxx/include/__charconv/from_chars_integral.h
index c1f033b37b913..0a4f99dc1bd4b 100644
--- a/libcxx/include/__charconv/from_chars_integral.h
+++ b/libcxx/include/__charconv/from_chars_integral.h
@@ -17,10 +17,8 @@
 #include <__config>
 #include <__memory/addressof.h>
 #include <__system_error/errc.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/make_unsigned.h>
 #include <limits>
 
diff --git a/libcxx/include/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h
index f10cc3566875a..d42de8ab8b7d8 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -20,9 +20,9 @@
 #include <__config>
 #include <__cstddef/ptrdiff_t.h>
 #include <__system_error/errc.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/make_32_64_or_128_bit.h>
 #include <__type_traits/make_unsigned.h>
diff --git a/libcxx/include/__charconv/traits.h b/libcxx/include/__charconv/traits.h
index 9fd0092ca79c3..196c3a8973d17 100644
--- a/libcxx/include/__charconv/traits.h
+++ b/libcxx/include/__charconv/traits.h
@@ -16,8 +16,8 @@
 #include <__charconv/to_chars_base_10.h>
 #include <__config>
 #include <__memory/addressof.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_unsigned.h>
 #include <cstdint>
 #include <limits>
 
diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h
index 57fa64d650068..dd3f93a7b5d55 100644
--- a/libcxx/include/__chrono/duration.h
+++ b/libcxx/include/__chrono/duration.h
@@ -13,10 +13,10 @@
 #include <__compare/ordering.h>
 #include <__compare/three_way_comparable.h>
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/common_type.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_convertible.h>
-#include <__type_traits/is_floating_point.h>
 #include <limits>
 #include <ratio>
 
diff --git a/libcxx/include/__compare/strong_order.h b/libcxx/include/__compare/strong_order.h
index 8c363b5638222..100135497635e 100644
--- a/libcxx/include/__compare/strong_order.h
+++ b/libcxx/include/__compare/strong_order.h
@@ -15,9 +15,9 @@
 #include <__config>
 #include <__math/exponential_functions.h>
 #include <__math/traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/decay.h>
-#include <__type_traits/is_floating_point.h>
 #include <__type_traits/is_same.h>
 #include <__utility/forward.h>
 #include <__utility/priority_tag.h>
diff --git a/libcxx/include/__compare/weak_order.h b/libcxx/include/__compare/weak_order.h
index 1a3e85feb233b..5fa03069fce9f 100644
--- a/libcxx/include/__compare/weak_order.h
+++ b/libcxx/include/__compare/weak_order.h
@@ -14,8 +14,8 @@
 #include <__compare/strong_order.h>
 #include <__config>
 #include <__math/traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/decay.h>
-#include <__type_traits/is_floating_point.h>
 #include <__type_traits/is_same.h>
 #include <__utility/forward.h>
 #include <__utility/priority_tag.h>
diff --git a/libcxx/include/__concepts/arithmetic.h b/libcxx/include/__concepts/arithmetic.h
index 64c0200783df7..6a02a63c845c0 100644
--- a/libcxx/include/__concepts/arithmetic.h
+++ b/libcxx/include/__concepts/arithmetic.h
@@ -10,9 +10,7 @@
 #define _LIBCPP___CONCEPTS_ARITHMETIC_H
 
 #include <__config>
-#include <__type_traits/is_floating_point.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_signed.h>
+#include <__type_traits/arithmetic_traits.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h
index 1e8edd5dcb009..7a1180d2dc427 100644
--- a/libcxx/include/__condition_variable/condition_variable.h
+++ b/libcxx/include/__condition_variable/condition_variable.h
@@ -18,8 +18,8 @@
 #include <__mutex/unique_lock.h>
 #include <__system_error/throw_system_error.h>
 #include <__thread/support.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_floating_point.h>
 #include <__utility/move.h>
 #include <limits>
 #include <ratio>
diff --git a/libcxx/include/__cstddef/byte.h b/libcxx/include/__cstddef/byte.h
index 3d97db1bea293..a659561d768d4 100644
--- a/libcxx/include/__cstddef/byte.h
+++ b/libcxx/include/__cstddef/byte.h
@@ -11,8 +11,8 @@
 
 #include <__config>
 #include <__fwd/byte.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index fbb4cad21b232..8cd7c447f28fc 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -19,9 +19,9 @@
 #include <__cstddef/size_t.h>
 #include <__format/concepts.h>
 #include <__format/format_arg.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/extent.h>
-#include <__type_traits/integer_traits.h>
 #include <__type_traits/remove_const.h>
 #include <cstdint>
 #include <string>
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index 489a6f00b8a3d..c01a54f72bfab 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -14,13 +14,12 @@
 #include <__functional/unary_function.h>
 #include <__fwd/functional.h>
 #include <__memory/addressof.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conjunction.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/invoke.h>
 #include <__type_traits/is_constructible.h>
 #include <__type_traits/is_enum.h>
-#include <__type_traits/is_floating_point.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/underlying_type.h>
 #include <__utility/pair.h>
 #include <__utility/swap.h>
diff --git a/libcxx/include/__functional/operations.h b/libcxx/include/__functional/operations.h
index 7b0ea11db5844..5718cac192353 100644
--- a/libcxx/include/__functional/operations.h
+++ b/libcxx/include/__functional/operations.h
@@ -14,8 +14,8 @@
 #include <__functional/binary_function.h>
 #include <__functional/unary_function.h>
 #include <__fwd/functional.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/desugars_to.h>
-#include <__type_traits/is_integral.h>
 #include <__utility/forward.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h
index c7d3c1f0e8f05..c44ddf005eada 100644
--- a/libcxx/include/__iterator/advance.h
+++ b/libcxx/include/__iterator/advance.h
@@ -17,13 +17,12 @@
 #include <__iterator/concepts.h>
 #include <__iterator/incrementable_traits.h>
 #include <__iterator/iterator_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 #include <__utility/convert_to_integral.h>
 #include <__utility/declval.h>
 #include <__utility/move.h>
 #include <__utility/unreachable.h>
-#include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__iterator/cpp17_iterator_concepts.h b/libcxx/include/__iterator/cpp17_iterator_concepts.h
index ba3536b686099..2eaf1d30d8370 100644
--- a/libcxx/include/__iterator/cpp17_iterator_concepts.h
+++ b/libcxx/include/__iterator/cpp17_iterator_concepts.h
@@ -14,14 +14,12 @@
 #include <__concepts/same_as.h>
 #include <__config>
 #include <__iterator/iterator_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/is_constructible.h>
-#include <__type_traits/is_convertible.h>
-#include <__type_traits/is_signed.h>
 #include <__type_traits/is_void.h>
 #include <__utility/as_const.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
-#include <__utility/swap.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/abs.h b/libcxx/include/__math/abs.h
index fc3bf3a2c7c32..5a21f14d9fc0e 100644
--- a/libcxx/include/__math/abs.h
+++ b/libcxx/include/__math/abs.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_ABS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/copysign.h b/libcxx/include/__math/copysign.h
index 4c297cb0894e9..8e486cf980dbb 100644
--- a/libcxx/include/__math/copysign.h
+++ b/libcxx/include/__math/copysign.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_COPYSIGN_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/promote.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__math/error_functions.h b/libcxx/include/__math/error_functions.h
index 6b528bb290001..4971dc59246e6 100644
--- a/libcxx/include/__math/error_functions.h
+++ b/libcxx/include/__math/error_functions.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_ERROR_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/exponential_functions.h b/libcxx/include/__math/exponential_functions.h
index 09930b7819e23..4f82af810245e 100644
--- a/libcxx/include/__math/exponential_functions.h
+++ b/libcxx/include/__math/exponential_functions.h
@@ -10,9 +10,8 @@
 #define _LIBCPP___MATH_EXPONENTIAL_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/fdim.h b/libcxx/include/__math/fdim.h
index a1081c7bde3d3..2640969d4e162 100644
--- a/libcxx/include/__math/fdim.h
+++ b/libcxx/include/__math/fdim.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_FDIM_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/fma.h b/libcxx/include/__math/fma.h
index b972d85b89cb3..95884aae2b88a 100644
--- a/libcxx/include/__math/fma.h
+++ b/libcxx/include/__math/fma.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_FMA_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/gamma.h b/libcxx/include/__math/gamma.h
index 693e111a84e99..f5bc543da45d5 100644
--- a/libcxx/include/__math/gamma.h
+++ b/libcxx/include/__math/gamma.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_GAMMA_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/hyperbolic_functions.h b/libcxx/include/__math/hyperbolic_functions.h
index 78832bae70c9d..131c61ad48035 100644
--- a/libcxx/include/__math/hyperbolic_functions.h
+++ b/libcxx/include/__math/hyperbolic_functions.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_HYPERBOLIC_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/hypot.h b/libcxx/include/__math/hypot.h
index 8e8c35b4a41c8..908050bd71afc 100644
--- a/libcxx/include/__math/hypot.h
+++ b/libcxx/include/__math/hypot.h
@@ -14,8 +14,8 @@
 #include <__math/exponential_functions.h>
 #include <__math/min_max.h>
 #include <__math/roots.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 #include <limits>
diff --git a/libcxx/include/__math/inverse_hyperbolic_functions.h b/libcxx/include/__math/inverse_hyperbolic_functions.h
index 4660a58e4eba0..411a01e1dd84e 100644
--- a/libcxx/include/__math/inverse_hyperbolic_functions.h
+++ b/libcxx/include/__math/inverse_hyperbolic_functions.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_INVERSE_HYPERBOLIC_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/inverse_trigonometric_functions.h b/libcxx/include/__math/inverse_trigonometric_functions.h
index 409500278e7a9..8ab330880dfa8 100644
--- a/libcxx/include/__math/inverse_trigonometric_functions.h
+++ b/libcxx/include/__math/inverse_trigonometric_functions.h
@@ -10,9 +10,8 @@
 #define _LIBCPP___MATH_INVERSE_TRIGONOMETRIC_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/logarithms.h b/libcxx/include/__math/logarithms.h
index 5f5f943977a50..107856b16c524 100644
--- a/libcxx/include/__math/logarithms.h
+++ b/libcxx/include/__math/logarithms.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_LOGARITHMS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/min_max.h b/libcxx/include/__math/min_max.h
index 1ddbb557d1e8f..e8a44b22f7d55 100644
--- a/libcxx/include/__math/min_max.h
+++ b/libcxx/include/__math/min_max.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_MIN_MAX_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/modulo.h b/libcxx/include/__math/modulo.h
index 71405abb6b9b8..c0f28557bf4e0 100644
--- a/libcxx/include/__math/modulo.h
+++ b/libcxx/include/__math/modulo.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_MODULO_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/remainder.h b/libcxx/include/__math/remainder.h
index 39fb76af6bdec..3a60391179db4 100644
--- a/libcxx/include/__math/remainder.h
+++ b/libcxx/include/__math/remainder.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_REMAINDER_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/roots.h b/libcxx/include/__math/roots.h
index cef376fb008cf..3fc3d660aa455 100644
--- a/libcxx/include/__math/roots.h
+++ b/libcxx/include/__math/roots.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_ROOTS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__math/rounding_functions.h b/libcxx/include/__math/rounding_functions.h
index aadeb395fa2eb..2bb5385ed80fe 100644
--- a/libcxx/include/__math/rounding_functions.h
+++ b/libcxx/include/__math/rounding_functions.h
@@ -10,9 +10,8 @@
 #define _LIBCPP___MATH_ROUNDING_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/promote.h>
 
diff --git a/libcxx/include/__math/special_functions.h b/libcxx/include/__math/special_functions.h
index 0b1c753a659ad..e2b0825983354 100644
--- a/libcxx/include/__math/special_functions.h
+++ b/libcxx/include/__math/special_functions.h
@@ -13,8 +13,8 @@
 #include <__config>
 #include <__math/copysign.h>
 #include <__math/traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__math/traits.h b/libcxx/include/__math/traits.h
index 4a6e58c6da8ad..6926d892499e8 100644
--- a/libcxx/include/__math/traits.h
+++ b/libcxx/include/__math/traits.h
@@ -10,9 +10,8 @@
 #define _LIBCPP___MATH_TRAITS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/promote.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__math/trigonometric_functions.h b/libcxx/include/__math/trigonometric_functions.h
index 0ad91c7631609..2cc0c0843d996 100644
--- a/libcxx/include/__math/trigonometric_functions.h
+++ b/libcxx/include/__math/trigonometric_functions.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___MATH_TRIGONOMETRIC_FUNCTIONS_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h
index 99b54badf893c..c6bf10cd2a333 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -21,8 +21,8 @@
 #include <__config>
 
 #include <__concepts/arithmetic.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/common_type.h>
-#include <__type_traits/integer_traits.h>
 #include <__type_traits/is_convertible.h>
 #include <__type_traits/is_nothrow_constructible.h>
 #include <__type_traits/make_unsigned.h>
diff --git a/libcxx/include/__numeric/gcd_lcm.h b/libcxx/include/__numeric/gcd_lcm.h
index ce58f8698f726..a0f0878ba5832 100644
--- a/libcxx/include/__numeric/gcd_lcm.h
+++ b/libcxx/include/__numeric/gcd_lcm.h
@@ -10,16 +10,15 @@
 #ifndef _LIBCPP___NUMERIC_GCD_LCM_H
 #define _LIBCPP___NUMERIC_GCD_LCM_H
 
-#include <__algorithm/min.h>
 #include <__assert>
 #include <__bit/countr.h>
 #include <__config>
 #include <__memory/addressof.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/common_type.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
-#include <__type_traits/is_signed.h>
 #include <__type_traits/make_unsigned.h>
+#include <__type_traits/remove_cv.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__numeric/midpoint.h b/libcxx/include/__numeric/midpoint.h
index 2ba80e5cca07d..b9231960649fd 100644
--- a/libcxx/include/__numeric/midpoint.h
+++ b/libcxx/include/__numeric/midpoint.h
@@ -12,16 +12,13 @@
 
 #include <__config>
 #include <__cstddef/ptrdiff_t.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_floating_point.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_null_pointer.h>
 #include <__type_traits/is_object.h>
-#include <__type_traits/is_pointer.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/is_void.h>
 #include <__type_traits/make_unsigned.h>
-#include <__type_traits/remove_pointer.h>
 #include <limits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__numeric/saturation_arithmetic.h b/libcxx/include/__numeric/saturation_arithmetic.h
index 9bd3af12c9572..1ba1d9bd01087 100644
--- a/libcxx/include/__numeric/saturation_arithmetic.h
+++ b/libcxx/include/__numeric/saturation_arithmetic.h
@@ -13,7 +13,7 @@
 #include <__assert>
 #include <__config>
 #include <__memory/addressof.h>
-#include <__type_traits/integer_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__utility/cmp.h>
 #include <limits>
 
diff --git a/libcxx/include/__pstl/cpu_algos/transform_reduce.h b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
index abd9d42a6f2e6..74133e3bb07bb 100644
--- a/libcxx/include/__pstl/cpu_algos/transform_reduce.h
+++ b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
@@ -16,8 +16,8 @@
 #include <__numeric/transform_reduce.h>
 #include <__pstl/backend_fwd.h>
 #include <__pstl/cpu_algos/cpu_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/desugars_to.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_execution_policy.h>
 #include <__utility/move.h>
 #include <optional>
diff --git a/libcxx/include/__random/is_valid.h b/libcxx/include/__random/is_valid.h
index f6679b3fdc427..e5dc9da7b4cc4 100644
--- a/libcxx/include/__random/is_valid.h
+++ b/libcxx/include/__random/is_valid.h
@@ -10,10 +10,10 @@
 #define _LIBCPP___RANDOM_IS_VALID_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_same.h>
-#include <__type_traits/is_unsigned.h>
 #include <__utility/declval.h>
 #include <cstdint>
 
diff --git a/libcxx/include/__random/linear_congruential_engine.h b/libcxx/include/__random/linear_congruential_engine.h
index f74129d9b8ffe..7f52d24ce0059 100644
--- a/libcxx/include/__random/linear_congruential_engine.h
+++ b/libcxx/include/__random/linear_congruential_engine.h
@@ -11,9 +11,9 @@
 
 #include <__config>
 #include <__random/is_seed_sequence.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_unsigned.h>
 #include <cstdint>
 #include <iosfwd>
 
diff --git a/libcxx/include/__random/seed_seq.h b/libcxx/include/__random/seed_seq.h
index b1ccc8329b8f9..fafd0f49e3687 100644
--- a/libcxx/include/__random/seed_seq.h
+++ b/libcxx/include/__random/seed_seq.h
@@ -14,9 +14,8 @@
 #include <__algorithm/max.h>
 #include <__config>
 #include <__iterator/iterator_traits.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_unsigned.h>
 #include <__vector/vector.h>
 #include <cstdint>
 #include <initializer_list>
diff --git a/libcxx/include/__string/constexpr_c_functions.h b/libcxx/include/__string/constexpr_c_functions.h
index 119669e16bbcf..28c77747abd2f 100644
--- a/libcxx/include/__string/constexpr_c_functions.h
+++ b/libcxx/include/__string/constexpr_c_functions.h
@@ -13,6 +13,7 @@
 #include <__cstddef/size_t.h>
 #include <__memory/addressof.h>
 #include <__memory/construct_at.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/datasizeof.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_always_bitcastable.h>
@@ -20,7 +21,6 @@
 #include <__type_traits/is_constant_evaluated.h>
 #include <__type_traits/is_constructible.h>
 #include <__type_traits/is_equality_comparable.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/is_trivially_copyable.h>
 #include <__type_traits/is_trivially_lexicographically_comparable.h>
diff --git a/libcxx/include/__type_traits/arithmetic_traits.h b/libcxx/include/__type_traits/arithmetic_traits.h
new file mode 100644
index 0000000000000..f3b09fd28134d
--- /dev/null
+++ b/libcxx/include/__type_traits/arithmetic_traits.h
@@ -0,0 +1,226 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
+#define _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_cv.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// This trait is to determine whether a type is a /signed integer type/
+// See [basic.fundamental]/p1
+template <class _Tp>
+inline const bool __is_signed_integer_v = false;
+template <>
+inline const bool __is_signed_integer_v<signed char> = true;
+template <>
+inline const bool __is_signed_integer_v<signed short> = true;
+template <>
+inline const bool __is_signed_integer_v<signed int> = true;
+template <>
+inline const bool __is_signed_integer_v<signed long> = true;
+template <>
+inline const bool __is_signed_integer_v<signed long long> = true;
+#if _LIBCPP_HAS_INT128
+template <>
+inline const bool __is_signed_integer_v<__int128_t> = true;
+#endif
+
+// This trait is to determine whether a type is an /unsigned integer type/
+// See [basic.fundamental]/p2
+template <class _Tp>
+inline const bool __is_unsigned_integer_v = false;
+template <>
+inline const bool __is_unsigned_integer_v<unsigned char> = true;
+template <>
+inline const bool __is_unsigned_integer_v<unsigned short> = true;
+template <>
+inline const bool __is_unsigned_integer_v<unsigned int> = true;
+template <>
+inline const bool __is_unsigned_integer_v<unsigned long> = true;
+template <>
+inline const bool __is_unsigned_integer_v<unsigned long long> = true;
+#if _LIBCPP_HAS_INT128
+template <>
+inline const bool __is_unsigned_integer_v<__uint128_t> = true;
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+template <class _Tp>
+concept __signed_integer = __is_signed_integer_v<_Tp>;
+
+template <class _Tp>
+concept __unsigned_integer = __is_unsigned_integer_v<_Tp>;
+
+// This isn't called __integer, because an integer type according to [basic.fundamental]/p11 is the same as an integral
+// type. An integral type is _not_ the same set of types as signed and unsigned integer types combined.
+template <class _Tp>
+concept __signed_or_unsigned_integer = __signed_integer<_Tp> || __unsigned_integer<_Tp>;
+#endif
+
+// is_integral
+// This trait is to determine whether a type is an /integral type/ (a.k.a. /integer type/)
+// See [basic.fundamental]/p11
+
+#if __has_builtin(__is_integral)
+
+template <class _Tp>
+struct _LIBCPP_NO_SPECIALIZATIONS is_integral : _BoolConstant<__is_integral(_Tp)> {};
+
+#  if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_integral_v = __is_integral(_Tp);
+#  endif
+
+#else
+
+template <class _Tp>
+inline constexpr bool __is_integral_impl = __is_signed_integer_v<_Tp> || __is_unsigned_integer_v<_Tp>;
+
+template <>
+inline constexpr bool __is_integral_impl<bool> = true;
+
+template <>
+inline constexpr bool __is_integral_impl<char> = true;
+
+#  if _LIBCPP_HAS_WIDE_CHARACTERS
+template <>
+inline constexpr bool __is_integral_impl<wchar_t> = true;
+#  endif
+
+#  if _LIBCPP_HAS_CHAR8_T
+template <>
+inline constexpr bool __is_integral_impl<char8_t> = true;
+#  endif
+
+template <>
+inline constexpr bool __is_integral_impl<char16_t> = true;
+
+template <>
+inline constexpr bool __is_integral_impl<char32_t> = true;
+
+template <class _Tp>
+struct is_integral : integral_constant<bool, __is_integral_impl<__remove_cv_t<_Tp>>> {};
+
+#  if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+inline constexpr bool is_integral_v = __is_integral_impl<__remove_cv_t<_Tp>>;
+#  endif
+
+#endif // __has_builtin(__is_integral)
+
+// is_floating_point
+// This trait is to determine whether a type is a /floating-point type/
+// See [basic.fundamental]/p12
+
+// FIXME: This should use __is_floating_point once we're able to implement
+// numeric_limits for all of them (especially __float128)
+template <class>
+inline const bool __is_floating_point_impl = false;
+
+template <>
+inline const bool __is_floating_point_impl<float> = true;
+
+template <>
+inline const bool __is_floating_point_impl<double> = true;
+
+template <>
+inline const bool __is_floating_point_impl<long double> = true;
+
+template <class _Tp>
+struct _LIBCPP_NO_SPECIALIZATIONS is_floating_point
+    : integral_constant<bool, __is_floating_point_impl<__remove_cv_t<_Tp> > > {};
+
+#if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_floating_point_v = __is_floating_point_impl<remove_cv_t<_Tp>>;
+#endif
+
+// is_arithmetic
+// This trait is to determine whether a type is an /arithmetic type/
+// See [basic.fundamental]/p14
+
+template <class _Tp>
+struct _LIBCPP_NO_SPECIALIZATIONS is_arithmetic
+    : integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {};
+
+#if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_arithmetic_v = is_integral_v<_Tp> || is_floating_point_v<_Tp>;
+#endif
+
+// is_signed
+
+#if __has_builtin(__is_signed)
+
+template <class _Tp>
+struct _LIBCPP_NO_SPECIALIZATIONS is_signed : _BoolConstant<__is_signed(_Tp)> {};
+
+#  if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_signed_v = __is_signed(_Tp);
+#  endif
+
+#else // __has_builtin(__is_signed)
+
+template <class _Tp, bool = is_arithmetic<_Tp>::value>
+inline constexpr bool __is_signed_v = false;
+
+template <class _Tp>
+inline constexpr bool __is_signed_v<_Tp, true> = _Tp(-1) < _Tp(0);
+
+template <class _Tp>
+struct is_signed : integral_constant<bool, __is_signed_v<_Tp>> {};
+
+#  if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+inline constexpr bool is_signed_v = __is_signed_v<_Tp>;
+#  endif
+
+#endif // __has_builtin(__is_signed)
+
+// is_unsigned
+
+#if __has_builtin(__is_unsigned)
+
+template <class _Tp>
+struct _LIBCPP_NO_SPECIALIZATIONS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> {};
+
+#  if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unsigned_v = __is_unsigned(_Tp);
+#  endif
+
+#else // __has_builtin(__is_unsigned)
+
+template <class _Tp, bool = is_integral<_Tp>::value>
+inline constexpr bool __is_unsigned_v = false;
+
+template <class _Tp>
+inline constexpr bool __is_unsigned_v<_Tp, true> = _Tp(0) < _Tp(-1);
+
+template <class _Tp>
+struct is_unsigned : integral_constant<bool, __is_unsigned_v<_Tp>> {};
+
+#  if _LIBCPP_STD_VER >= 17
+template <class _Tp>
+inline constexpr bool is_unsigned_v = __is_unsigned_v<_Tp>;
+#  endif
+
+#endif // __has_builtin(__is_unsigned)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
diff --git a/libcxx/include/__type_traits/integer_traits.h b/libcxx/include/__type_traits/integer_traits.h
deleted file mode 100644
index fad502c44e301..0000000000000
--- a/libcxx/include/__type_traits/integer_traits.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
-#define _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// This trait is to determine whether a type is a /signed integer type/
-// See [basic.fundamental]/p1
-template <class _Tp>
-inline const bool __is_signed_integer_v = false;
-template <>
-inline const bool __is_signed_integer_v<signed char> = true;
-template <>
-inline const bool __is_signed_integer_v<signed short> = true;
-template <>
-inline const bool __is_signed_integer_v<signed int> = true;
-template <>
-inline const bool __is_signed_integer_v<signed long> = true;
-template <>
-inline const bool __is_signed_integer_v<signed long long> = true;
-#if _LIBCPP_HAS_INT128
-template <>
-inline const bool __is_signed_integer_v<__int128_t> = true;
-#endif
-
-// This trait is to determine whether a type is an /unsigned integer type/
-// See [basic.fundamental]/p2
-template <class _Tp>
-inline const bool __is_unsigned_integer_v = false;
-template <>
-inline const bool __is_unsigned_integer_v<unsigned char> = true;
-template <>
-inline const bool __is_unsigned_integer_v<unsigned short> = true;
-template <>
-inline const bool __is_unsigned_integer_v<unsigned int> = true;
-template <>
-inline const bool __is_unsigned_integer_v<unsigned long> = true;
-template <>
-inline const bool __is_unsigned_integer_v<unsigned long long> = true;
-#if _LIBCPP_HAS_INT128
-template <>
-inline const bool __is_unsigned_integer_v<__uint128_t> = true;
-#endif
-
-#if _LIBCPP_STD_VER >= 20
-template <class _Tp>
-concept __signed_integer = __is_signed_integer_v<_Tp>;
-
-template <class _Tp>
-concept __unsigned_integer = __is_unsigned_integer_v<_Tp>;
-
-// This isn't called __integer, because an integer type according to [basic.fundamental]/p11 is the same as an integral
-// type. An integral type is _not_ the same set of types as signed and unsigned integer types combined.
-template <class _Tp>
-concept __signed_or_unsigned_integer = __signed_integer<_Tp> || __unsigned_integer<_Tp>;
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_INTEGER_TRAITS_H
diff --git a/libcxx/include/__type_traits/is_always_bitcastable.h b/libcxx/include/__type_traits/is_always_bitcastable.h
index 044d2501669a8..b21f0f5c6140d 100644
--- a/libcxx/include/__type_traits/is_always_bitcastable.h
+++ b/libcxx/include/__type_traits/is_always_bitcastable.h
@@ -10,7 +10,7 @@
 #define _LIBCPP___TYPE_TRAITS_IS_ALWAYS_BITCASTABLE_H
 
 #include <__config>
-#include <__type_traits/is_integral.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/is_trivially_copyable.h>
 #include <__type_traits/remove_cv.h>
diff --git a/libcxx/include/__type_traits/is_arithmetic.h b/libcxx/include/__type_traits/is_arithmetic.h
deleted file mode 100644
index 0d5c29385f25d..0000000000000
--- a/libcxx/include/__type_traits/is_arithmetic.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_ARITHMETIC_H
-#define _LIBCPP___TYPE_TRAITS_IS_ARITHMETIC_H
-
-#include <__config>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/is_floating_point.h>
-#include <__type_traits/is_integral.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp>
-struct _LIBCPP_NO_SPECIALIZATIONS is_arithmetic
-    : integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {};
-
-#if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_ARITHMETIC_H
diff --git a/libcxx/include/__type_traits/is_equality_comparable.h b/libcxx/include/__type_traits/is_equality_comparable.h
index 3ee1839996bef..43df695dcb66b 100644
--- a/libcxx/include/__type_traits/is_equality_comparable.h
+++ b/libcxx/include/__type_traits/is_equality_comparable.h
@@ -10,11 +10,10 @@
 #define _LIBCPP___TYPE_TRAITS_IS_EQUALITY_COMPARABLE_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/is_same.h>
-#include <__type_traits/is_signed.h>
 #include <__type_traits/is_void.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/void_t.h>
diff --git a/libcxx/include/__type_traits/is_floating_point.h b/libcxx/include/__type_traits/is_floating_point.h
deleted file mode 100644
index b87363fe5b357..0000000000000
--- a/libcxx/include/__type_traits/is_floating_point.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H
-#define _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H
-
-#include <__config>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/remove_cv.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// clang-format off
-template <class _Tp> struct __libcpp_is_floating_point              : false_type {};
-template <>          struct __libcpp_is_floating_point<float>       : true_type {};
-template <>          struct __libcpp_is_floating_point<double>      : true_type {};
-template <>          struct __libcpp_is_floating_point<long double> : true_type {};
-// clang-format on
-
-template <class _Tp>
-struct _LIBCPP_NO_SPECIALIZATIONS is_floating_point : __libcpp_is_floating_point<__remove_cv_t<_Tp> > {};
-
-#if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
-#endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_FLOATING_POINT_H
diff --git a/libcxx/include/__type_traits/is_integral.h b/libcxx/include/__type_traits/is_integral.h
deleted file mode 100644
index 5a340965f0384..0000000000000
--- a/libcxx/include/__type_traits/is_integral.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H
-#define _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H
-
-#include <__config>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/remove_cv.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if __has_builtin(__is_integral)
-
-template <class _Tp>
-struct _LIBCPP_NO_SPECIALIZATIONS is_integral : _BoolConstant<__is_integral(_Tp)> {};
-
-#  if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_integral_v = __is_integral(_Tp);
-#  endif
-
-#else
-
-// clang-format off
-template <class _Tp> struct __libcpp_is_integral                     { enum { value = 0 }; };
-template <>          struct __libcpp_is_integral<bool>               { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<char>               { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<signed char>        { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<unsigned char>      { enum { value = 1 }; };
-#if _LIBCPP_HAS_WIDE_CHARACTERS
-template <>          struct __libcpp_is_integral<wchar_t>            { enum { value = 1 }; };
-#endif
-#if _LIBCPP_HAS_CHAR8_T
-template <>          struct __libcpp_is_integral<char8_t>            { enum { value = 1 }; };
-#endif
-template <>          struct __libcpp_is_integral<char16_t>           { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<char32_t>           { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<short>              { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<unsigned short>     { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<int>                { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<unsigned int>       { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<long>               { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<unsigned long>      { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<long long>          { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<unsigned long long> { enum { value = 1 }; };
-#if _LIBCPP_HAS_INT128
-template <>          struct __libcpp_is_integral<__int128_t>         { enum { value = 1 }; };
-template <>          struct __libcpp_is_integral<__uint128_t>        { enum { value = 1 }; };
-#endif
-// clang-format on
-
-template <class _Tp>
-struct is_integral : public _BoolConstant<__libcpp_is_integral<__remove_cv_t<_Tp> >::value> {};
-
-#  if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-inline constexpr bool is_integral_v = is_integral<_Tp>::value;
-#  endif
-
-#endif // __has_builtin(__is_integral)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_INTEGRAL_H
diff --git a/libcxx/include/__type_traits/is_scalar.h b/libcxx/include/__type_traits/is_scalar.h
index 4cf8c3948d9f0..05e6957f25a4b 100644
--- a/libcxx/include/__type_traits/is_scalar.h
+++ b/libcxx/include/__type_traits/is_scalar.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___TYPE_TRAITS_IS_SCALAR_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/integral_constant.h>
-#include <__type_traits/is_arithmetic.h>
 #include <__type_traits/is_enum.h>
 #include <__type_traits/is_member_pointer.h>
 #include <__type_traits/is_null_pointer.h>
diff --git a/libcxx/include/__type_traits/is_signed.h b/libcxx/include/__type_traits/is_signed.h
deleted file mode 100644
index 02f51f9cc9b19..0000000000000
--- a/libcxx/include/__type_traits/is_signed.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_SIGNED_H
-#define _LIBCPP___TYPE_TRAITS_IS_SIGNED_H
-
-#include <__config>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/is_arithmetic.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if __has_builtin(__is_signed)
-
-template <class _Tp>
-struct _LIBCPP_NO_SPECIALIZATIONS is_signed : _BoolConstant<__is_signed(_Tp)> {};
-
-#  if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_signed_v = __is_signed(_Tp);
-#  endif
-
-#else // __has_builtin(__is_signed)
-
-template <class _Tp, bool = is_arithmetic<_Tp>::value>
-inline constexpr bool __is_signed_v = false;
-
-template <class _Tp>
-inline constexpr bool __is_signed_v<_Tp, true> = _Tp(-1) < _Tp(0);
-
-template <class _Tp>
-struct is_signed : integral_constant<bool, __is_signed_v<_Tp>> {};
-
-#  if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-inline constexpr bool is_signed_v = __is_signed_v<_Tp>;
-#  endif
-
-#endif // __has_builtin(__is_signed)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_SIGNED_H
diff --git a/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h b/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h
index 15dda5824a362..18daeab6e4f58 100644
--- a/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h
+++ b/libcxx/include/__type_traits/is_trivially_lexicographically_comparable.h
@@ -11,9 +11,9 @@
 
 #include <__config>
 #include <__fwd/byte.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/integral_constant.h>
 #include <__type_traits/is_same.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/void_t.h>
 #include <__utility/declval.h>
diff --git a/libcxx/include/__type_traits/is_unsigned.h b/libcxx/include/__type_traits/is_unsigned.h
deleted file mode 100644
index b66027c8d7791..0000000000000
--- a/libcxx/include/__type_traits/is_unsigned.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TYPE_TRAITS_IS_UNSIGNED_H
-#define _LIBCPP___TYPE_TRAITS_IS_UNSIGNED_H
-
-#include <__config>
-#include <__type_traits/integral_constant.h>
-#include <__type_traits/is_integral.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#  pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if __has_builtin(__is_unsigned)
-
-template <class _Tp>
-struct _LIBCPP_NO_SPECIALIZATIONS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> {};
-
-#  if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unsigned_v = __is_unsigned(_Tp);
-#  endif
-
-#else // __has_builtin(__is_unsigned)
-
-template <class _Tp, bool = is_integral<_Tp>::value>
-inline constexpr bool __is_unsigned_v = false;
-
-template <class _Tp>
-inline constexpr bool __is_unsigned_v<_Tp, true> = _Tp(0) < _Tp(-1);
-
-template <class _Tp>
-struct is_unsigned : integral_constant<bool, __is_unsigned_v<_Tp>> {};
-
-#  if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-inline constexpr bool is_unsigned_v = __is_unsigned_v<_Tp>;
-#  endif
-
-#endif // __has_builtin(__is_unsigned)
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP___TYPE_TRAITS_IS_UNSIGNED_H
diff --git a/libcxx/include/__type_traits/make_32_64_or_128_bit.h b/libcxx/include/__type_traits/make_32_64_or_128_bit.h
index 7016209ec9c0a..9fd3293c27e6f 100644
--- a/libcxx/include/__type_traits/make_32_64_or_128_bit.h
+++ b/libcxx/include/__type_traits/make_32_64_or_128_bit.h
@@ -10,10 +10,9 @@
 #define _LIBCPP___TYPE_TRAITS_MAKE_32_64_OR_128_BIT_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/is_same.h>
-#include <__type_traits/is_signed.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/make_unsigned.h>
 #include <cstdint>
 
diff --git a/libcxx/include/__type_traits/make_signed.h b/libcxx/include/__type_traits/make_signed.h
index dff23d880dc30..3ebd1ba9c9879 100644
--- a/libcxx/include/__type_traits/make_signed.h
+++ b/libcxx/include/__type_traits/make_signed.h
@@ -10,9 +10,9 @@
 #define _LIBCPP___TYPE_TRAITS_MAKE_SIGNED_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/copy_cv.h>
 #include <__type_traits/is_enum.h>
-#include <__type_traits/is_integral.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/type_list.h>
 
diff --git a/libcxx/include/__type_traits/make_unsigned.h b/libcxx/include/__type_traits/make_unsigned.h
index a83baa658e294..1a3a4e1ea1b72 100644
--- a/libcxx/include/__type_traits/make_unsigned.h
+++ b/libcxx/include/__type_traits/make_unsigned.h
@@ -10,11 +10,10 @@
 #define _LIBCPP___TYPE_TRAITS_MAKE_UNSIGNED_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/copy_cv.h>
 #include <__type_traits/is_enum.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/remove_cv.h>
 #include <__type_traits/type_list.h>
 
diff --git a/libcxx/include/__type_traits/promote.h b/libcxx/include/__type_traits/promote.h
index 96b4903032b18..11eac94940725 100644
--- a/libcxx/include/__type_traits/promote.h
+++ b/libcxx/include/__type_traits/promote.h
@@ -10,8 +10,8 @@
 #define _LIBCPP___TYPE_TRAITS_PROMOTE_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_arithmetic.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/__utility/cmp.h b/libcxx/include/__utility/cmp.h
index 14dc0c154c040..2615982b5616d 100644
--- a/libcxx/include/__utility/cmp.h
+++ b/libcxx/include/__utility/cmp.h
@@ -10,8 +10,7 @@
 #define _LIBCPP___UTILITY_CMP_H
 
 #include <__config>
-#include <__type_traits/integer_traits.h>
-#include <__type_traits/is_signed.h>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/make_unsigned.h>
 #include <limits>
 
diff --git a/libcxx/include/__utility/convert_to_integral.h b/libcxx/include/__utility/convert_to_integral.h
index c8149b7744984..cc4d9f833fe22 100644
--- a/libcxx/include/__utility/convert_to_integral.h
+++ b/libcxx/include/__utility/convert_to_integral.h
@@ -10,9 +10,9 @@
 #define _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H
 
 #include <__config>
+#include <__type_traits/arithmetic_traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_enum.h>
-#include <__type_traits/is_floating_point.h>
 #include <__type_traits/underlying_type.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__utility/integer_sequence.h b/libcxx/include/__utility/integer_sequence.h
index d1c6e53c72131..3e06a01b3510a 100644
--- a/libcxx/include/__utility/integer_sequence.h
+++ b/libcxx/include/__utility/integer_sequence.h
@@ -11,7 +11,7 @@
 
 #include <__config>
 #include <__cstddef/size_t.h>
-#include <__type_traits/is_integral.h>
+#include <__type_traits/arithmetic_traits.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index bee743f702d01..5e09918bd4468 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -317,13 +317,10 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
 #else
 #  include <__config>
 #  include <__math/hypot.h>
+#  include <__type_traits/arithmetic_traits.h>
 #  include <__type_traits/enable_if.h>
-#  include <__type_traits/is_arithmetic.h>
-#  include <__type_traits/is_constant_evaluated.h>
-#  include <__type_traits/is_floating_point.h>
 #  include <__type_traits/is_same.h>
 #  include <__type_traits/promote.h>
-#  include <__type_traits/remove_cv.h>
 #  include <limits>
 #  include <version>
 
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 5046de27a9da1..a776ebc17d93e 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -233,6 +233,7 @@ template <class T, class Allocator, class Predicate>
 #  include <__type_traits/is_pointer.h>
 #  include <__type_traits/is_same.h>
 #  include <__type_traits/is_swappable.h>
+#  include <__type_traits/remove_cv.h>
 #  include <__type_traits/type_identity.h>
 #  include <__utility/forward.h>
 #  include <__utility/move.h>
diff --git a/libcxx/include/limits b/libcxx/include/limits
index f5d16523763b4..aa4d971025971 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -106,9 +106,7 @@ template<> class numeric_limits<cv long double>;
 #  include <__cxx03/limits>
 #else
 #  include <__config>
-#  include <__type_traits/is_arithmetic.h>
-#  include <__type_traits/is_signed.h>
-#  include <__type_traits/remove_cv.h>
+#  include <__type_traits/arithmetic_traits.h>
 
 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #    pragma GCC system_header
diff --git a/libcxx/include/math.h b/libcxx/include/math.h
index de2dacde282c1..3cb1ddcc3dc3f 100644
--- a/libcxx/include/math.h
+++ b/libcxx/include/math.h
@@ -377,9 +377,8 @@ extern "C++" {
 #      include <__math/rounding_functions.h>
 #      include <__math/traits.h>
 #      include <__math/trigonometric_functions.h>
+#      include <__type_traits/arithmetic_traits.h>
 #      include <__type_traits/enable_if.h>
-#      include <__type_traits/is_floating_point.h>
-#      include <__type_traits/is_integral.h>
 #      include <stdlib.h>
 
 // fpclassify relies on implementation-defined constants, so we can't move it to a detail header
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index f5fd970934e9b..bb24ae417104b 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -71,6 +71,10 @@ module std_core [system] {
     module aligned_storage                            { header "__type_traits/aligned_storage.h" }
     module aligned_union                              { header "__type_traits/aligned_union.h" }
     module alignment_of                               { header "__type_traits/alignment_of.h" }
+    module arithmetic_traits                          {
+      header "__type_traits/arithmetic_traits.h"
+      export std_core.type_traits.integral_constant
+    }
     module can_extract_key                            { header "__type_traits/can_extract_key.h" }
     module common_reference                           { header "__type_traits/common_reference.h" }
     module common_type {
@@ -94,7 +98,6 @@ module std_core [system] {
     module extent                                     { header "__type_traits/extent.h" }
     module has_unique_object_representation           { header "__type_traits/has_unique_object_representation.h" }
     module has_virtual_destructor                     { header "__type_traits/has_virtual_destructor.h" }
-    module integer_traits                             { header "__type_traits/integer_traits.h" }
     module integral_constant                          { header "__type_traits/integral_constant.h" }
     module invoke                                     { header "__type_traits/invoke.h" }
     module is_abstract {
@@ -113,10 +116,6 @@ module std_core [system] {
       header "__type_traits/is_always_bitcastable.h"
       export std_core.type_traits.integral_constant
     }
-    module is_arithmetic {
-      header "__type_traits/is_arithmetic.h"
-      export std_core.type_traits.integral_constant
-    }
     module is_array {
       header "__type_traits/is_array.h"
       export std_core.type_traits.integral_constant
@@ -193,10 +192,6 @@ module std_core [system] {
       header "__type_traits/is_final.h"
       export std_core.type_traits.integral_constant
     }
-    module is_floating_point {
-      header "__type_traits/is_floating_point.h"
-      export std_core.type_traits.integral_constant
-    }
     module is_function {
       header "__type_traits/is_function.h"
       export std_core.type_traits.integral_constant
@@ -213,10 +208,6 @@ module std_core [system] {
       header "__type_traits/is_implicitly_default_constructible.h"
       export std_core.type_traits.integral_constant
     }
-    module is_integral {
-      header "__type_traits/is_integral.h"
-      export std_core.type_traits.integral_constant
-    }
     module is_literal_type {
       header "__type_traits/is_literal_type.h"
       export std_core.type_traits.integral_constant
@@ -285,10 +276,6 @@ module std_core [system] {
       header "__type_traits/is_scalar.h"
       export std_core.type_traits.integral_constant
     }
-    module is_signed {
-      header "__type_traits/is_signed.h"
-      export std_core.type_traits.integral_constant
-    }
     module is_specialization {
       header "__type_traits/is_specialization.h"
       export std_core.type_traits.integral_constant
@@ -337,10 +324,6 @@ module std_core [system] {
       header "__type_traits/is_union.h"
       export std_core.type_traits.integral_constant
     }
-    module is_unsigned {
-      header "__type_traits/is_unsigned.h"
-      export std_core.type_traits.integral_constant
-    }
     module is_valid_expansion {
       header "__type_traits/is_valid_expansion.h"
       export std_core.type_traits.integral_constant
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 6e7a430d219ea..26af33acc7e40 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -240,7 +240,6 @@ template <class... Types>
 #  include <__type_traits/disjunction.h>
 #  include <__type_traits/enable_if.h>
 #  include <__type_traits/invoke.h>
-#  include <__type_traits/is_arithmetic.h>
 #  include <__type_traits/is_assignable.h>
 #  include <__type_traits/is_constructible.h>
 #  include <__type_traits/is_convertible.h>
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 9db7b2afb0cf3..2fbc0b1d32c57 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -469,6 +469,7 @@ namespace std
 #  include <__type_traits/aligned_storage.h>
 #  include <__type_traits/aligned_union.h>
 #  include <__type_traits/alignment_of.h>
+#  include <__type_traits/arithmetic_traits.h>
 #  include <__type_traits/common_type.h>
 #  include <__type_traits/conditional.h>
 #  include <__type_traits/decay.h>
@@ -477,7 +478,6 @@ namespace std
 #  include <__type_traits/has_virtual_destructor.h>
 #  include <__type_traits/integral_constant.h>
 #  include <__type_traits/is_abstract.h>
-#  include <__type_traits/is_arithmetic.h>
 #  include <__type_traits/is_array.h>
 #  include <__type_traits/is_assignable.h>
 #  include <__type_traits/is_base_of.h>
@@ -489,10 +489,8 @@ namespace std
 #  include <__type_traits/is_destructible.h>
 #  include <__type_traits/is_empty.h>
 #  include <__type_traits/is_enum.h>
-#  include <__type_traits/is_floating_point.h>
 #  include <__type_traits/is_function.h>
 #  include <__type_traits/is_fundamental.h>
-#  include <__type_traits/is_integral.h>
 #  include <__type_traits/is_literal_type.h>
 #  include <__type_traits/is_member_pointer.h>
 #  include <__type_traits/is_nothrow_assignable.h>
@@ -505,7 +503,6 @@ namespace std
 #  include <__type_traits/is_reference.h>
 #  include <__type_traits/is_same.h>
 #  include <__type_traits/is_scalar.h>
-#  include <__type_traits/is_signed.h>
 #  include <__type_traits/is_standard_layout.h>
 #  include <__type_traits/is_trivial.h>
 #  include <__type_traits/is_trivially_assignable.h>
@@ -513,7 +510,6 @@ namespace std
 #  include <__type_traits/is_trivially_copyable.h>
 #  include <__type_traits/is_trivially_destructible.h>
 #  include <__type_traits/is_union.h>
-#  include <__type_traits/is_unsigned.h>
 #  include <__type_traits/is_void.h>
 #  include <__type_traits/is_volatile.h>
 #  include <__type_traits/make_signed.h>
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index b7f333e5f1178..1d36ed50983e3 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -608,11 +608,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
 #  include <__ranges/concepts.h>
 #  include <__ranges/container_compatible_range.h>
 #  include <__ranges/from_range.h>
+#include <__type_traits/arithmetic_traits.h>
 #  include <__type_traits/container_traits.h>
 #  include <__type_traits/enable_if.h>
 #  include <__type_traits/invoke.h>
 #  include <__type_traits/is_allocator.h>
-#  include <__type_traits/is_integral.h>
 #  include <__type_traits/remove_const.h>
 #  include <__type_traits/type_identity.h>
 #  include <__utility/forward.h>



More information about the libcxx-commits mailing list