[libcxx-commits] [libcxx] dc21ce4 - [libc++] Remove <type_traits> includes from <atomic> and <ratio>
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 16 10:38:39 PST 2023
Author: Nikolas Klauser
Date: 2023-01-16T19:38:33+01:00
New Revision: dc21ce44047a634ee9072157b6dc40926f02458a
URL: https://github.com/llvm/llvm-project/commit/dc21ce44047a634ee9072157b6dc40926f02458a
DIFF: https://github.com/llvm/llvm-project/commit/dc21ce44047a634ee9072157b6dc40926f02458a.diff
LOG: [libc++] Remove <type_traits> includes from <atomic> and <ratio>
Reviewed By: Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D141799
Added:
Modified:
libcxx/include/__chrono/duration.h
libcxx/include/__chrono/time_point.h
libcxx/include/atomic
libcxx/include/ratio
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/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h
index 7e47b6c4d119b..afcc38b5cfc07 100644
--- a/libcxx/include/__chrono/duration.h
+++ b/libcxx/include/__chrono/duration.h
@@ -11,9 +11,12 @@
#define _LIBCPP___CHRONO_DURATION_H
#include <__config>
+#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>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -612,4 +615,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <type_traits>
+#endif
+
#endif // _LIBCPP___CHRONO_DURATION_H
diff --git a/libcxx/include/__chrono/time_point.h b/libcxx/include/__chrono/time_point.h
index 52786709d4420..8a8fa2176d6c8 100644
--- a/libcxx/include/__chrono/time_point.h
+++ b/libcxx/include/__chrono/time_point.h
@@ -12,8 +12,10 @@
#include <__chrono/duration.h>
#include <__config>
+#include <__type_traits/common_type.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_convertible.h>
#include <limits>
-#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index 8914f19c6acad..d0d682da62382 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -524,10 +524,19 @@ template <class T>
#include <__config>
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_assignable.h>
+#include <__type_traits/is_function.h>
+#include <__type_traits/is_nothrow_default_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/underlying_type.h>
#include <cstddef>
#include <cstdint>
#include <cstring>
-#include <type_traits>
#include <version>
#ifndef _LIBCPP_HAS_NO_THREADS
@@ -2658,6 +2667,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cmath>
# include <compare>
+# include <type_traits>
#endif
#endif // _LIBCPP_ATOMIC
diff --git a/libcxx/include/ratio b/libcxx/include/ratio
index 5d7af88a2ac8d..3969a392f3c6d 100644
--- a/libcxx/include/ratio
+++ b/libcxx/include/ratio
@@ -79,9 +79,9 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__type_traits/integral_constant.h>
#include <climits>
#include <cstdint>
-#include <type_traits>
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -525,4 +525,8 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <type_traits>
+#endif
+
#endif // _LIBCPP_RATIO
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index b67b167a4f0aa..08f449b9e2425 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -722,6 +722,7 @@ scoped_allocator type_traits
scoped_allocator variant
scoped_allocator version
semaphore atomic
+semaphore cstddef
semaphore ctime
semaphore iosfwd
semaphore limits
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index ebe07a4046791..6ecca62114a46 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -723,6 +723,7 @@ scoped_allocator type_traits
scoped_allocator variant
scoped_allocator version
semaphore atomic
+semaphore cstddef
semaphore ctime
semaphore iosfwd
semaphore limits
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index dbbf4f75e9f44..fb50933e5233a 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -725,6 +725,7 @@ scoped_allocator type_traits
scoped_allocator variant
scoped_allocator version
semaphore atomic
+semaphore cstddef
semaphore ctime
semaphore iosfwd
semaphore limits
@@ -745,6 +746,7 @@ set stdexcept
set tuple
set type_traits
set version
+shared_mutex cstddef
shared_mutex ctime
shared_mutex iosfwd
shared_mutex limits
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index dbbf4f75e9f44..fb50933e5233a 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -725,6 +725,7 @@ scoped_allocator type_traits
scoped_allocator variant
scoped_allocator version
semaphore atomic
+semaphore cstddef
semaphore ctime
semaphore iosfwd
semaphore limits
@@ -745,6 +746,7 @@ set stdexcept
set tuple
set type_traits
set version
+shared_mutex cstddef
shared_mutex ctime
shared_mutex iosfwd
shared_mutex limits
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 410fced1635d6..7e7661d30958f 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -732,6 +732,7 @@ scoped_allocator type_traits
scoped_allocator variant
scoped_allocator version
semaphore atomic
+semaphore cstddef
semaphore ctime
semaphore iosfwd
semaphore limits
@@ -752,6 +753,7 @@ set stdexcept
set tuple
set type_traits
set version
+shared_mutex cstddef
shared_mutex ctime
shared_mutex iosfwd
shared_mutex limits
diff --git a/libcxx/test/libcxx/transitive_includes/cxx2b.csv b/libcxx/test/libcxx/transitive_includes/cxx2b.csv
index 8599bb7881a63..21b32bf401a29 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx2b.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx2b.csv
@@ -36,7 +36,6 @@ atomic ctime
atomic iosfwd
atomic limits
atomic ratio
-atomic type_traits
atomic version
barrier atomic
barrier cstddef
@@ -47,7 +46,6 @@ barrier iosfwd
barrier limits
barrier new
barrier ratio
-barrier type_traits
bit cstdint
bit cstdlib
bit limits
@@ -333,7 +331,6 @@ future new
future ratio
future system_error
future thread
-future type_traits
future version
initializer_list cstddef
iomanip istream
@@ -522,7 +519,6 @@ ranges variant
ranges version
ratio climits
ratio cstdint
-ratio type_traits
ratio version
regex cctype
regex compare
@@ -545,11 +541,11 @@ scoped_allocator new
scoped_allocator tuple
scoped_allocator version
semaphore atomic
+semaphore cstddef
semaphore ctime
semaphore iosfwd
semaphore limits
semaphore ratio
-semaphore type_traits
semaphore version
set compare
set cstddef
@@ -562,12 +558,12 @@ set stdexcept
set tuple
set type_traits
set version
+shared_mutex cstddef
shared_mutex ctime
shared_mutex iosfwd
shared_mutex limits
shared_mutex ratio
shared_mutex system_error
-shared_mutex type_traits
shared_mutex version
source_location cstdint
source_location version
diff --git a/libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp
index 4dcb1e157ea84..fca52a998eace 100644
--- a/libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.generic/constexpr_noexcept.compile.pass.cpp
@@ -9,6 +9,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
#include <atomic>
+#include <type_traits>
#include "test_macros.h"
More information about the libcxx-commits
mailing list