[libcxx-commits] [libcxx] [libc++] Remove a few includes from <__functional/hash.h> (PR #83254)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 14 04:22:58 PDT 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/83254
>From 887d879bba8be1116e20609666227b92c446cabe Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 28 Feb 2024 12:53:12 +0100
Subject: [PATCH] [libc++] Remove a few includes from <__functional/hash.h>
---
libcxx/include/__functional/hash.h | 7 ++-----
libcxx/include/__tuple/sfinae_helpers.h | 7 +------
libcxx/include/__type_traits/conjunction.h | 7 +++++++
libcxx/include/array | 1 +
libcxx/include/coroutine | 1 +
libcxx/include/experimental/memory | 4 ++++
libcxx/include/optional | 1 +
libcxx/include/variant | 1 +
libcxx/test/libcxx/transitive_includes/cxx23.csv | 3 ---
libcxx/test/libcxx/transitive_includes/cxx26.csv | 3 ---
10 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index a466c837038f8d..118e83e13ed166 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -10,23 +10,20 @@
#define _LIBCPP___FUNCTIONAL_HASH_H
#include <__config>
-#include <__functional/invoke.h>
#include <__functional/unary_function.h>
#include <__fwd/functional.h>
-#include <__tuple/sfinae_helpers.h>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/invoke.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>
#include <__utility/swap.h>
#include <cstddef>
#include <cstdint>
#include <cstring>
-#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/__tuple/sfinae_helpers.h b/libcxx/include/__tuple/sfinae_helpers.h
index 90e9b1e5800478..35a57ff7765923 100644
--- a/libcxx/include/__tuple/sfinae_helpers.h
+++ b/libcxx/include/__tuple/sfinae_helpers.h
@@ -16,6 +16,7 @@
#include <__tuple/tuple_like_ext.h>
#include <__tuple/tuple_size.h>
#include <__tuple/tuple_types.h>
+#include <__type_traits/conjunction.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_constructible.h>
@@ -32,12 +33,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
-template <bool... _Preds>
-struct __all_dummy;
-
-template <bool... _Pred>
-struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>> {};
-
struct __tuple_sfinae_base {
template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>)
diff --git a/libcxx/include/__type_traits/conjunction.h b/libcxx/include/__type_traits/conjunction.h
index 4bfa5a27300d1e..c2995591bbc28f 100644
--- a/libcxx/include/__type_traits/conjunction.h
+++ b/libcxx/include/__type_traits/conjunction.h
@@ -13,6 +13,7 @@
#include <__type_traits/conditional.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
+#include <__type_traits/is_same.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -37,6 +38,12 @@ false_type __and_helper(...);
template <class... _Pred>
using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0));
+template <bool... _Preds>
+struct __all_dummy;
+
+template <bool... _Pred>
+struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...> > {};
+
#if _LIBCPP_STD_VER >= 17
template <class...>
diff --git a/libcxx/include/array b/libcxx/include/array
index 7fa5dc1479349e..932b1b91ebd586 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -123,6 +123,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <__iterator/wrap_iter.h>
#include <__tuple/sfinae_helpers.h>
#include <__type_traits/conditional.h>
+#include <__type_traits/conjunction.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_constructible.h>
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index 4bd1d4e9c3103a..b1ba83b541b4b7 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -56,6 +56,7 @@ struct suspend_always;
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <iosfwd>
+# include <limits>
# include <type_traits>
#endif
diff --git a/libcxx/include/experimental/memory b/libcxx/include/experimental/memory
index 7e698fe9dee771..e9663d43a8ab73 100644
--- a/libcxx/include/experimental/memory
+++ b/libcxx/include/experimental/memory
@@ -191,4 +191,8 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ENABLE_EXPERIMENTAL
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <limits>
+#endif
+
#endif /* _LIBCPP_EXPERIMENTAL_MEMORY */
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 99bfd0dd900d3a..94c5789a2c7d2b 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -1291,6 +1291,7 @@ _LIBCPP_POP_MACROS
# include <concepts>
# include <ctime>
# include <iterator>
+# include <limits>
# include <memory>
# include <ratio>
# include <stdexcept>
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 59d7f9b740f3be..25d47ec79defa7 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -228,6 +228,7 @@ namespace std {
#include <__type_traits/add_pointer.h>
#include <__type_traits/add_volatile.h>
#include <__type_traits/common_type.h>
+#include <__type_traits/conjunction.h>
#include <__type_traits/dependent_type.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_default_constructible.h>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 142204c4477cde..ccba100af20e90 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -131,7 +131,6 @@ coroutine compare
coroutine cstddef
coroutine cstdint
coroutine cstring
-coroutine limits
coroutine version
cstddef version
ctgmath ccomplex
@@ -166,7 +165,6 @@ experimental/iterator iterator
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/simd cstddef
experimental/simd cstdint
@@ -396,7 +394,6 @@ optional cstddef
optional cstdint
optional cstring
optional initializer_list
-optional limits
optional new
optional version
ostream bitset
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 142204c4477cde..ccba100af20e90 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -131,7 +131,6 @@ coroutine compare
coroutine cstddef
coroutine cstdint
coroutine cstring
-coroutine limits
coroutine version
cstddef version
ctgmath ccomplex
@@ -166,7 +165,6 @@ experimental/iterator iterator
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/simd cstddef
experimental/simd cstdint
@@ -396,7 +394,6 @@ optional cstddef
optional cstdint
optional cstring
optional initializer_list
-optional limits
optional new
optional version
ostream bitset
More information about the libcxx-commits
mailing list