[libc++] Granularize <type_traits> includes in <bit>, <numbers> and <coroutine>
authorNikolas Klauser <nikolasklauser@berlin.de>
Thu, 22 Dec 2022 23:23:30 +0000 (00:23 +0100)
committerNikolas Klauser <nikolasklauser@berlin.de>
Sat, 21 Jan 2023 14:09:21 +0000 (15:09 +0100)
`<coroutine>` seems to be new enough to not be a huge problem.

Reviewed By: Mordante, #libc

Spies: libcxx-commits, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D140600

libcxx/include/__coroutine/coroutine_handle.h
libcxx/include/__coroutine/coroutine_traits.h
libcxx/include/__numeric/gcd_lcm.h
libcxx/include/__numeric/midpoint.h
libcxx/include/coroutine
libcxx/include/numbers
libcxx/include/numeric
libcxx/test/libcxx/transitive_includes/cxx2b.csv
libcxx/test/std/numerics/bit/bit.pow.two/bit_ceil.fail.cpp

index 8f7ed2e..0a6cc1c 100644 (file)
@@ -13,8 +13,9 @@
 #include <__config>
 #include <__functional/hash.h>
 #include <__memory/addressof.h>
+#include <__type_traits/remove_cv.h>
 #include <compare>
-#include <type_traits>
+#include <cstddef>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index 87eb218..d513075 100644 (file)
@@ -10,7 +10,7 @@
 #define _LIBCPP___COROUTINE_COROUTINE_TRAITS_H
 
 #include <__config>
-#include <type_traits>
+#include <__type_traits/void_t.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index b3d776b..5a3f81b 100644 (file)
 
 #include <__assert>
 #include <__config>
+#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 <limits>
-#include <type_traits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index ada6adf..bac3642 100644 (file)
 #define _LIBCPP___NUMERIC_MIDPOINT_H
 
 #include <__config>
+#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 <cstddef>
 #include <limits>
-#include <type_traits>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
index e0ce323..f264570 100644 (file)
@@ -57,6 +57,7 @@ struct suspend_always;
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <iosfwd>
+#  include <type_traits>
 #endif
 
 #endif // _LIBCPP_COROUTINE
index 1d9b6b0..72034a6 100644 (file)
@@ -61,7 +61,6 @@ namespace std::numbers {
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__concepts/arithmetic.h>
 #include <__config>
-#include <type_traits>
 #include <version>
 
 #if _LIBCPP_STD_VER > 17
@@ -133,6 +132,7 @@ _LIBCPP_END_NAMESPACE_STD
 
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <concepts>
+#  include <type_traits>
 #endif
 
 #endif // _LIBCPP_NUMBERS
index 2fb6f9e..100dbe1 100644 (file)
@@ -175,6 +175,7 @@ template<class T>
 #  include <concepts>
 #  include <functional>
 #  include <iterator>
+#  include <type_traits>
 #endif
 
 #endif // _LIBCPP_NUMERIC
index 186d0b4..23cc6d7 100644 (file)
@@ -138,7 +138,6 @@ coroutine cstddef
 coroutine cstdint
 coroutine cstring
 coroutine limits
-coroutine type_traits
 coroutine version
 cstddef version
 ctgmath ccomplex
@@ -452,12 +451,10 @@ new cstddef
 new cstdlib
 new exception
 new version
-numbers type_traits
 numbers version
 numeric cmath
 numeric cstddef
 numeric limits
-numeric type_traits
 numeric version
 optional compare
 optional cstddef
index 962291d..fab7d78 100644 (file)
@@ -20,8 +20,6 @@
 #include <cstdint>
 #include <limits>
 
-#include "test_macros.h"
-
 class A{};
 enum       E1 : unsigned char { rEd };
 enum class E2 : unsigned char { red };