mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
[libc++][NFC] Remove one apply_cv implementation
Reviewed By: #libc, ldionne Spies: arichardson, libcxx-commits Differential Revision: https://reviews.llvm.org/D148468
This commit is contained in:
@@ -596,7 +596,6 @@ set(files
|
||||
__thread/timed_backoff_policy.h
|
||||
__threading_support
|
||||
__tree
|
||||
__tuple/apply_cv.h
|
||||
__tuple/make_tuple_types.h
|
||||
__tuple/pair_like.h
|
||||
__tuple/sfinae_helpers.h
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___TUPLE_APPLY_CV_H
|
||||
#define _LIBCPP___TUPLE_APPLY_CV_H
|
||||
|
||||
#include <__config>
|
||||
#include <__type_traits/is_const.h>
|
||||
#include <__type_traits/is_reference.h>
|
||||
#include <__type_traits/is_volatile.h>
|
||||
#include <__type_traits/remove_reference.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile>
|
||||
struct __apply_cv_mf;
|
||||
template <>
|
||||
struct __apply_cv_mf<false, false, false> {
|
||||
template <class _Tp> using __apply = _Tp;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<false, true, false> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<false, false, true> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<false, true, true> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<true, false, false> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = _Tp&;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<true, true, false> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = const _Tp&;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<true, false, true> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = volatile _Tp&;
|
||||
};
|
||||
template <>
|
||||
struct __apply_cv_mf<true, true, true> {
|
||||
template <class _Tp> using __apply _LIBCPP_NODEBUG = const volatile _Tp&;
|
||||
};
|
||||
template <class _Tp, class _RawTp = __libcpp_remove_reference_t<_Tp> >
|
||||
using __apply_cv_t _LIBCPP_NODEBUG = __apply_cv_mf<
|
||||
is_lvalue_reference<_Tp>::value,
|
||||
is_const<_RawTp>::value,
|
||||
is_volatile<_RawTp>::value>;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#endif // _LIBCPP___TUPLE_APPLY_CV_H
|
||||
@@ -12,11 +12,11 @@
|
||||
#include <__config>
|
||||
#include <__fwd/array.h>
|
||||
#include <__fwd/tuple.h>
|
||||
#include <__tuple/apply_cv.h>
|
||||
#include <__tuple/tuple_element.h>
|
||||
#include <__tuple/tuple_indices.h>
|
||||
#include <__tuple/tuple_size.h>
|
||||
#include <__tuple/tuple_types.h>
|
||||
#include <__type_traits/apply_cv.h>
|
||||
#include <__type_traits/remove_cv.h>
|
||||
#include <__type_traits/remove_reference.h>
|
||||
#include <cstddef>
|
||||
@@ -40,20 +40,16 @@ struct __make_tuple_types_flat;
|
||||
template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>
|
||||
struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
|
||||
// Specialization for pair, tuple, and __tuple_types
|
||||
template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>
|
||||
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<
|
||||
typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>...
|
||||
>;
|
||||
template <class _Tp>
|
||||
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__apply_cv_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
|
||||
};
|
||||
|
||||
template <class _Vt, size_t _Np, size_t ..._Idx>
|
||||
struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
|
||||
template <size_t>
|
||||
using __value_type = _Vt;
|
||||
template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>
|
||||
using __apply_quals = __tuple_types<
|
||||
typename _ApplyFn::template __apply<__value_type<_Idx>>...
|
||||
>;
|
||||
template <class _Tp>
|
||||
using __apply_quals = __tuple_types<__apply_cv_t<_Tp, __value_type<_Idx>>...>;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <__type_traits/is_const.h>
|
||||
#include <__type_traits/is_volatile.h>
|
||||
#include <__type_traits/remove_reference.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
@@ -21,54 +20,58 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Up, bool = is_const<__libcpp_remove_reference_t<_Tp> >::value,
|
||||
bool = is_volatile<__libcpp_remove_reference_t<_Tp> >::value>
|
||||
struct __apply_cv
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG _Up type;
|
||||
template <class _Tp,
|
||||
bool = is_const<__libcpp_remove_reference_t<_Tp> >::value,
|
||||
bool = is_volatile<__libcpp_remove_reference_t<_Tp> >::value>
|
||||
struct __apply_cv_impl {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = _Up;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp, true, false> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = const _Up;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp, false, true> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = volatile _Up;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp, true, true> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = const volatile _Up;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp&, false, false> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = _Up&;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp&, true, false> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = const _Up&;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp&, false, true> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = volatile _Up&;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __apply_cv_impl<_Tp&, true, true> {
|
||||
template <class _Up>
|
||||
using __apply _LIBCPP_NODEBUG = const volatile _Up&;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp, _Up, true, false>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG const _Up type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp, _Up, false, true>
|
||||
{
|
||||
typedef volatile _Up type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp, _Up, true, true>
|
||||
{
|
||||
typedef const volatile _Up type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp&, _Up, false, false>
|
||||
{
|
||||
typedef _Up& type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp&, _Up, true, false>
|
||||
{
|
||||
typedef const _Up& type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp&, _Up, false, true>
|
||||
{
|
||||
typedef volatile _Up& type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __apply_cv<_Tp&, _Up, true, true>
|
||||
{
|
||||
typedef const volatile _Up& type;
|
||||
};
|
||||
using __apply_cv_t _LIBCPP_NODEBUG = typename __apply_cv_impl<_Tp>::template __apply<_Up>;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ template <> struct __make_signed<__uint128_t, true> {typedef __int128_t t
|
||||
# endif
|
||||
|
||||
template <class _Tp>
|
||||
using __make_signed_t = typename __apply_cv<_Tp, typename __make_signed<__remove_cv_t<_Tp> >::type>::type;
|
||||
using __make_signed_t = __apply_cv_t<_Tp, typename __make_signed<__remove_cv_t<_Tp> >::type>;
|
||||
|
||||
#endif // __has_builtin(__make_signed)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_
|
||||
# endif
|
||||
|
||||
template <class _Tp>
|
||||
using __make_unsigned_t = typename __apply_cv<_Tp, typename __make_unsigned<__remove_cv_t<_Tp> >::type>::type;
|
||||
using __make_unsigned_t = __apply_cv_t<_Tp, typename __make_unsigned<__remove_cv_t<_Tp> >::type>;
|
||||
|
||||
#endif // __has_builtin(__make_unsigned)
|
||||
|
||||
|
||||
@@ -1467,7 +1467,6 @@ module std [system] {
|
||||
header "tuple"
|
||||
export *
|
||||
|
||||
module apply_cv { private header "__tuple/apply_cv.h" }
|
||||
module get_fwd { private header "__fwd/get.h" }
|
||||
module make_tuple_types { private header "__tuple/make_tuple_types.h" }
|
||||
module pair_like { private header "__tuple/pair_like.h" }
|
||||
|
||||
@@ -1711,17 +1711,15 @@ template <class ..._Types, size_t ..._I0, class _Tuple0>
|
||||
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
|
||||
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
|
||||
typename tuple_element<_I0, _T0>::type>::type&&...> type;
|
||||
typedef tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
|
||||
};
|
||||
|
||||
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
|
||||
_Tuple0, _Tuple1, _Tuples...>
|
||||
: public __tuple_cat_return_ref_imp<
|
||||
tuple<_Types..., typename __apply_cv<_Tuple0,
|
||||
typename tuple_element<_I0,
|
||||
__libcpp_remove_reference_t<_Tuple0> >::type>::type&&...>,
|
||||
tuple<_Types..., __apply_cv_t<_Tuple0,
|
||||
typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
|
||||
typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
|
||||
_Tuple1, _Tuples...>
|
||||
{
|
||||
@@ -1761,13 +1759,9 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
|
||||
(void)__t; // avoid unused parameter warning on GCC when _I0 is empty
|
||||
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
|
||||
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
|
||||
return __tuple_cat<
|
||||
tuple<_Types...,
|
||||
typename __apply_cv<_Tuple0, typename tuple_element<
|
||||
_J0, _T0>::type>::type&&...>,
|
||||
typename __make_tuple_indices<sizeof...(_Types) +
|
||||
tuple_size<_T0>::value>::type,
|
||||
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
|
||||
return __tuple_cat<tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
|
||||
typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
|
||||
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
|
||||
_VSTD::forward_as_tuple(
|
||||
_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))...,
|
||||
_VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...),
|
||||
|
||||
@@ -609,7 +609,6 @@ END-SCRIPT
|
||||
#include <__system_error/system_error.h> // expected-error@*:* {{use of private header from outside its module: '__system_error/system_error.h'}}
|
||||
#include <__thread/poll_with_backoff.h> // expected-error@*:* {{use of private header from outside its module: '__thread/poll_with_backoff.h'}}
|
||||
#include <__thread/timed_backoff_policy.h> // expected-error@*:* {{use of private header from outside its module: '__thread/timed_backoff_policy.h'}}
|
||||
#include <__tuple/apply_cv.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/apply_cv.h'}}
|
||||
#include <__tuple/make_tuple_types.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/make_tuple_types.h'}}
|
||||
#include <__tuple/pair_like.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/pair_like.h'}}
|
||||
#include <__tuple/sfinae_helpers.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/sfinae_helpers.h'}}
|
||||
|
||||
@@ -616,7 +616,6 @@ libcxx/include/__thread/poll_with_backoff.h
|
||||
libcxx/include/__thread/timed_backoff_policy.h
|
||||
libcxx/include/__tree
|
||||
libcxx/include/tuple
|
||||
libcxx/include/__tuple/apply_cv.h
|
||||
libcxx/include/__tuple/make_tuple_types.h
|
||||
libcxx/include/__tuple/sfinae_helpers.h
|
||||
libcxx/include/__tuple/tuple_element.h
|
||||
@@ -634,7 +633,6 @@ libcxx/include/__type_traits/add_volatile.h
|
||||
libcxx/include/__type_traits/aligned_storage.h
|
||||
libcxx/include/__type_traits/aligned_union.h
|
||||
libcxx/include/__type_traits/alignment_of.h
|
||||
libcxx/include/__type_traits/apply_cv.h
|
||||
libcxx/include/__type_traits/can_extract_key.h
|
||||
libcxx/include/__type_traits/common_reference.h
|
||||
libcxx/include/__type_traits/common_type.h
|
||||
|
||||
Reference in New Issue
Block a user