[libcxx-commits] [libcxx] [libc++] Rename __fwd/hash.h to __fwd/functional.h and add reference_wrapper (PR #81445)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 15 14:53:40 PST 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/81445
>From 170d1504efc5d678c4c5c5f1c78ff990821a2981 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 12 Feb 2024 08:51:48 +0100
Subject: [PATCH] [libc++] Rename __fwd/hash.h to __fwd/functional.h and add
reference_wrapper
---
libcxx/include/CMakeLists.txt | 2 +-
libcxx/include/__filesystem/path.h | 3 +--
libcxx/include/__functional/hash.h | 2 +-
libcxx/include/__functional/identity.h | 2 +-
libcxx/include/__fwd/{hash.h => functional.h} | 9 ++++++---
libcxx/include/__thread/id.h | 2 +-
libcxx/include/__thread/support/pthread.h | 1 -
libcxx/include/__type_traits/is_reference_wrapper.h | 4 +---
libcxx/include/__type_traits/unwrap_ref.h | 7 +------
libcxx/include/experimental/propagate_const | 2 +-
libcxx/include/module.modulemap.in | 2 +-
libcxx/include/optional | 2 +-
libcxx/include/type_traits | 2 +-
13 files changed, 17 insertions(+), 23 deletions(-)
rename libcxx/include/__fwd/{hash.h => functional.h} (77%)
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index b44068357e7089..99d128b6336db4 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -428,7 +428,7 @@ set(files
__fwd/array.h
__fwd/bit_reference.h
__fwd/fstream.h
- __fwd/hash.h
+ __fwd/functional.h
__fwd/ios.h
__fwd/istream.h
__fwd/mdspan.h
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 8c7d426f7a6f4f..9ffc90ada5e716 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -14,9 +14,8 @@
#include <__algorithm/replace_copy.h>
#include <__availability>
#include <__config>
-#include <__functional/hash.h>
#include <__functional/unary_function.h>
-#include <__fwd/hash.h>
+#include <__fwd/functional.h>
#include <__iterator/back_insert_iterator.h>
#include <__iterator/iterator_traits.h>
#include <__type_traits/decay.h>
diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h
index ff22055d6915e4..a466c837038f8d 100644
--- a/libcxx/include/__functional/hash.h
+++ b/libcxx/include/__functional/hash.h
@@ -12,7 +12,7 @@
#include <__config>
#include <__functional/invoke.h>
#include <__functional/unary_function.h>
-#include <__fwd/hash.h>
+#include <__fwd/functional.h>
#include <__tuple/sfinae_helpers.h>
#include <__type_traits/is_copy_constructible.h>
#include <__type_traits/is_default_constructible.h>
diff --git a/libcxx/include/__functional/identity.h b/libcxx/include/__functional/identity.h
index 7fbfc6c6249b65..b7be367bd5eed7 100644
--- a/libcxx/include/__functional/identity.h
+++ b/libcxx/include/__functional/identity.h
@@ -11,7 +11,7 @@
#define _LIBCPP___FUNCTIONAL_IDENTITY_H
#include <__config>
-#include <__functional/reference_wrapper.h>
+#include <__fwd/functional.h>
#include <__type_traits/integral_constant.h>
#include <__utility/forward.h>
diff --git a/libcxx/include/__fwd/hash.h b/libcxx/include/__fwd/functional.h
similarity index 77%
rename from libcxx/include/__fwd/hash.h
rename to libcxx/include/__fwd/functional.h
index af9eca876a1047..32c9ef33e453b1 100644
--- a/libcxx/include/__fwd/hash.h
+++ b/libcxx/include/__fwd/functional.h
@@ -6,8 +6,8 @@
//
//===---------------------------------------------------------------------===//
-#ifndef _LIBCPP___FWD_HASH_H
-#define _LIBCPP___FWD_HASH_H
+#ifndef _LIBCPP___FWD_FUNCTIONAL_H
+#define _LIBCPP___FWD_FUNCTIONAL_H
#include <__config>
@@ -20,6 +20,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class>
struct _LIBCPP_TEMPLATE_VIS hash;
+template <class>
+class _LIBCPP_TEMPLATE_VIS reference_wrapper;
+
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP___FWD_HASH_H
+#endif // _LIBCPP___FWD_FUNCTIONAL_H
diff --git a/libcxx/include/__thread/id.h b/libcxx/include/__thread/id.h
index d5aef3f860ce27..6db0ccbfe569b6 100644
--- a/libcxx/include/__thread/id.h
+++ b/libcxx/include/__thread/id.h
@@ -12,7 +12,7 @@
#include <__compare/ordering.h>
#include <__config>
-#include <__fwd/hash.h>
+#include <__fwd/functional.h>
#include <__fwd/ostream.h>
#include <__thread/support.h>
diff --git a/libcxx/include/__thread/support/pthread.h b/libcxx/include/__thread/support/pthread.h
index d0b8367e448f48..0e2e2ed8d6cd4c 100644
--- a/libcxx/include/__thread/support/pthread.h
+++ b/libcxx/include/__thread/support/pthread.h
@@ -14,7 +14,6 @@
#include <__chrono/convert_to_timespec.h>
#include <__chrono/duration.h>
#include <__config>
-#include <__fwd/hash.h>
#include <ctime>
#include <errno.h>
#include <pthread.h>
diff --git a/libcxx/include/__type_traits/is_reference_wrapper.h b/libcxx/include/__type_traits/is_reference_wrapper.h
index b638e7046b71ca..310a910040e8be 100644
--- a/libcxx/include/__type_traits/is_reference_wrapper.h
+++ b/libcxx/include/__type_traits/is_reference_wrapper.h
@@ -10,6 +10,7 @@
#define _LIBCPP___TYPE_TRAITS_IS_REFERENCE_WRAPPER_H
#include <__config>
+#include <__fwd/functional.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/remove_cv.h>
@@ -19,9 +20,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp>
-class _LIBCPP_TEMPLATE_VIS reference_wrapper;
-
template <class _Tp>
struct __is_reference_wrapper_impl : public false_type {};
template <class _Tp>
diff --git a/libcxx/include/__type_traits/unwrap_ref.h b/libcxx/include/__type_traits/unwrap_ref.h
index 5fed08f7ddda1a..6bd74550f30921 100644
--- a/libcxx/include/__type_traits/unwrap_ref.h
+++ b/libcxx/include/__type_traits/unwrap_ref.h
@@ -10,6 +10,7 @@
#define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H
#include <__config>
+#include <__fwd/functional.h>
#include <__type_traits/decay.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -23,17 +24,11 @@ struct __unwrap_reference {
typedef _LIBCPP_NODEBUG _Tp type;
};
-template <class _Tp>
-class reference_wrapper;
-
template <class _Tp>
struct __unwrap_reference<reference_wrapper<_Tp> > {
typedef _LIBCPP_NODEBUG _Tp& type;
};
-template <class _Tp>
-struct decay;
-
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct unwrap_reference : __unwrap_reference<_Tp> {};
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 06d7ba43daf1ca..e3ee060c127e22 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -109,7 +109,7 @@
#include <__assert> // all public C++ headers provide the assertion handler
#include <__functional/operations.h>
-#include <__fwd/hash.h>
+#include <__fwd/functional.h>
#include <__type_traits/conditional.h>
#include <__type_traits/decay.h>
#include <__type_traits/enable_if.h>
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 63af3a90d88b9b..bef3e47276db06 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1357,7 +1357,7 @@ module std_private_functional_hash [system] {
export std_private_type_traits_underlying_type
export std_private_utility_pair
}
-module std_private_functional_hash_fwd [system] { header "__fwd/hash.h" }
+module std_private_functional_fwd [system] { header "__fwd/functional.h" }
module std_private_functional_identity [system] { header "__functional/identity.h" }
module std_private_functional_invoke [system] {
header "__functional/invoke.h"
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 73da0a8a5a7c19..ec62fe541db10c 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -186,8 +186,8 @@ namespace std {
#include <__exception/exception.h>
#include <__functional/hash.h>
#include <__functional/invoke.h>
-#include <__functional/reference_wrapper.h>
#include <__functional/unary_function.h>
+#include <__fwd/functional.h>
#include <__memory/addressof.h>
#include <__memory/construct_at.h>
#include <__tuple/sfinae_helpers.h>
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 466aeb6e0ddd71..26598ef297ab57 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -418,7 +418,7 @@ namespace std
*/
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
-#include <__fwd/hash.h> // This is https://llvm.org/PR56938
+#include <__fwd/functional.h> // This is https://llvm.org/PR56938
#include <__type_traits/add_const.h>
#include <__type_traits/add_cv.h>
#include <__type_traits/add_lvalue_reference.h>
More information about the libcxx-commits
mailing list