diff options
author | Mark de Wever <koraq@xs4all.nl> | 2023-04-20 21:03:40 +0200 |
---|---|---|
committer | Mark de Wever <koraq@xs4all.nl> | 2023-05-14 20:03:55 +0200 |
commit | b7932803dede5f95eed3b1777dfd40ce94ef1676 (patch) | |
tree | 658105ba4d50dd23ca04d5cec3999253eaa2aca6 /libcxx | |
parent | f46b0e6d75fa84d2d2d9805e3d2be2c1e6c140f1 (diff) | |
download | llvm-b7932803dede5f95eed3b1777dfd40ce94ef1676.tar.gz |
[libc++] Moves unwrap_reference to type_traits.
This was discovered while working on modules.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D149351
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/include/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libcxx/include/__type_traits/unwrap_ref.h (renamed from libcxx/include/__functional/unwrap_ref.h) | 8 | ||||
-rw-r--r-- | libcxx/include/__utility/pair.h | 2 | ||||
-rw-r--r-- | libcxx/include/functional | 2 | ||||
-rw-r--r-- | libcxx/include/module.modulemap.in | 5 | ||||
-rw-r--r-- | libcxx/include/tuple | 2 | ||||
-rw-r--r-- | libcxx/include/type_traits | 1 | ||||
-rw-r--r-- | libcxx/test/libcxx/private_headers.verify.cpp | 2 | ||||
-rw-r--r-- | libcxx/utils/data/ignore_format.txt | 2 |
9 files changed, 14 insertions, 12 deletions
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 83b920a79b81..4dd363de4d17 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -395,7 +395,6 @@ set(files __functional/reference_wrapper.h __functional/unary_function.h __functional/unary_negate.h - __functional/unwrap_ref.h __functional/weak_result_type.h __fwd/array.h __fwd/fstream.h @@ -792,6 +791,7 @@ set(files __type_traits/type_identity.h __type_traits/type_list.h __type_traits/underlying_type.h + __type_traits/unwrap_ref.h __type_traits/void_t.h __undef_macros __utility/as_const.h diff --git a/libcxx/include/__functional/unwrap_ref.h b/libcxx/include/__type_traits/unwrap_ref.h index 3abad73ac7f2..94cc8ea722ed 100644 --- a/libcxx/include/__functional/unwrap_ref.h +++ b/libcxx/include/__type_traits/unwrap_ref.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___FUNCTIONAL_UNWRAP_REF_H -#define _LIBCPP___FUNCTIONAL_UNWRAP_REF_H +#ifndef _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H +#define _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H #include <__config> #include <__type_traits/decay.h> @@ -42,7 +42,7 @@ struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { }; template <class _Tp> using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; -#endif // > C++17 +#endif // _LIBCPP_STD_VER >= 20 template <class _Tp> struct __unwrap_ref_decay @@ -55,4 +55,4 @@ struct __unwrap_ref_decay _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H +#endif // _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h index 65a4cc078023..bb4b75ab82d7 100644 --- a/libcxx/include/__utility/pair.h +++ b/libcxx/include/__utility/pair.h @@ -13,7 +13,6 @@ #include <__compare/synth_three_way.h> #include <__concepts/different_from.h> #include <__config> -#include <__functional/unwrap_ref.h> #include <__fwd/array.h> #include <__fwd/get.h> #include <__fwd/subrange.h> @@ -45,6 +44,7 @@ #include <__type_traits/is_swappable.h> #include <__type_traits/nat.h> #include <__type_traits/remove_cvref.h> +#include <__type_traits/unwrap_ref.h> #include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/move.h> diff --git a/libcxx/include/functional b/libcxx/include/functional index 05d42fcff232..63af88750491 100644 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -541,7 +541,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited #include <__functional/reference_wrapper.h> #include <__functional/unary_function.h> #include <__functional/unary_negate.h> -#include <__functional/unwrap_ref.h> +#include <__type_traits/unwrap_ref.h> #include <__utility/forward.h> #include <memory> // TODO: find out why removing this breaks the modules build #include <typeinfo> diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in index c4d680eda593..fcf793f0e63f 100644 --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -977,6 +977,8 @@ module std [system] { } module functional { header "functional" + // the contents of __type_traits/unwrap_ref.h should be available from functional too. + export type_traits.unwrap_ref export * module __functional { @@ -1010,7 +1012,6 @@ module std [system] { module reference_wrapper { private header "__functional/reference_wrapper.h" } module unary_function { private header "__functional/unary_function.h" } module unary_negate { private header "__functional/unary_negate.h" } - module unwrap_ref { private header "__functional/unwrap_ref.h" } module weak_result_type { private header "__functional/weak_result_type.h" } } } @@ -1521,7 +1522,6 @@ module std [system] { } module type_traits { header "type_traits" - export functional.__functional.unwrap_ref export * module add_const { private header "__type_traits/add_const.h" } @@ -1682,6 +1682,7 @@ module std [system] { export type_traits } + module unwrap_ref { private header "__type_traits/unwrap_ref.h" } module void_t { private header "__type_traits/void_t.h" } } module typeindex { diff --git a/libcxx/include/tuple b/libcxx/include/tuple index 3c9715f6f02f..fe7432f44310 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -206,7 +206,6 @@ template <class... Types> #include <__compare/synth_three_way.h> #include <__config> #include <__functional/invoke.h> -#include <__functional/unwrap_ref.h> #include <__fwd/array.h> #include <__fwd/tuple.h> #include <__memory/allocator_arg_t.h> @@ -252,6 +251,7 @@ template <class... Types> #include <__type_traits/negation.h> #include <__type_traits/remove_cvref.h> #include <__type_traits/remove_reference.h> +#include <__type_traits/unwrap_ref.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <__utility/move.h> diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 7646f5805980..a15729948134 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -532,6 +532,7 @@ namespace std #include <__type_traits/result_of.h> #include <__type_traits/type_identity.h> #include <__type_traits/underlying_type.h> +#include <__type_traits/unwrap_ref.h> #include <__type_traits/void_t.h> #include <__utility/declval.h> #include <cstddef> diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp index 60d7081da09a..33cc828b9218 100644 --- a/libcxx/test/libcxx/private_headers.verify.cpp +++ b/libcxx/test/libcxx/private_headers.verify.cpp @@ -431,7 +431,6 @@ END-SCRIPT #include <__functional/reference_wrapper.h> // expected-error@*:* {{use of private header from outside its module: '__functional/reference_wrapper.h'}} #include <__functional/unary_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_function.h'}} #include <__functional/unary_negate.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_negate.h'}} -#include <__functional/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unwrap_ref.h'}} #include <__functional/weak_result_type.h> // expected-error@*:* {{use of private header from outside its module: '__functional/weak_result_type.h'}} #include <__fwd/array.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/array.h'}} #include <__fwd/fstream.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/fstream.h'}} @@ -776,6 +775,7 @@ END-SCRIPT #include <__type_traits/type_identity.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_identity.h'}} #include <__type_traits/type_list.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_list.h'}} #include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.h'}} +#include <__type_traits/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/unwrap_ref.h'}} #include <__type_traits/void_t.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/void_t.h'}} #include <__utility/as_const.h> // expected-error@*:* {{use of private header from outside its module: '__utility/as_const.h'}} #include <__utility/auto_cast.h> // expected-error@*:* {{use of private header from outside its module: '__utility/auto_cast.h'}} diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt index c32f5ecfa9cf..4c7e9cfecad3 100644 --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -394,7 +394,6 @@ libcxx/include/__functional/ranges_operations.h libcxx/include/__functional/reference_wrapper.h libcxx/include/__functional/unary_function.h libcxx/include/__functional/unary_negate.h -libcxx/include/__functional/unwrap_ref.h libcxx/include/__functional/weak_result_type.h libcxx/include/future libcxx/include/__fwd/get.h @@ -757,6 +756,7 @@ libcxx/include/__type_traits/strip_signature.h libcxx/include/__type_traits/type_identity.h libcxx/include/__type_traits/type_list.h libcxx/include/__type_traits/underlying_type.h +libcxx/include/__type_traits/unwrap_ref.h libcxx/include/__type_traits/void_t.h libcxx/include/uchar.h libcxx/include/unordered_map |