[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
This commit is contained in:
Mark de Wever 2023-04-20 21:03:40 +02:00
parent f46b0e6d75
commit b7932803de
9 changed files with 14 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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 {

View File

@ -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>

View File

@ -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>

View File

@ -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'}}

View File

@ -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