diff options
author | Nikolas Klauser <nikolasklauser@berlin.de> | 2024-03-03 18:26:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-03 18:26:57 +0100 |
commit | 55357160d0e151c32f86e1d6683b4bddbb706aa1 (patch) | |
tree | bef1a73d8f0f0f12fad215f12e0e7bca1240f092 /libcxx | |
parent | 0c89427b99f6f6d7c217c70ff880ca097340f9a4 (diff) | |
download | llvm-55357160d0e151c32f86e1d6683b4bddbb706aa1.zip llvm-55357160d0e151c32f86e1d6683b4bddbb706aa1.tar.gz llvm-55357160d0e151c32f86e1d6683b4bddbb706aa1.tar.bz2 |
[libc++] Use GCC type traits builtins for remove_cv and remove_cvref (#81386)
They have been added recently to GCC without support for mangling. This
patch uses them in structs and adds aliases to these structs instead of
the builtins directly.
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/include/__type_traits/remove_cv.h | 11 | ||||
-rw-r--r-- | libcxx/include/__type_traits/remove_cvref.h | 15 |
2 files changed, 13 insertions, 13 deletions
diff --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h index c4bf612..8e1c043 100644 --- a/libcxx/include/__type_traits/remove_cv.h +++ b/libcxx/include/__type_traits/remove_cv.h @@ -19,22 +19,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct remove_cv { using type _LIBCPP_NODEBUG = __remove_cv(_Tp); }; +#if defined(_LIBCPP_COMPILER_GCC) template <class _Tp> -using __remove_cv_t = __remove_cv(_Tp); +using __remove_cv_t = typename remove_cv<_Tp>::type; #else template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS remove_cv { - typedef __remove_volatile_t<__remove_const_t<_Tp> > type; -}; - -template <class _Tp> -using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >; +using __remove_cv_t = __remove_cv(_Tp); #endif // __has_builtin(__remove_cv) #if _LIBCPP_STD_VER >= 14 diff --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h index e8e8745..55f894d 100644 --- a/libcxx/include/__type_traits/remove_cvref.h +++ b/libcxx/include/__type_traits/remove_cvref.h @@ -20,21 +20,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC) +#if defined(_LIBCPP_COMPILER_GCC) template <class _Tp> -using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); +struct __remove_cvref_gcc { + using type = __remove_cvref(_Tp); +}; + +template <class _Tp> +using __remove_cvref_t _LIBCPP_NODEBUG = typename __remove_cvref_gcc<_Tp>::type; #else template <class _Tp> -using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; +using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); #endif // __has_builtin(__remove_cvref) template <class _Tp, class _Up> -struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {}; +using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >; #if _LIBCPP_STD_VER >= 20 template <class _Tp> struct remove_cvref { - using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; + using type _LIBCPP_NODEBUG = __remove_cvref(_Tp); }; template <class _Tp> |