[libcxx-commits] [libcxx] abcbe87 - [libc++] Remove unused code paths for non-existent builtins

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 4 12:51:46 PST 2022


Author: Louis Dionne
Date: 2022-02-04T15:51:42-05:00
New Revision: abcbe87311db67cfee47478f2b97b4ed396df5e6

URL: https://github.com/llvm/llvm-project/commit/abcbe87311db67cfee47478f2b97b4ed396df5e6
DIFF: https://github.com/llvm/llvm-project/commit/abcbe87311db67cfee47478f2b97b4ed396df5e6.diff

LOG: [libc++] Remove unused code paths for non-existent builtins

It looks like we added some checks to try and use builtin type traits
in https://reviews.llvm.org/D67900, but some of those type traits are
never implemented as builtins, so this is essentially dead code.

Fixes llvm-project#53569

Differential Revision: https://reviews.llvm.org/D118923

Added: 
    

Modified: 
    libcxx/include/type_traits

Removed: 
    


################################################################################
diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 4957ca9f6d570..3098b3d79f051 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -634,67 +634,28 @@ inline constexpr bool is_volatile_v = is_volatile<_Tp>::value;
 
 // remove_const
 
-#if __has_keyword(__remove_const)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS remove_const {typedef __remove_const(_Tp) type;};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_const_t = __remove_const(_Tp);
-#endif
-
-#else
-
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const            {typedef _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;};
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
 #endif
 
-#endif // __has_keyword(__remove_const)
-
 // remove_volatile
 
-#if __has_keyword(__remove_volatile)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef __remove_volatile(_Tp) type;};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_volatile_t = __remove_volatile(_Tp);
-#endif
-
-#else
-
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile               {typedef _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;};
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
 #endif
 
-#endif // __has_keyword(__remove_volatile)
-
 // remove_cv
 
-#if __has_keyword(__remove_cv)
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS remove_cv {typedef __remove_cv(_Tp) type;};
-
-#if _LIBCPP_STD_VER > 11
-template <class _Tp> using remove_cv_t = __remove_cv(_Tp);
-#endif
-
-#else
-
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
 {typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
 #endif
 
-#endif // __has_keyword(__remove_cv)
-
 // is_void
 
 #if __has_keyword(__is_void)
@@ -1272,13 +1233,6 @@ template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
 
 // remove_reference
 
-#if __has_keyword(__remove_reference)
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS remove_reference { typedef __remove_reference(_Tp) type; };
-
-#else // __has_keyword(__remove_reference)
-
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _LIBCPP_NODEBUG _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&>  {typedef _LIBCPP_NODEBUG _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;};
@@ -1287,8 +1241,6 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typede
 template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;
 #endif
 
-#endif // __has_keyword(__remove_reference)
-
 // add_lvalue_reference
 
 template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl            { typedef _LIBCPP_NODEBUG _Tp  type; };


        


More information about the libcxx-commits mailing list