diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -395,7 +395,6 @@ __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 @@ __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 rename from libcxx/include/__functional/unwrap_ref.h rename to libcxx/include/__type_traits/unwrap_ref.h --- 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 @@ template using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; -#endif // > C++17 +#endif // _LIBCPP_STD_VER >= 20 template struct __unwrap_ref_decay @@ -55,4 +55,4 @@ _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 --- 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 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -541,7 +541,7 @@ #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 // TODO: find out why removing this breaks the modules build #include diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -977,6 +977,8 @@ } 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 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 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 @@ 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 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -206,7 +206,6 @@ #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 @@ #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 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -532,6 +532,7 @@ #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 diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp --- a/libcxx/test/libcxx/private_headers.verify.cpp +++ b/libcxx/test/libcxx/private_headers.verify.cpp @@ -431,7 +431,6 @@ #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 @@ #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 --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -394,7 +394,6 @@ 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/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