[libcxx-commits] [libcxx] e0a6611 - [libc++] Granularize <type_traits> includes in <compare>
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 22 17:58:13 PST 2022
Author: Nikolas Klauser
Date: 2022-12-23T02:58:06+01:00
New Revision: e0a66116fcccd59d12485810f5311efafa134ea5
URL: https://github.com/llvm/llvm-project/commit/e0a66116fcccd59d12485810f5311efafa134ea5
DIFF: https://github.com/llvm/llvm-project/commit/e0a66116fcccd59d12485810f5311efafa134ea5.diff
LOG: [libc++] Granularize <type_traits> includes in <compare>
Reviewed By: Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D140480
Added:
Modified:
libcxx/include/__algorithm/copy.h
libcxx/include/__algorithm/iterator_operations.h
libcxx/include/__algorithm/move.h
libcxx/include/__algorithm/ranges_iterator_concept.h
libcxx/include/__algorithm/unwrap_iter.h
libcxx/include/__bit/bit_cast.h
libcxx/include/__compare/compare_partial_order_fallback.h
libcxx/include/__compare/compare_strong_order_fallback.h
libcxx/include/__compare/compare_three_way_result.h
libcxx/include/__compare/compare_weak_order_fallback.h
libcxx/include/__compare/partial_order.h
libcxx/include/__compare/strong_order.h
libcxx/include/__compare/weak_order.h
libcxx/include/__functional/hash.h
libcxx/include/__functional/reference_wrapper.h
libcxx/include/__functional/weak_result_type.h
libcxx/include/__iterator/advance.h
libcxx/include/__iterator/concepts.h
libcxx/include/__iterator/distance.h
libcxx/include/__iterator/incrementable_traits.h
libcxx/include/__iterator/iter_move.h
libcxx/include/__iterator/iter_swap.h
libcxx/include/__iterator/iterator_traits.h
libcxx/include/__iterator/next.h
libcxx/include/__iterator/prev.h
libcxx/include/__iterator/readable_traits.h
libcxx/include/__iterator/reverse_iterator.h
libcxx/include/__memory/allocator.h
libcxx/include/__memory/allocator_arg_t.h
libcxx/include/__memory/allocator_traits.h
libcxx/include/__memory/assume_aligned.h
libcxx/include/__memory/compressed_pair.h
libcxx/include/__memory/concepts.h
libcxx/include/__memory/construct_at.h
libcxx/include/__memory/pointer_traits.h
libcxx/include/__memory/ranges_uninitialized_algorithms.h
libcxx/include/__memory/shared_ptr.h
libcxx/include/__memory/uninitialized_algorithms.h
libcxx/include/__memory/unique_ptr.h
libcxx/include/__memory/uses_allocator.h
libcxx/include/__ranges/access.h
libcxx/include/__ranges/concepts.h
libcxx/include/__ranges/dangling.h
libcxx/include/__ranges/data.h
libcxx/include/__ranges/empty.h
libcxx/include/__ranges/enable_view.h
libcxx/include/__ranges/size.h
libcxx/include/__ranges/subrange.h
libcxx/include/__ranges/view_interface.h
libcxx/include/__type_traits/is_trivially_destructible.h
libcxx/include/cmath
libcxx/include/compare
libcxx/include/condition_variable
libcxx/include/exception
libcxx/include/istream
libcxx/include/math.h
libcxx/include/module.modulemap.in
libcxx/include/mutex
libcxx/include/new
libcxx/include/ostream
libcxx/include/scoped_allocator
libcxx/include/valarray
libcxx/test/libcxx/numerics/numeric.ops/midpoint.integer.pass.cpp
libcxx/test/libcxx/transitive_includes/cxx03.csv
libcxx/test/libcxx/transitive_includes/cxx11.csv
libcxx/test/libcxx/transitive_includes/cxx14.csv
libcxx/test/libcxx/transitive_includes/cxx17.csv
libcxx/test/libcxx/transitive_includes/cxx20.csv
libcxx/test/libcxx/transitive_includes/cxx2b.csv
libcxx/test/std/language.support/support.dynamic/align_val_t.pass.cpp
libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.integer.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_construct.pass.cpp
libcxx/test/support/count_new.h
Removed:
################################################################################
diff --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h
index d6a46f69523a8..ed3004995741f 100644
--- a/libcxx/include/__algorithm/copy.h
+++ b/libcxx/include/__algorithm/copy.h
@@ -14,10 +14,15 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__iterator/reverse_iterator.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_trivially_copy_assignable.h>
+#include <__type_traits/is_trivially_copyable.h>
+#include <__type_traits/remove_const.h>
#include <__utility/move.h>
#include <__utility/pair.h>
#include <cstring>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/iterator_operations.h b/libcxx/include/__algorithm/iterator_operations.h
index bfe82c2028f32..bd3e6f1d38fd8 100644
--- a/libcxx/include/__algorithm/iterator_operations.h
+++ b/libcxx/include/__algorithm/iterator_operations.h
@@ -21,10 +21,13 @@
#include <__iterator/next.h>
#include <__iterator/prev.h>
#include <__iterator/readable_traits.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/remove_cvref.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/move.h b/libcxx/include/__algorithm/move.h
index e2f8b22800dbc..2109f9a081c44 100644
--- a/libcxx/include/__algorithm/move.h
+++ b/libcxx/include/__algorithm/move.h
@@ -14,10 +14,14 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__iterator/reverse_iterator.h>
+#include <__type_traits/is_constant_evaluated.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_trivially_copyable.h>
+#include <__type_traits/is_trivially_move_assignable.h>
+#include <__type_traits/remove_const.h>
#include <__utility/move.h>
#include <__utility/pair.h>
#include <cstring>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/ranges_iterator_concept.h b/libcxx/include/__algorithm/ranges_iterator_concept.h
index c2a508dc9a292..3ac6b317031a4 100644
--- a/libcxx/include/__algorithm/ranges_iterator_concept.h
+++ b/libcxx/include/__algorithm/ranges_iterator_concept.h
@@ -12,7 +12,7 @@
#include <__config>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits>
+#include <__type_traits/remove_cvref.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__algorithm/unwrap_iter.h b/libcxx/include/__algorithm/unwrap_iter.h
index 07d8d23e33c51..0f661e10a74d2 100644
--- a/libcxx/include/__algorithm/unwrap_iter.h
+++ b/libcxx/include/__algorithm/unwrap_iter.h
@@ -12,8 +12,10 @@
#include <__config>
#include <__iterator/iterator_traits.h>
#include <__memory/pointer_traits.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__utility/declval.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__bit/bit_cast.h b/libcxx/include/__bit/bit_cast.h
index 831207671ec90..2ca4120c7630f 100644
--- a/libcxx/include/__bit/bit_cast.h
+++ b/libcxx/include/__bit/bit_cast.h
@@ -11,7 +11,7 @@
#define _LIBCPP___BIT_BIT_CAST_H
#include <__config>
-#include <type_traits>
+#include <__type_traits/is_trivially_copyable.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__compare/compare_partial_order_fallback.h b/libcxx/include/__compare/compare_partial_order_fallback.h
index ba746d6c7d9c2..06f03fe7adeea 100644
--- a/libcxx/include/__compare/compare_partial_order_fallback.h
+++ b/libcxx/include/__compare/compare_partial_order_fallback.h
@@ -12,9 +12,10 @@
#include <__compare/ordering.h>
#include <__compare/partial_order.h>
#include <__config>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_same.h>
#include <__utility/forward.h>
#include <__utility/priority_tag.h>
-#include <type_traits>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
diff --git a/libcxx/include/__compare/compare_strong_order_fallback.h b/libcxx/include/__compare/compare_strong_order_fallback.h
index 312a08ef7e900..869386817a121 100644
--- a/libcxx/include/__compare/compare_strong_order_fallback.h
+++ b/libcxx/include/__compare/compare_strong_order_fallback.h
@@ -12,9 +12,10 @@
#include <__compare/ordering.h>
#include <__compare/strong_order.h>
#include <__config>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_same.h>
#include <__utility/forward.h>
#include <__utility/priority_tag.h>
-#include <type_traits>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
diff --git a/libcxx/include/__compare/compare_three_way_result.h b/libcxx/include/__compare/compare_three_way_result.h
index 3047f5bd2a3c1..e668cdb24d935 100644
--- a/libcxx/include/__compare/compare_three_way_result.h
+++ b/libcxx/include/__compare/compare_three_way_result.h
@@ -11,7 +11,7 @@
#include <__config>
#include <__type_traits/make_const_lvalue_ref.h>
-#include <type_traits>
+#include <__utility/declval.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__compare/compare_weak_order_fallback.h b/libcxx/include/__compare/compare_weak_order_fallback.h
index 844d676087032..f434dcb4a31ad 100644
--- a/libcxx/include/__compare/compare_weak_order_fallback.h
+++ b/libcxx/include/__compare/compare_weak_order_fallback.h
@@ -12,9 +12,10 @@
#include <__compare/ordering.h>
#include <__compare/weak_order.h>
#include <__config>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_same.h>
#include <__utility/forward.h>
#include <__utility/priority_tag.h>
-#include <type_traits>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
diff --git a/libcxx/include/__compare/partial_order.h b/libcxx/include/__compare/partial_order.h
index 970f01b3f1b04..a787bde0a4642 100644
--- a/libcxx/include/__compare/partial_order.h
+++ b/libcxx/include/__compare/partial_order.h
@@ -13,9 +13,10 @@
#include <__compare/ordering.h>
#include <__compare/weak_order.h>
#include <__config>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_same.h>
#include <__utility/forward.h>
#include <__utility/priority_tag.h>
-#include <type_traits>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
diff --git a/libcxx/include/__compare/strong_order.h b/libcxx/include/__compare/strong_order.h
index 67c7b2910bd5e..86866912b4c88 100644
--- a/libcxx/include/__compare/strong_order.h
+++ b/libcxx/include/__compare/strong_order.h
@@ -13,12 +13,13 @@
#include <__compare/compare_three_way.h>
#include <__compare/ordering.h>
#include <__config>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
#include <__utility/forward.h>
#include <__utility/priority_tag.h>
#include <cmath>
#include <cstdint>
#include <limits>
-#include <type_traits>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
diff --git a/libcxx/include/__compare/weak_order.h b/libcxx/include/__compare/weak_order.h
index c2fae1a98deb4..9d5819d30544c 100644
--- a/libcxx/include/__compare/weak_order.h
+++ b/libcxx/include/__compare/weak_order.h
@@ -13,10 +13,10 @@
#include <__compare/ordering.h>
#include <__compare/strong_order.h>
#include <__config>
+#include <__type_traits/decay.h>
#include <__utility/forward.h>
#include <__utility/priority_tag.h>
#include <cmath>
-#include <type_traits>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index 64412fc9f6a86..6a6d6e79c2287 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -10,9 +10,15 @@
#define _LIBCPP___FUNCTIONAL_HASH_H
#include <__config>
+#include <__functional/invoke.h>
#include <__functional/unary_function.h>
#include <__fwd/hash.h>
#include <__tuple_dir/sfinae_helpers.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_default_constructible.h>
+#include <__type_traits/is_enum.h>
+#include <__type_traits/is_move_constructible.h>
+#include <__type_traits/underlying_type.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/pair.h>
@@ -21,7 +27,6 @@
#include <cstdint>
#include <cstring>
#include <limits>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h
index 6659825818788..481fe293b0cd3 100644
--- a/libcxx/include/__functional/reference_wrapper.h
+++ b/libcxx/include/__functional/reference_wrapper.h
@@ -11,10 +11,13 @@
#define _LIBCPP___FUNCTIONAL_REFERENCE_WRAPPER_H
#include <__config>
+#include <__functional/invoke.h>
#include <__functional/weak_result_type.h>
#include <__memory/addressof.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/remove_cvref.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__functional/weak_result_type.h b/libcxx/include/__functional/weak_result_type.h
index 96d8cf7146b11..6bfcbbfdd62b0 100644
--- a/libcxx/include/__functional/weak_result_type.h
+++ b/libcxx/include/__functional/weak_result_type.h
@@ -12,8 +12,11 @@
#include <__config>
#include <__functional/binary_function.h>
+#include <__functional/invoke.h>
#include <__functional/unary_function.h>
-#include <type_traits>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_same.h>
+#include <__utility/declval.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h
index cd6353e65e86a..2f6a72e83f48a 100644
--- a/libcxx/include/__iterator/advance.h
+++ b/libcxx/include/__iterator/advance.h
@@ -17,12 +17,14 @@
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_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 <cstdlib>
#include <limits>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/concepts.h b/libcxx/include/__iterator/concepts.h
index 246f84c7cf53d..d9d40a4249f48 100644
--- a/libcxx/include/__iterator/concepts.h
+++ b/libcxx/include/__iterator/concepts.h
@@ -26,13 +26,19 @@
#include <__concepts/semiregular.h>
#include <__concepts/totally_ordered.h>
#include <__config>
+#include <__functional/invoke.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iter_move.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/readable_traits.h>
#include <__memory/pointer_traits.h>
+#include <__type_traits/add_pointer.h>
+#include <__type_traits/common_reference.h>
+#include <__type_traits/is_pointer.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_cv.h>
+#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/distance.h b/libcxx/include/__iterator/distance.h
index 32e41331f68c5..681e20d045b73 100644
--- a/libcxx/include/__iterator/distance.h
+++ b/libcxx/include/__iterator/distance.h
@@ -17,7 +17,8 @@
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/size.h>
-#include <type_traits>
+#include <__type_traits/decay.h>
+#include <__type_traits/remove_cvref.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/incrementable_traits.h b/libcxx/include/__iterator/incrementable_traits.h
index 6f966ec4c7484..eb1b2469378b4 100644
--- a/libcxx/include/__iterator/incrementable_traits.h
+++ b/libcxx/include/__iterator/incrementable_traits.h
@@ -12,9 +12,13 @@
#include <__concepts/arithmetic.h>
#include <__config>
+#include <__type_traits/conditional.h>
+#include <__type_traits/is_object.h>
#include <__type_traits/is_primary_template.h>
+#include <__type_traits/make_signed.h>
+#include <__type_traits/remove_cvref.h>
+#include <__utility/declval.h>
#include <cstddef>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/iter_move.h b/libcxx/include/__iterator/iter_move.h
index d8240ab9c2f12..0d611bb4a8667 100644
--- a/libcxx/include/__iterator/iter_move.h
+++ b/libcxx/include/__iterator/iter_move.h
@@ -13,9 +13,11 @@
#include <__concepts/class_or_enum.h>
#include <__config>
#include <__iterator/iterator_traits.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_cvref.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/iter_swap.h b/libcxx/include/__iterator/iter_swap.h
index 78152e2d9aad6..e5e22dd8c3bbb 100644
--- a/libcxx/include/__iterator/iter_swap.h
+++ b/libcxx/include/__iterator/iter_swap.h
@@ -17,9 +17,10 @@
#include <__iterator/iter_move.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/readable_traits.h>
+#include <__type_traits/remove_cvref.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h
index b4cf07233296d..ebb7fdc5bd287 100644
--- a/libcxx/include/__iterator/iterator_traits.h
+++ b/libcxx/include/__iterator/iterator_traits.h
@@ -21,8 +21,21 @@
#include <__fwd/pair.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/readable_traits.h>
+#include <__type_traits/add_const.h>
+#include <__type_traits/common_reference.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/disjunction.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_object.h>
+#include <__type_traits/is_primary_template.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/is_valid_expansion.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_cv.h>
+#include <__type_traits/remove_cvref.h>
+#include <__type_traits/void_t.h>
+#include <__utility/declval.h>
#include <cstddef>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/next.h b/libcxx/include/__iterator/next.h
index bdaaa83d9e426..49970ae248081 100644
--- a/libcxx/include/__iterator/next.h
+++ b/libcxx/include/__iterator/next.h
@@ -16,7 +16,7 @@
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits>
+#include <__type_traits/enable_if.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/prev.h b/libcxx/include/__iterator/prev.h
index 8955abcddaaaf..af1e1bab115b1 100644
--- a/libcxx/include/__iterator/prev.h
+++ b/libcxx/include/__iterator/prev.h
@@ -16,7 +16,7 @@
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_traits.h>
-#include <type_traits>
+#include <__type_traits/enable_if.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/readable_traits.h b/libcxx/include/__iterator/readable_traits.h
index dc818d8a230e7..8f17757c5a3d2 100644
--- a/libcxx/include/__iterator/readable_traits.h
+++ b/libcxx/include/__iterator/readable_traits.h
@@ -12,7 +12,13 @@
#include <__concepts/same_as.h>
#include <__config>
-#include <type_traits>
+#include <__type_traits/conditional.h>
+#include <__type_traits/is_array.h>
+#include <__type_traits/is_object.h>
+#include <__type_traits/is_primary_template.h>
+#include <__type_traits/remove_cv.h>
+#include <__type_traits/remove_cvref.h>
+#include <__type_traits/remove_extent.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__iterator/reverse_iterator.h b/libcxx/include/__iterator/reverse_iterator.h
index 2933a29fc8417..299b971791b73 100644
--- a/libcxx/include/__iterator/reverse_iterator.h
+++ b/libcxx/include/__iterator/reverse_iterator.h
@@ -29,8 +29,15 @@
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/subrange.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_assignable.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_nothrow_copy_constructible.h>
+#include <__type_traits/is_pointer.h>
+#include <__type_traits/is_same.h>
+#include <__utility/declval.h>
#include <__utility/move.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index 7a930959a1428..54c9b78d524d3 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -13,11 +13,14 @@
#include <__config>
#include <__memory/allocate_at_least.h>
#include <__memory/allocator_traits.h>
+#include <__type_traits/is_constant_evaluated.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/is_volatile.h>
#include <__utility/forward.h>
#include <cstddef>
#include <new>
#include <stdexcept>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/allocator_arg_t.h b/libcxx/include/__memory/allocator_arg_t.h
index 44df046ed7894..15f8c98c4c90c 100644
--- a/libcxx/include/__memory/allocator_arg_t.h
+++ b/libcxx/include/__memory/allocator_arg_t.h
@@ -12,8 +12,10 @@
#include <__config>
#include <__memory/uses_allocator.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_constructible.h>
+#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index 6acc14aa23771..348d16cc5f4f0 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -13,9 +13,16 @@
#include <__config>
#include <__memory/construct_at.h>
#include <__memory/pointer_traits.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_empty.h>
+#include <__type_traits/is_move_constructible.h>
+#include <__type_traits/make_unsigned.h>
+#include <__type_traits/remove_reference.h>
+#include <__type_traits/void_t.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
#include <limits>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/assume_aligned.h b/libcxx/include/__memory/assume_aligned.h
index 0f12fb11fd862..a1fd2441f9a91 100644
--- a/libcxx/include/__memory/assume_aligned.h
+++ b/libcxx/include/__memory/assume_aligned.h
@@ -12,9 +12,9 @@
#include <__assert>
#include <__config>
+#include <__type_traits/is_constant_evaluated.h>
#include <cstddef>
#include <cstdint>
-#include <type_traits> // for is_constant_evaluated()
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index 6f747e78bfad2..8093d7c93156d 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -14,11 +14,18 @@
#include <__fwd/get.h>
#include <__fwd/tuple.h>
#include <__tuple_dir/tuple_indices.h>
+#include <__type_traits/decay.h>
#include <__type_traits/dependent_type.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_default_constructible.h>
+#include <__type_traits/is_empty.h>
+#include <__type_traits/is_final.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_swappable.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/piecewise_construct.h>
-#include <type_traits>
+#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/concepts.h b/libcxx/include/__memory/concepts.h
index 76d2a2e729d61..12d7bf85ed94b 100644
--- a/libcxx/include/__memory/concepts.h
+++ b/libcxx/include/__memory/concepts.h
@@ -17,7 +17,8 @@
#include <__iterator/readable_traits.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
-#include <type_traits>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_cvref.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/construct_at.h b/libcxx/include/__memory/construct_at.h
index a11a6ebe44a50..7f13b26ac41c8 100644
--- a/libcxx/include/__memory/construct_at.h
+++ b/libcxx/include/__memory/construct_at.h
@@ -15,10 +15,12 @@
#include <__iterator/access.h>
#include <__memory/addressof.h>
#include <__memory/voidify.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_array.h>
+#include <__utility/declval.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <new>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index fd526471781b3..67f83f82a01ee 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -12,8 +12,15 @@
#include <__config>
#include <__memory/addressof.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_class.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/void_t.h>
+#include <__utility/declval.h>
#include <cstddef>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/libcxx/include/__memory/ranges_uninitialized_algorithms.h
index 7d2ac3af035d5..07abdc9c3f409 100644
--- a/libcxx/include/__memory/ranges_uninitialized_algorithms.h
+++ b/libcxx/include/__memory/ranges_uninitialized_algorithms.h
@@ -23,9 +23,9 @@
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/dangling.h>
+#include <__type_traits/remove_reference.h>
#include <__utility/move.h>
#include <new>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index 57051dfde3027..f8b9ee2bccdca 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -37,7 +37,6 @@
#include <iosfwd>
#include <new>
#include <stdexcept>
-#include <type_traits>
#include <typeinfo>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
diff --git a/libcxx/include/__memory/uninitialized_algorithms.h b/libcxx/include/__memory/uninitialized_algorithms.h
index 22f96d4e05eb2..213428bc7a18b 100644
--- a/libcxx/include/__memory/uninitialized_algorithms.h
+++ b/libcxx/include/__memory/uninitialized_algorithms.h
@@ -20,12 +20,21 @@
#include <__memory/construct_at.h>
#include <__memory/pointer_traits.h>
#include <__memory/voidify.h>
+#include <__type_traits/extent.h>
+#include <__type_traits/is_array.h>
#include <__type_traits/is_constant_evaluated.h>
+#include <__type_traits/is_trivially_copy_assignable.h>
+#include <__type_traits/is_trivially_copy_constructible.h>
+#include <__type_traits/is_trivially_move_assignable.h>
+#include <__type_traits/is_trivially_move_constructible.h>
+#include <__type_traits/is_unbounded_array.h>
+#include <__type_traits/negation.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_extent.h>
#include <__utility/move.h>
#include <__utility/pair.h>
#include <__utility/transaction.h>
#include <new>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 9fed6197a1fdd..bb5399d78fc40 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -19,10 +19,26 @@
#include <__memory/allocator_traits.h> // __pointer
#include <__memory/auto_ptr.h>
#include <__memory/compressed_pair.h>
+#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/common_type.h>
+#include <__type_traits/dependent_type.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_array.h>
+#include <__type_traits/is_assignable.h>
+#include <__type_traits/is_constructible.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_default_constructible.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_pointer.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_swappable.h>
+#include <__type_traits/is_void.h>
+#include <__type_traits/remove_extent.h>
+#include <__type_traits/type_identity.h>
#include <__utility/forward.h>
#include <__utility/move.h>
#include <cstddef>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__memory/uses_allocator.h b/libcxx/include/__memory/uses_allocator.h
index 4a07a4a521219..fe89704027a0f 100644
--- a/libcxx/include/__memory/uses_allocator.h
+++ b/libcxx/include/__memory/uses_allocator.h
@@ -11,8 +11,8 @@
#define _LIBCPP___MEMORY_USES_ALLOCATOR_H
#include <__config>
+#include <__type_traits/is_convertible.h>
#include <cstddef>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h
index 87392a163ecad..29babf38a611f 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -15,8 +15,13 @@
#include <__iterator/concepts.h>
#include <__iterator/readable_traits.h>
#include <__ranges/enable_borrowed_range.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_cvref.h>
+#include <__type_traits/remove_reference.h>
#include <__utility/auto_cast.h>
-#include <type_traits>
+#include <__utility/declval.h>
+#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/concepts.h b/libcxx/include/__ranges/concepts.h
index 739e14184a79a..730b83cde2df1 100644
--- a/libcxx/include/__ranges/concepts.h
+++ b/libcxx/include/__ranges/concepts.h
@@ -24,8 +24,12 @@
#include <__ranges/enable_borrowed_range.h>
#include <__ranges/enable_view.h>
#include <__ranges/size.h>
+#include <__type_traits/add_pointer.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_cvref.h>
+#include <__type_traits/remove_reference.h>
+#include <__utility/declval.h>
#include <initializer_list>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/dangling.h b/libcxx/include/__ranges/dangling.h
index 525b5ff0aabed..c10453454dc3d 100644
--- a/libcxx/include/__ranges/dangling.h
+++ b/libcxx/include/__ranges/dangling.h
@@ -13,7 +13,7 @@
#include <__config>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
-#include <type_traits>
+#include <__type_traits/conditional.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/data.h b/libcxx/include/__ranges/data.h
index cadbfc8cf3ba3..0ac25b52c7277 100644
--- a/libcxx/include/__ranges/data.h
+++ b/libcxx/include/__ranges/data.h
@@ -16,8 +16,13 @@
#include <__iterator/iterator_traits.h>
#include <__memory/pointer_traits.h>
#include <__ranges/access.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_object.h>
+#include <__type_traits/is_pointer.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_pointer.h>
+#include <__type_traits/remove_reference.h>
#include <__utility/auto_cast.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/empty.h b/libcxx/include/__ranges/empty.h
index 2370f1373cd65..8a1c75c0bae02 100644
--- a/libcxx/include/__ranges/empty.h
+++ b/libcxx/include/__ranges/empty.h
@@ -15,7 +15,6 @@
#include <__iterator/concepts.h>
#include <__ranges/access.h>
#include <__ranges/size.h>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/enable_view.h b/libcxx/include/__ranges/enable_view.h
index 2dc4752ff428f..c85064b915ab7 100644
--- a/libcxx/include/__ranges/enable_view.h
+++ b/libcxx/include/__ranges/enable_view.h
@@ -13,7 +13,9 @@
#include <__concepts/derived_from.h>
#include <__concepts/same_as.h>
#include <__config>
-#include <type_traits>
+#include <__type_traits/is_class.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/remove_cv.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/size.h b/libcxx/include/__ranges/size.h
index 720e3d4fd2206..4068a21bb585c 100644
--- a/libcxx/include/__ranges/size.h
+++ b/libcxx/include/__ranges/size.h
@@ -16,9 +16,12 @@
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/access.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/make_signed.h>
+#include <__type_traits/make_unsigned.h>
+#include <__type_traits/remove_cvref.h>
#include <__utility/auto_cast.h>
#include <cstddef>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h
index 55689fe42d536..f47db6b843f0a 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -30,8 +30,15 @@
#include <__ranges/view_interface.h>
#include <__tuple_dir/tuple_element.h>
#include <__tuple_dir/tuple_size.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_pointer.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/make_unsigned.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_pointer.h>
#include <__utility/move.h>
-#include <type_traits>
+#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__ranges/view_interface.h b/libcxx/include/__ranges/view_interface.h
index b706c8d2580a5..5581eb9c732a6 100644
--- a/libcxx/include/__ranges/view_interface.h
+++ b/libcxx/include/__ranges/view_interface.h
@@ -21,7 +21,9 @@
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/empty.h>
-#include <type_traits>
+#include <__type_traits/is_class.h>
+#include <__type_traits/make_unsigned.h>
+#include <__type_traits/remove_cv.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__type_traits/is_trivially_destructible.h b/libcxx/include/__type_traits/is_trivially_destructible.h
index 6639e29af59ad..0239fca54d7fa 100644
--- a/libcxx/include/__type_traits/is_trivially_destructible.h
+++ b/libcxx/include/__type_traits/is_trivially_destructible.h
@@ -11,6 +11,7 @@
#include <__config>
#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_destructible.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index ed88fe8da219a..fd242e12f0638 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -306,7 +306,11 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
-#include <type_traits>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_arithmetic.h>
+#include <__type_traits/is_floating_point.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/remove_cv.h>
#include <version>
#include <math.h>
@@ -669,4 +673,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <type_traits>
+#endif
+
#endif // _LIBCPP_CMATH
diff --git a/libcxx/include/compare b/libcxx/include/compare
index 6aa1abefd3efb..9272dbf62b14c 100644
--- a/libcxx/include/compare
+++ b/libcxx/include/compare
@@ -160,4 +160,8 @@ namespace std {
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <type_traits>
+#endif
+
#endif // _LIBCPP_COMPARE
diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable
index 6b4d506939e16..f13df1c012fa9 100644
--- a/libcxx/include/condition_variable
+++ b/libcxx/include/condition_variable
@@ -270,6 +270,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <type_traits>
#endif
#endif // _LIBCPP_CONDITION_VARIABLE
diff --git a/libcxx/include/exception b/libcxx/include/exception
index 98b355f9bdd98..e0f42682b5792 100644
--- a/libcxx/include/exception
+++ b/libcxx/include/exception
@@ -80,9 +80,15 @@ template <class E> void rethrow_if_nested(const E& e);
#include <__availability>
#include <__config>
#include <__memory/addressof.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_base_of.h>
+#include <__type_traits/is_class.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_final.h>
+#include <__type_traits/is_polymorphic.h>
#include <cstddef>
#include <cstdlib>
-#include <type_traits>
#include <version>
// <vcruntime_exception.h> defines its own std::exception and std::bad_exception types,
@@ -371,4 +377,8 @@ rethrow_if_nested(const _Ep&,
} // namespace std
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <type_traits>
+#endif
+
#endif // _LIBCPP_EXCEPTION
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 1c9adcc0c6297..37ba09b63187f 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -1639,6 +1639,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
+# include <type_traits>
#endif
_LIBCPP_POP_MACROS
diff --git a/libcxx/include/math.h b/libcxx/include/math.h
index ac55983bb0169..dd688307b6dd0 100644
--- a/libcxx/include/math.h
+++ b/libcxx/include/math.h
@@ -307,10 +307,13 @@ long double truncl(long double x);
// back to C++ linkage before including these C++ headers.
extern "C++" {
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_floating_point.h>
+#include <__type_traits/is_integral.h>
+#include <__type_traits/is_same.h>
#include <__type_traits/promote.h>
#include <limits>
#include <stdlib.h>
-#include <type_traits>
# ifdef fpclassify
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 467f7580b66f7..bff3f7e48dae8 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1391,7 +1391,10 @@ module std [system] {
private header "__type_traits/is_arithmetic.h"
export integral_constant
}
- module is_array { private header "__type_traits/is_array.h" }
+ module is_array {
+ private header "__type_traits/is_array.h"
+ export integral_constant
+ }
module is_assignable { private header "__type_traits/is_assignable.h" }
module is_base_of { private header "__type_traits/is_base_of.h" }
module is_bounded_array { private header "__type_traits/is_bounded_array.h" }
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index d11ffb20eff93..51c1a230dc082 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -706,6 +706,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
# include <functional>
+# include <type_traits>
#endif
#endif // _LIBCPP_MUTEX
diff --git a/libcxx/include/new b/libcxx/include/new
index 892ab7a8c2a40..ddba2d971eae9 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -89,10 +89,12 @@ void operator delete[](void* ptr, void*) noexcept;
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__config>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/remove_cv.h>
#include <cstddef>
#include <cstdlib>
#include <exception>
-#include <type_traits>
#include <version>
#if defined(_LIBCPP_ABI_VCRUNTIME)
@@ -401,4 +403,8 @@ inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUC
_LIBCPP_END_NAMESPACE_STD
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <type_traits>
+#endif
+
#endif // _LIBCPP_NEW
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 1d943d8a8abd2..5e2099b236117 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -1191,6 +1191,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
# include <iterator>
+# include <type_traits>
#endif
#endif // _LIBCPP_OSTREAM
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index f89db7bb18c71..d450f4f9e443b 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -725,6 +725,7 @@ _LIBCPP_END_NAMESPACE_STD
# include <memory>
# include <ratio>
# include <stdexcept>
+# include <type_traits>
# include <variant>
#endif
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 6c33d0531cb88..11a273d993a18 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -353,6 +353,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <__functional/operations.h>
#include <__memory/allocator.h>
#include <__memory/uninitialized_algorithms.h>
+#include <__type_traits/remove_reference.h>
#include <__utility/move.h>
#include <__utility/swap.h>
#include <cmath>
diff --git a/libcxx/test/libcxx/numerics/numeric.ops/midpoint.integer.pass.cpp b/libcxx/test/libcxx/numerics/numeric.ops/midpoint.integer.pass.cpp
index ea9b10ed473ed..054a682dc328f 100644
--- a/libcxx/test/libcxx/numerics/numeric.ops/midpoint.integer.pass.cpp
+++ b/libcxx/test/libcxx/numerics/numeric.ops/midpoint.integer.pass.cpp
@@ -13,9 +13,11 @@
// _Tp midpoint(_Tp __a, _Tp __b) noexcept
//
-#include <numeric>
#include <cassert>
+#include <cstddef>
#include <cstdint>
+#include <numeric>
+
#include "test_macros.h"
// Users are not supposed to provide template argument lists for
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index f655f144ba127..59ce001634445 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -207,7 +207,6 @@ expected cstdlib
expected exception
expected initializer_list
expected new
-expected type_traits
expected version
experimental/algorithm algorithm
experimental/algorithm cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 33aa5f8789b90..dc68a6a7fcbe8 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -207,7 +207,6 @@ expected cstdlib
expected exception
expected initializer_list
expected new
-expected type_traits
expected version
experimental/algorithm algorithm
experimental/algorithm cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index f5571400845b5..e517a60deebba 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -207,7 +207,6 @@ expected cstdlib
expected exception
expected initializer_list
expected new
-expected type_traits
expected version
experimental/algorithm algorithm
experimental/algorithm cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index f5571400845b5..e517a60deebba 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -207,7 +207,6 @@ expected cstdlib
expected exception
expected initializer_list
expected new
-expected type_traits
expected version
experimental/algorithm algorithm
experimental/algorithm cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index f2f4c96b14f19..c1aeb504bd0a9 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -219,7 +219,6 @@ expected cstdlib
expected exception
expected initializer_list
expected new
-expected type_traits
expected version
experimental/algorithm algorithm
experimental/algorithm cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx2b.csv b/libcxx/test/libcxx/transitive_includes/cxx2b.csv
index 084730e91a235..61706cd1e4c16 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx2b.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx2b.csv
@@ -100,7 +100,6 @@ chrono tuple
chrono type_traits
chrono version
cinttypes cstdint
-cmath type_traits
cmath version
codecvt cctype
codecvt cstddef
@@ -113,7 +112,6 @@ compare cmath
compare cstddef
compare cstdint
compare limits
-compare type_traits
compare version
complex cmath
complex iosfwd
@@ -135,7 +133,6 @@ condition_variable new
condition_variable ratio
condition_variable stdexcept
condition_variable system_error
-condition_variable type_traits
condition_variable typeinfo
condition_variable version
coroutine compare
@@ -164,7 +161,6 @@ deque type_traits
deque version
exception cstddef
exception cstdlib
-exception type_traits
exception version
execution version
expected cstddef
@@ -172,7 +168,6 @@ expected cstdlib
expected exception
expected initializer_list
expected new
-expected type_traits
expected version
experimental/algorithm algorithm
experimental/algorithm cstddef
@@ -364,7 +359,6 @@ iostream version
istream cstddef
istream iosfwd
istream ostream
-istream type_traits
istream version
iterator compare
iterator concepts
@@ -432,7 +426,6 @@ memory limits
memory new
memory stdexcept
memory tuple
-memory type_traits
memory typeinfo
memory version
memory_resource cstddef
@@ -456,13 +449,11 @@ mutex ratio
mutex stdexcept
mutex system_error
mutex tuple
-mutex type_traits
mutex typeinfo
mutex version
new cstddef
new cstdlib
new exception
-new type_traits
new version
numbers type_traits
numbers version
@@ -495,7 +486,6 @@ ostream locale
ostream new
ostream stdexcept
ostream streambuf
-ostream type_traits
ostream typeinfo
ostream version
queue compare
@@ -557,7 +547,6 @@ scoped_allocator cstddef
scoped_allocator limits
scoped_allocator new
scoped_allocator tuple
-scoped_allocator type_traits
scoped_allocator version
semaphore atomic
semaphore ctime
diff --git a/libcxx/test/std/language.support/support.dynamic/align_val_t.pass.cpp b/libcxx/test/std/language.support/support.dynamic/align_val_t.pass.cpp
index 8a5dc4cc28859..a592fbae3c37e 100644
--- a/libcxx/test/std/language.support/support.dynamic/align_val_t.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/align_val_t.pass.cpp
@@ -15,6 +15,7 @@
// UNSUPPORTED: target={{.+}}-zos{{.*}}
#include <new>
+#include <type_traits>
#include "test_macros.h"
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.integer.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.integer.pass.cpp
index 5e0b48be13e4b..599b32848531b 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.integer.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.integer.pass.cpp
@@ -17,6 +17,7 @@
#include <limits>
#include <numeric>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
template <typename T>
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_construct.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_construct.pass.cpp
index 1450382823733..3fa4ce7622c54 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_construct.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_construct.pass.cpp
@@ -21,6 +21,7 @@
#include "test_macros.h"
#include <cassert>
+#include <cstdint>
#include <memory>
#include <new>
#include <utility>
diff --git a/libcxx/test/support/count_new.h b/libcxx/test/support/count_new.h
index 645062a01446d..fc53cd6f0ab47 100644
--- a/libcxx/test/support/count_new.h
+++ b/libcxx/test/support/count_new.h
@@ -12,6 +12,7 @@
# include <cstdlib>
# include <cassert>
# include <new>
+#include <type_traits>
#include "test_macros.h"
More information about the libcxx-commits
mailing list