git: 718c82d22a1f - stable/13 - libcxx-compat: revert llvmorg-19-init-4003-g55357160d0e1:
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Dec 2024 12:54:18 UTC
The branch stable/13 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=718c82d22a1ff385b3f1ea3aa13f692125613d6d
commit 718c82d22a1ff385b3f1ea3aa13f692125613d6d
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-05 20:27:51 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-12-01 12:32:41 +0000
libcxx-compat: revert llvmorg-19-init-4003-g55357160d0e1:
[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.
PR: 280562
MFC after: 1 month
(cherry picked from commit 072b5fb698abd61ab30bea70135758336b0de999)
---
.../llvm-project/libcxx/include/__type_traits/remove_cv.h | 11 ++++++++---
.../libcxx/include/__type_traits/remove_cvref.h | 15 +++++----------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/remove_cv.h b/contrib/llvm-project/libcxx/include/__type_traits/remove_cv.h
index 8e1c04336432..c4bf612794bd 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/remove_cv.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/remove_cv.h
@@ -19,17 +19,22 @@
_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 = typename remove_cv<_Tp>::type;
+using __remove_cv_t = __remove_cv(_Tp);
#else
template <class _Tp>
-using __remove_cv_t = __remove_cv(_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> >;
#endif // __has_builtin(__remove_cv)
#if _LIBCPP_STD_VER >= 14
diff --git a/contrib/llvm-project/libcxx/include/__type_traits/remove_cvref.h b/contrib/llvm-project/libcxx/include/__type_traits/remove_cvref.h
index 55f894dbd1d8..e8e8745ab096 100644
--- a/contrib/llvm-project/libcxx/include/__type_traits/remove_cvref.h
+++ b/contrib/llvm-project/libcxx/include/__type_traits/remove_cvref.h
@@ -20,26 +20,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if defined(_LIBCPP_COMPILER_GCC)
+#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC)
template <class _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;
+using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
#else
template <class _Tp>
-using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
+using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >;
#endif // __has_builtin(__remove_cvref)
template <class _Tp, class _Up>
-using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >;
+struct __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(_Tp);
+ using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
};
template <class _Tp>