[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
Sat Mar 9 02:20:54 PST 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/83254
>From 3bb503bbef7c97b25a8ec9caeadf2e2ea4a26782 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/optional | 1 +
libcxx/test/libcxx/transitive_includes/cxx03.csv | 1 -
libcxx/test/libcxx/transitive_includes/cxx11.csv | 1 -
libcxx/test/libcxx/transitive_includes/cxx14.csv | 1 -
libcxx/test/libcxx/transitive_includes/cxx17.csv | 1 -
libcxx/test/libcxx/transitive_includes/cxx20.csv | 1 -
libcxx/test/libcxx/transitive_includes/cxx23.csv | 3 ---
libcxx/test/libcxx/transitive_includes/cxx26.csv | 3 ---
13 files changed, 13 insertions(+), 22 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/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/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 678a986e522aa0..7bbead829758eb 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -240,7 +240,6 @@ experimental/iterator type_traits
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/propagate_const type_traits
experimental/simd cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index c3875fa2cfc06f..6d466ac60ad003 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -241,7 +241,6 @@ experimental/iterator type_traits
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/propagate_const type_traits
experimental/simd cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index e28e0cd44fed95..1433cb857b570c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -241,7 +241,6 @@ experimental/iterator type_traits
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/propagate_const type_traits
experimental/simd cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index e28e0cd44fed95..1433cb857b570c 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -241,7 +241,6 @@ experimental/iterator type_traits
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/propagate_const type_traits
experimental/simd cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index eec71f4fc6282e..223a9a4e8446d3 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -247,7 +247,6 @@ experimental/iterator type_traits
experimental/memory cstddef
experimental/memory cstdint
experimental/memory cstring
-experimental/memory limits
experimental/propagate_const cstddef
experimental/propagate_const type_traits
experimental/simd cstddef
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 64ff9261820a96..53b95564b936dd 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -132,7 +132,6 @@ coroutine compare
coroutine cstddef
coroutine cstdint
coroutine cstring
-coroutine limits
coroutine version
cstddef version
ctgmath ccomplex
@@ -167,7 +166,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
@@ -397,7 +395,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 64ff9261820a96..53b95564b936dd 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -132,7 +132,6 @@ coroutine compare
coroutine cstddef
coroutine cstdint
coroutine cstring
-coroutine limits
coroutine version
cstddef version
ctgmath ccomplex
@@ -167,7 +166,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
@@ -397,7 +395,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