diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -748,6 +748,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/__functional/unwrap_ref.h --- a/libcxx/include/__functional/unwrap_ref.h +++ b/libcxx/include/__functional/unwrap_ref.h @@ -11,6 +11,7 @@ #include <__config> #include <__type_traits/decay.h> +#include <__type_traits/unwrap_ref.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -18,31 +19,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template -struct __unwrap_reference { typedef _LIBCPP_NODEBUG _Tp type; }; - -template -class reference_wrapper; - -template -struct __unwrap_reference > { typedef _LIBCPP_NODEBUG _Tp& type; }; - -template -struct decay; - #if _LIBCPP_STD_VER >= 20 -template -struct unwrap_reference : __unwrap_reference<_Tp> { }; - -template -using unwrap_reference_t = typename unwrap_reference<_Tp>::type; - template struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { }; 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 diff --git a/libcxx/include/__functional/unwrap_ref.h b/libcxx/include/__type_traits/unwrap_ref.h copy from libcxx/include/__functional/unwrap_ref.h copy to libcxx/include/__type_traits/unwrap_ref.h --- a/libcxx/include/__functional/unwrap_ref.h +++ b/libcxx/include/__type_traits/unwrap_ref.h @@ -6,11 +6,11 @@ // //===----------------------------------------------------------------------===// -#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> +#include <__functional/reference_wrapper.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,38 +21,17 @@ template struct __unwrap_reference { typedef _LIBCPP_NODEBUG _Tp type; }; -template -class reference_wrapper; - template struct __unwrap_reference > { typedef _LIBCPP_NODEBUG _Tp& type; }; -template -struct decay; - #if _LIBCPP_STD_VER >= 20 template struct unwrap_reference : __unwrap_reference<_Tp> { }; template using unwrap_reference_t = typename unwrap_reference<_Tp>::type; - -template -struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { }; - -template -using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; -#endif // > C++17 - -template -struct __unwrap_ref_decay -#if _LIBCPP_STD_VER >= 20 - : unwrap_ref_decay<_Tp> -#else - : __unwrap_reference<__decay_t<_Tp> > -#endif -{ }; +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___FUNCTIONAL_UNWRAP_REF_H +#endif // _LIBCPP___TYPE_TRAITS_UNWRAP_REF_H 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 @@ -981,7 +981,10 @@ 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 unwrap_ref { + private header "__functional/unwrap_ref.h" + export type_traits + } module weak_result_type { private header "__functional/weak_result_type.h" } } } @@ -1490,7 +1493,6 @@ } module type_traits { header "type_traits" - export functional.__functional.unwrap_ref export * module add_const { private header "__type_traits/add_const.h" } @@ -1646,6 +1648,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/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 @@ -764,6 +764,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 @@ -780,6 +780,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