Skip to content

Commit 094bd62

Browse files
committed
[libc++][NFC] Replace __apply_cv with __copy_cv or __copy_cvref
1 parent 7662f95 commit 094bd62

File tree

9 files changed

+16
-64
lines changed

9 files changed

+16
-64
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ set(files
731731
__type_traits/aligned_storage.h
732732
__type_traits/aligned_union.h
733733
__type_traits/alignment_of.h
734-
__type_traits/apply_cv.h
735734
__type_traits/can_extract_key.h
736735
__type_traits/common_reference.h
737736
__type_traits/common_type.h

libcxx/include/__tuple/make_tuple_types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <__tuple/tuple_indices.h>
1717
#include <__tuple/tuple_size.h>
1818
#include <__tuple/tuple_types.h>
19-
#include <__type_traits/apply_cv.h>
19+
#include <__type_traits/copy_cvref.h>
2020
#include <__type_traits/remove_cv.h>
2121
#include <__type_traits/remove_reference.h>
2222
#include <cstddef>
@@ -41,15 +41,15 @@ template <template <class...> class _Tuple, class... _Types, size_t... _Idx>
4141
struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
4242
// Specialization for pair, tuple, and __tuple_types
4343
template <class _Tp>
44-
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__apply_cv_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
44+
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
4545
};
4646

4747
template <class _Vt, size_t _Np, size_t... _Idx>
4848
struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
4949
template <size_t>
5050
using __value_type = _Vt;
5151
template <class _Tp>
52-
using __apply_quals = __tuple_types<__apply_cv_t<_Tp, __value_type<_Idx>>...>;
52+
using __apply_quals = __tuple_types<__copy_cvref_t<_Tp, __value_type<_Idx>>...>;
5353
};
5454

5555
template <class _Tp,

libcxx/include/__type_traits/apply_cv.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

libcxx/include/__type_traits/make_signed.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define _LIBCPP___TYPE_TRAITS_MAKE_SIGNED_H
1111

1212
#include <__config>
13-
#include <__type_traits/apply_cv.h>
1413
#include <__type_traits/is_enum.h>
1514
#include <__type_traits/is_integral.h>
1615
#include <__type_traits/nat.h>
@@ -70,7 +69,7 @@ template <> struct __make_signed<__uint128_t, true> {typedef __int128_t t
7069
// clang-format on
7170

7271
template <class _Tp>
73-
using __make_signed_t = __apply_cv_t<_Tp, typename __make_signed<__remove_cv_t<_Tp> >::type>;
72+
using __make_signed_t = __copy_cv_t<_Tp, typename __make_signed<__remove_cv_t<_Tp> >::type>;
7473

7574
#endif // __has_builtin(__make_signed)
7675

libcxx/include/__type_traits/make_unsigned.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define _LIBCPP___TYPE_TRAITS_MAKE_UNSIGNED_H
1111

1212
#include <__config>
13-
#include <__type_traits/apply_cv.h>
1413
#include <__type_traits/conditional.h>
1514
#include <__type_traits/is_enum.h>
1615
#include <__type_traits/is_integral.h>
@@ -72,7 +71,7 @@ template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_
7271
// clang-format on
7372

7473
template <class _Tp>
75-
using __make_unsigned_t = __apply_cv_t<_Tp, typename __make_unsigned<__remove_cv_t<_Tp> >::type>;
74+
using __make_unsigned_t = __copy_cv_t<_Tp, typename __make_unsigned<__remove_cv_t<_Tp> >::type>;
7675

7776
#endif // __has_builtin(__make_unsigned)
7877

libcxx/include/cwchar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
103103
*/
104104

105105
#include <__config>
106-
#include <__type_traits/apply_cv.h>
106+
#include <__type_traits/copy_cv.h>
107107
#include <__type_traits/is_constant_evaluated.h>
108108
#include <__type_traits/is_equality_comparable.h>
109109
#include <__type_traits/is_same.h>
@@ -236,7 +236,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp
236236
wchar_t __value_buffer = 0;
237237
__builtin_memcpy(&__value_buffer, &__value, sizeof(wchar_t));
238238
return reinterpret_cast<_Tp*>(
239-
__builtin_wmemchr(reinterpret_cast<__apply_cv_t<_Tp, wchar_t>*>(__str), __value_buffer, __count));
239+
__builtin_wmemchr(reinterpret_cast<__copy_cv_t<_Tp, wchar_t>*>(__str), __value_buffer, __count));
240240
}
241241
# if _LIBCPP_STD_VER >= 17
242242
else if constexpr (is_same_v<remove_cv_t<_Tp>, wchar_t>)

libcxx/include/module.modulemap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,11 +1851,6 @@ module std_private_type_traits_add_volatile [system
18511851
module std_private_type_traits_aligned_storage [system] { header "__type_traits/aligned_storage.h" }
18521852
module std_private_type_traits_aligned_union [system] { header "__type_traits/aligned_union.h" }
18531853
module std_private_type_traits_alignment_of [system] { header "__type_traits/alignment_of.h" }
1854-
module std_private_type_traits_apply_cv [system] {
1855-
header "__type_traits/apply_cv.h"
1856-
export std_private_type_traits_is_const
1857-
export std_private_type_traits_is_volatile
1858-
}
18591854
module std_private_type_traits_can_extract_key [system] { header "__type_traits/can_extract_key.h" }
18601855
module std_private_type_traits_common_reference [system] {
18611856
header "__type_traits/common_reference.h"

libcxx/include/tuple

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ template <class... Types>
222222
#include <__tuple/tuple_like_ext.h>
223223
#include <__tuple/tuple_size.h>
224224
#include <__tuple/tuple_types.h>
225-
#include <__type_traits/apply_cv.h>
226225
#include <__type_traits/common_reference.h>
227226
#include <__type_traits/common_type.h>
228227
#include <__type_traits/conditional.h>
@@ -1286,14 +1285,14 @@ struct __tuple_cat_return_ref_imp;
12861285
template <class... _Types, size_t... _I0, class _Tuple0>
12871286
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> {
12881287
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
1289-
typedef tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
1288+
typedef tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
12901289
};
12911290

12921291
template <class... _Types, size_t... _I0, class _Tuple0, class _Tuple1, class... _Tuples>
12931292
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...>
12941293
: public __tuple_cat_return_ref_imp<
12951294
tuple<_Types...,
1296-
__apply_cv_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
1295+
__copy_cvref_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
12971296
typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
12981297
_Tuple1,
12991298
_Tuples...> {};
@@ -1327,7 +1326,7 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
13271326
(void)__t; // avoid unused parameter warning on GCC when _I0 is empty
13281327
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
13291328
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
1330-
return __tuple_cat<tuple<_Types..., __apply_cv_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
1329+
return __tuple_cat<tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
13311330
typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
13321331
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
13331332
std::forward_as_tuple(
@@ -1375,22 +1374,22 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t,
13751374
}
13761375
#else
13771376
template <class _Tp, class _Tuple, size_t... _Idx>
1378-
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>,
1377+
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>,
13791378
enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...>> * = nullptr)
13801379
_LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
13811380
#endif // _LIBCPP_STD_VER >= 20
13821381

1383-
template <class _Tp, class _Tuple,
1382+
template <class _Tp, class _Tuple,
13841383
class _Seq = typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type, class = void>
13851384
inline constexpr bool __can_make_from_tuple = false;
13861385

13871386
template <class _Tp, class _Tuple, size_t... _Idx>
1388-
inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, __tuple_indices<_Idx...>,
1387+
inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, __tuple_indices<_Idx...>,
13891388
enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::declval<_Tuple>()))...>>> = true;
13901389

1391-
// Based on LWG3528(https://wg21.link/LWG3528) and http://eel.is/c++draft/description#structure.requirements-9,
1392-
// the standard allows to impose requirements, we constraint std::make_from_tuple to make std::make_from_tuple
1393-
// SFINAE friendly and also avoid worse diagnostic messages. We still keep the constraints of std::__make_from_tuple_impl
1390+
// Based on LWG3528(https://wg21.link/LWG3528) and http://eel.is/c++draft/description#structure.requirements-9,
1391+
// the standard allows to impose requirements, we constraint std::make_from_tuple to make std::make_from_tuple
1392+
// SFINAE friendly and also avoid worse diagnostic messages. We still keep the constraints of std::__make_from_tuple_impl
13941393
// so that std::__make_from_tuple_impl will have the same advantages when used alone.
13951394
#if _LIBCPP_STD_VER >= 20
13961395
template <class _Tp, class _Tuple>

libcxx/include/type_traits

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ namespace std
428428
#include <__type_traits/aligned_storage.h>
429429
#include <__type_traits/aligned_union.h>
430430
#include <__type_traits/alignment_of.h>
431-
#include <__type_traits/apply_cv.h>
432431
#include <__type_traits/can_extract_key.h>
433432
#include <__type_traits/common_reference.h>
434433
#include <__type_traits/common_type.h>

0 commit comments

Comments
 (0)