[libcxx-commits] [libcxx] 06a1d91 - [libcxx][NFC] utilises compiler builtins for unary transform type-traits

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 14 10:33:55 PDT 2022


Author: Christopher Di Bella
Date: 2022-08-14T17:32:38Z
New Revision: 06a1d917ef1f507aaa2f6891bb654696c866ea3a

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

LOG: [libcxx][NFC] utilises compiler builtins for unary transform type-traits

Depends on D116203

Reviewed By: #libc, philnik

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

Added: 
    

Modified: 
    libcxx/include/__type_traits/add_lvalue_reference.h
    libcxx/include/__type_traits/add_pointer.h
    libcxx/include/__type_traits/add_rvalue_reference.h
    libcxx/include/__type_traits/decay.h
    libcxx/include/__type_traits/is_referenceable.h
    libcxx/include/__type_traits/is_swappable.h
    libcxx/include/__type_traits/make_signed.h
    libcxx/include/__type_traits/make_unsigned.h
    libcxx/include/__type_traits/remove_all_extents.h
    libcxx/include/__type_traits/remove_const.h
    libcxx/include/__type_traits/remove_cv.h
    libcxx/include/__type_traits/remove_cvref.h
    libcxx/include/__type_traits/remove_extent.h
    libcxx/include/__type_traits/remove_pointer.h
    libcxx/include/__type_traits/remove_reference.h
    libcxx/include/__type_traits/remove_volatile.h
    libcxx/test/libcxx/utilities/meta/is_referenceable.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__type_traits/add_lvalue_reference.h b/libcxx/include/__type_traits/add_lvalue_reference.h
index 0d1ee4185c8cd..9126caa9c7e93 100644
--- a/libcxx/include/__type_traits/add_lvalue_reference.h
+++ b/libcxx/include/__type_traits/add_lvalue_reference.h
@@ -18,11 +18,21 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl            { typedef _LIBCPP_NODEBUG _Tp  type; };
+#if __has_builtin(__add_lvalue_reference)
+template <class _Tp>
+struct add_lvalue_reference {
+  using type _LIBCPP_NODEBUG = __add_lvalue_reference(_Tp);
+};
+#else
+template <class _Tp, bool = __libcpp_is_referenceable<_Tp>::value>
+struct __add_lvalue_reference_impl {
+  typedef _LIBCPP_NODEBUG _Tp type;
+};
 template <class _Tp                                       > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp& type; };
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference
 {typedef _LIBCPP_NODEBUG typename  __add_lvalue_reference_impl<_Tp>::type type;};
+#endif // __has_builtin(__add_lvalue_reference)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/add_pointer.h b/libcxx/include/__type_traits/add_pointer.h
index aea2490c5d0cc..be3f758da4afe 100644
--- a/libcxx/include/__type_traits/add_pointer.h
+++ b/libcxx/include/__type_traits/add_pointer.h
@@ -21,16 +21,23 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__add_pointer)
+template <class _Tp>
+struct add_pointer {
+  using type _LIBCPP_NODEBUG = __add_pointer(_Tp);
+};
+#else
 template <class _Tp,
-        bool = __is_referenceable<_Tp>::value ||
-                _IsSame<typename remove_cv<_Tp>::type, void>::value>
-struct __add_pointer_impl
-    {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;};
+          bool = __libcpp_is_referenceable<_Tp>::value || _IsSame<typename remove_cv<_Tp>::type, void>::value>
+struct __add_pointer_impl {
+  typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;
+};
 template <class _Tp> struct __add_pointer_impl<_Tp, false>
     {typedef _LIBCPP_NODEBUG _Tp type;};
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer
     {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;};
+#endif // __has_builtin(__add_pointer)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/add_rvalue_reference.h b/libcxx/include/__type_traits/add_rvalue_reference.h
index b2a1428095d89..be01d4ec5ba84 100644
--- a/libcxx/include/__type_traits/add_rvalue_reference.h
+++ b/libcxx/include/__type_traits/add_rvalue_reference.h
@@ -18,11 +18,21 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl            { typedef _LIBCPP_NODEBUG _Tp   type; };
+#if __has_builtin(__add_rvalue_reference)
+template <class _Tp>
+struct add_rvalue_reference {
+  using type _LIBCPP_NODEBUG = __add_rvalue_reference(_Tp);
+};
+#else
+template <class _Tp, bool = __libcpp_is_referenceable<_Tp>::value>
+struct __add_rvalue_reference_impl {
+  typedef _LIBCPP_NODEBUG _Tp type;
+};
 template <class _Tp                                       > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp&& type; };
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
 {typedef _LIBCPP_NODEBUG typename __add_rvalue_reference_impl<_Tp>::type type;};
+#endif // __has_builtin(__add_rvalue_reference)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h
index d47ad03fe0082..ba727db3d0c8f 100644
--- a/libcxx/include/__type_traits/decay.h
+++ b/libcxx/include/__type_traits/decay.h
@@ -26,6 +26,12 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__decay)
+template <class _Tp>
+struct decay {
+  using type _LIBCPP_NODEBUG = __decay(_Tp);
+};
+#else
 template <class _Up, bool>
 struct __decay {
     typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type;
@@ -53,8 +59,9 @@ struct _LIBCPP_TEMPLATE_VIS decay
 private:
     typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up;
 public:
-    typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
+  typedef _LIBCPP_NODEBUG typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type;
 };
+#endif // __has_builtin(__decay)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using decay_t = typename decay<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/is_referenceable.h b/libcxx/include/__type_traits/is_referenceable.h
index b97631cc39dd1..4b34ec2572317 100644
--- a/libcxx/include/__type_traits/is_referenceable.h
+++ b/libcxx/include/__type_traits/is_referenceable.h
@@ -19,14 +19,22 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-struct __is_referenceable_impl {
-    template <class _Tp> static _Tp& __test(int);
-    template <class _Tp> static false_type __test(...);
+#if __has_builtin(__is_referenceable)
+template <class _Tp>
+struct __libcpp_is_referenceable : integral_constant<bool, __is_referenceable(_Tp)> {};
+#else
+struct __libcpp_is_referenceable_impl {
+  template <class _Tp>
+  static _Tp& __test(int);
+  template <class _Tp>
+  static false_type __test(...);
 };
 
 template <class _Tp>
-struct __is_referenceable : integral_constant<bool,
-    _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), false_type>::value> {};
+struct __libcpp_is_referenceable
+    : integral_constant<bool, _IsNotSame<decltype(__libcpp_is_referenceable_impl::__test<_Tp>(0)), false_type>::value> {
+};
+#endif // __has_builtin(__is_referenceable)
 
 _LIBCPP_END_NAMESPACE_STD
 

diff  --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index fdc9b1086b0ac..5ea97dbf6d40f 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -119,7 +119,7 @@ struct _LIBCPP_TEMPLATE_VIS is_swappable_with
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_swappable
     : public conditional<
-        __is_referenceable<_Tp>::value,
+        __libcpp_is_referenceable<_Tp>::value,
         is_swappable_with<
             typename add_lvalue_reference<_Tp>::type,
             typename add_lvalue_reference<_Tp>::type>,
@@ -137,7 +137,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable
     : public conditional<
-        __is_referenceable<_Tp>::value,
+        __libcpp_is_referenceable<_Tp>::value,
         is_nothrow_swappable_with<
             typename add_lvalue_reference<_Tp>::type,
             typename add_lvalue_reference<_Tp>::type>,

diff  --git a/libcxx/include/__type_traits/make_signed.h b/libcxx/include/__type_traits/make_signed.h
index fbc31172a9785..c36e2292f16f5 100644
--- a/libcxx/include/__type_traits/make_signed.h
+++ b/libcxx/include/__type_traits/make_signed.h
@@ -23,19 +23,25 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__make_signed)
+template <class _Tp>
+struct make_signed {
+  using type _LIBCPP_NODEBUG = __make_signed(_Tp);
+};
+#else
 typedef
     __type_list<signed char,
     __type_list<signed short,
     __type_list<signed int,
     __type_list<signed long,
     __type_list<signed long long,
-#ifndef _LIBCPP_HAS_NO_INT128
+#  ifndef _LIBCPP_HAS_NO_INT128
     __type_list<__int128_t,
-#endif
+#  endif
     __nat
-#ifndef _LIBCPP_HAS_NO_INT128
+#  ifndef _LIBCPP_HAS_NO_INT128
     >
-#endif
+#  endif
     > > > > > __signed_types;
 
 template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
@@ -56,16 +62,17 @@ template <> struct __make_signed<  signed long,      true> {typedef long      ty
 template <> struct __make_signed<unsigned long,      true> {typedef long      type;};
 template <> struct __make_signed<  signed long long, true> {typedef long long type;};
 template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
-#ifndef _LIBCPP_HAS_NO_INT128
+#  ifndef _LIBCPP_HAS_NO_INT128
 template <> struct __make_signed<__int128_t,         true> {typedef __int128_t type;};
 template <> struct __make_signed<__uint128_t,        true> {typedef __int128_t type;};
-#endif
+#  endif
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS make_signed
 {
     typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
 };
+#endif // __has_builtin(__make_signed)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/make_unsigned.h b/libcxx/include/__type_traits/make_unsigned.h
index 8110a5ca96097..6d4e482a8d973 100644
--- a/libcxx/include/__type_traits/make_unsigned.h
+++ b/libcxx/include/__type_traits/make_unsigned.h
@@ -25,19 +25,25 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__make_unsigned)
+template <class _Tp>
+struct make_unsigned {
+  using type _LIBCPP_NODEBUG = __make_unsigned(_Tp);
+};
+#else
 typedef
     __type_list<unsigned char,
     __type_list<unsigned short,
     __type_list<unsigned int,
     __type_list<unsigned long,
     __type_list<unsigned long long,
-#ifndef _LIBCPP_HAS_NO_INT128
+#  ifndef _LIBCPP_HAS_NO_INT128
     __type_list<__uint128_t,
-#endif
+#  endif
     __nat
-#ifndef _LIBCPP_HAS_NO_INT128
+#  ifndef _LIBCPP_HAS_NO_INT128
     >
-#endif
+#  endif
     > > > > > __unsigned_types;
 
 template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
@@ -58,16 +64,17 @@ template <> struct __make_unsigned<  signed long,      true> {typedef unsigned l
 template <> struct __make_unsigned<unsigned long,      true> {typedef unsigned long      type;};
 template <> struct __make_unsigned<  signed long long, true> {typedef unsigned long long type;};
 template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
-#ifndef _LIBCPP_HAS_NO_INT128
+#  ifndef _LIBCPP_HAS_NO_INT128
 template <> struct __make_unsigned<__int128_t,         true> {typedef __uint128_t        type;};
 template <> struct __make_unsigned<__uint128_t,        true> {typedef __uint128_t        type;};
-#endif
+#  endif
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS make_unsigned
 {
     typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
 };
+#endif // __has_builtin(__make_unsigned)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/remove_all_extents.h b/libcxx/include/__type_traits/remove_all_extents.h
index 075e3acabb447..cc00a61c92b3b 100644
--- a/libcxx/include/__type_traits/remove_all_extents.h
+++ b/libcxx/include/__type_traits/remove_all_extents.h
@@ -18,12 +18,19 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_all_extents)
+template <class _Tp>
+struct remove_all_extents {
+  using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp);
+};
+#else
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents
     {typedef _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]>
     {typedef typename remove_all_extents<_Tp>::type type;};
 template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[_Np]>
     {typedef typename remove_all_extents<_Tp>::type type;};
+#endif // __has_builtin(__remove_all_extents)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/remove_const.h b/libcxx/include/__type_traits/remove_const.h
index 8efc893e965a6..8eefbd099cb35 100644
--- a/libcxx/include/__type_traits/remove_const.h
+++ b/libcxx/include/__type_traits/remove_const.h
@@ -17,8 +17,16 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_const)
+template <class _Tp>
+struct remove_const {
+  using type _LIBCPP_NODEBUG = __remove_const(_Tp);
+};
+#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;};
+#endif // __has_builtin(__remove_const)
+
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type;
 #endif

diff  --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h
index ce1e4e45c6d13..9e3dee6c46ed7 100644
--- a/libcxx/include/__type_traits/remove_cv.h
+++ b/libcxx/include/__type_traits/remove_cv.h
@@ -19,8 +19,16 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_cv)
+template <class _Tp>
+struct remove_cv {
+  using type _LIBCPP_NODEBUG = __remove_cv(_Tp);
+};
+#else
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
 {typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;};
+#endif // __has_builtin(__remove_cv)
+
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type;
 #endif

diff  --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h
index d937501fedcec..3af261db3949d 100644
--- a/libcxx/include/__type_traits/remove_cvref.h
+++ b/libcxx/include/__type_traits/remove_cvref.h
@@ -20,8 +20,13 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_cvref)
+template <class _Tp>
+using __uncvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
+#else
 template <class _Tp>
 using __uncvref_t _LIBCPP_NODEBUG = typename remove_cv<typename remove_reference<_Tp>::type>::type;
+#endif // __has_builtin(__remove_cvref)
 
 template <class _Tp, class _Up>
 struct __is_same_uncvref : _IsSame<__uncvref_t<_Tp>, __uncvref_t<_Up> > {};

diff  --git a/libcxx/include/__type_traits/remove_extent.h b/libcxx/include/__type_traits/remove_extent.h
index e353de3616168..88da32a4e265d 100644
--- a/libcxx/include/__type_traits/remove_extent.h
+++ b/libcxx/include/__type_traits/remove_extent.h
@@ -18,12 +18,19 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_extent)
+template <class _Tp>
+struct remove_extent {
+  using type _LIBCPP_NODEBUG = __remove_extent(_Tp);
+};
+#else
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent
     {typedef _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]>
     {typedef _Tp type;};
 template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]>
     {typedef _Tp type;};
+#endif // __has_builtin(__remove_extent)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h
index 50cde3829470b..9042a52500552 100644
--- a/libcxx/include/__type_traits/remove_pointer.h
+++ b/libcxx/include/__type_traits/remove_pointer.h
@@ -17,11 +17,18 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_pointer)
+template <class _Tp>
+struct remove_pointer {
+  using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);
+};
+#else
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer                      {typedef _LIBCPP_NODEBUG _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*>                {typedef _LIBCPP_NODEBUG _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const>          {typedef _LIBCPP_NODEBUG _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile>       {typedef _LIBCPP_NODEBUG _Tp type;};
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;};
+#endif // __has_builtin(__remove_pointer)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/remove_reference.h b/libcxx/include/__type_traits/remove_reference.h
index a69e48dc584b0..7ea7fa52ecc59 100644
--- a/libcxx/include/__type_traits/remove_reference.h
+++ b/libcxx/include/__type_traits/remove_reference.h
@@ -18,9 +18,16 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_reference)
+template <class _Tp>
+struct remove_reference {
+  using type _LIBCPP_NODEBUG = __remove_reference(_Tp);
+};
+#else
 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;};
+#endif // __has_builtin(__remove_reference)
 
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type;

diff  --git a/libcxx/include/__type_traits/remove_volatile.h b/libcxx/include/__type_traits/remove_volatile.h
index 79f64c46a27d7..8c7aa67441930 100644
--- a/libcxx/include/__type_traits/remove_volatile.h
+++ b/libcxx/include/__type_traits/remove_volatile.h
@@ -17,8 +17,16 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if __has_builtin(__remove_volatile)
+template <class _Tp>
+struct remove_volatile {
+  using type _LIBCPP_NODEBUG = __remove_volatile(_Tp);
+};
+#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;};
+#endif // __has_builtin(__remove_volatile)
+
 #if _LIBCPP_STD_VER > 11
 template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type;
 #endif

diff  --git a/libcxx/test/libcxx/utilities/meta/is_referenceable.pass.cpp b/libcxx/test/libcxx/utilities/meta/is_referenceable.pass.cpp
index bdd0a4574b095..336f6e82ce8de 100644
--- a/libcxx/test/libcxx/utilities/meta/is_referenceable.pass.cpp
+++ b/libcxx/test/libcxx/utilities/meta/is_referenceable.pass.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 //
 
-// __is_referenceable<Tp>
+// __libcpp_is_referenceable<Tp>
 //
 // [defns.referenceable] defines "a referenceable type" as:
 // An object type, a function type that does not have cv-qualifiers
@@ -21,172 +21,172 @@
 
 struct Foo {};
 
-static_assert((!std::__is_referenceable<void>::value), "");
-static_assert(( std::__is_referenceable<int>::value), "");
-static_assert(( std::__is_referenceable<int[3]>::value), "");
-static_assert(( std::__is_referenceable<int[]>::value), "");
-static_assert(( std::__is_referenceable<int &>::value), "");
-static_assert(( std::__is_referenceable<const int &>::value), "");
-static_assert(( std::__is_referenceable<int *>::value), "");
-static_assert(( std::__is_referenceable<const int *>::value), "");
-static_assert(( std::__is_referenceable<Foo>::value), "");
-static_assert(( std::__is_referenceable<const Foo>::value), "");
-static_assert(( std::__is_referenceable<Foo &>::value), "");
-static_assert(( std::__is_referenceable<const Foo &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void>::value), "");
+static_assert((std::__libcpp_is_referenceable<int>::value), "");
+static_assert((std::__libcpp_is_referenceable<int[3]>::value), "");
+static_assert((std::__libcpp_is_referenceable<int[]>::value), "");
+static_assert((std::__libcpp_is_referenceable<int&>::value), "");
+static_assert((std::__libcpp_is_referenceable<const int&>::value), "");
+static_assert((std::__libcpp_is_referenceable<int*>::value), "");
+static_assert((std::__libcpp_is_referenceable<const int*>::value), "");
+static_assert((std::__libcpp_is_referenceable<Foo>::value), "");
+static_assert((std::__libcpp_is_referenceable<const Foo>::value), "");
+static_assert((std::__libcpp_is_referenceable<Foo&>::value), "");
+static_assert((std::__libcpp_is_referenceable<const Foo&>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<Foo &&>::value), "");
-static_assert(( std::__is_referenceable<const Foo &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<Foo&&>::value), "");
+static_assert((std::__libcpp_is_referenceable<const Foo&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<int   __attribute__((__vector_size__( 8)))>::value), "");
-static_assert(( std::__is_referenceable<const int   __attribute__((__vector_size__( 8)))>::value), "");
-static_assert(( std::__is_referenceable<float __attribute__((__vector_size__(16)))>::value), "");
-static_assert(( std::__is_referenceable<const float __attribute__((__vector_size__(16)))>::value), "");
+static_assert((std::__libcpp_is_referenceable<int __attribute__((__vector_size__(8)))>::value), "");
+static_assert((std::__libcpp_is_referenceable<const int __attribute__((__vector_size__(8)))>::value), "");
+static_assert((std::__libcpp_is_referenceable<float __attribute__((__vector_size__(16)))>::value), "");
+static_assert((std::__libcpp_is_referenceable<const float __attribute__((__vector_size__(16)))>::value), "");
 
 // Functions without cv-qualifiers are referenceable
-static_assert(( std::__is_referenceable<void ()>::value), "");
+static_assert((std::__libcpp_is_referenceable<void()>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void () const>::value), "");
-static_assert((!std::__is_referenceable<void () &>::value), "");
-static_assert((!std::__is_referenceable<void () const &>::value), "");
-static_assert((!std::__is_referenceable<void () &&>::value), "");
-static_assert((!std::__is_referenceable<void () const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void() const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void() &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void() const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void() &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void() const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (int)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(int)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (int) const>::value), "");
-static_assert((!std::__is_referenceable<void (int) &>::value), "");
-static_assert((!std::__is_referenceable<void (int) const &>::value), "");
-static_assert((!std::__is_referenceable<void (int) &&>::value), "");
-static_assert((!std::__is_referenceable<void (int) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (int, float)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(int, float)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (int, float) const>::value), "");
-static_assert((!std::__is_referenceable<void (int, float) &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float) const &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float) &&>::value), "");
-static_assert((!std::__is_referenceable<void (int, float) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (int, float, Foo &)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(int, float, Foo&)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (int, float, Foo &) const>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &) &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &) const &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &) &&>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(...)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (...) const>::value), "");
-static_assert((!std::__is_referenceable<void (...) &>::value), "");
-static_assert((!std::__is_referenceable<void (...) const &>::value), "");
-static_assert((!std::__is_referenceable<void (...) &&>::value), "");
-static_assert((!std::__is_referenceable<void (...) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(...) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(...) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(...) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(...) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(...) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (int, ...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(int, ...)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (int, ...) const>::value), "");
-static_assert((!std::__is_referenceable<void (int, ...) &>::value), "");
-static_assert((!std::__is_referenceable<void (int, ...) const &>::value), "");
-static_assert((!std::__is_referenceable<void (int, ...) &&>::value), "");
-static_assert((!std::__is_referenceable<void (int, ...) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, ...) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, ...) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, ...) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, ...) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, ...) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (int, float, ...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(int, float, ...)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (int, float, ...) const>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, ...) &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, ...) const &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, ...) &&>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, ...) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, ...) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, ...) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, ...) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, ...) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, ...) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (int, float, Foo &, ...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void(int, float, Foo&, ...)>::value), "");
 #if TEST_STD_VER >= 11
-static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) const>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) const &>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) &&>::value), "");
-static_assert((!std::__is_referenceable<void (int, float, Foo &, ...) const &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&, ...) const>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&, ...) &>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&, ...) const&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&, ...) &&>::value), "");
+static_assert((!std::__libcpp_is_referenceable<void(int, float, Foo&, ...) const&&>::value), "");
 #endif
 
 // member functions with or without cv-qualifiers are referenceable
-static_assert(( std::__is_referenceable<void (Foo::*)()>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)() const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)()>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)() const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)() &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)() const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)() &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)() const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)() &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)() const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)() &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)() const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(int)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(int) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(...)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(...) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(...) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(...) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(...) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(...) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(...) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(...) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(...) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(...) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(...) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(int, ...)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, ...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, ...) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, ...) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, ...) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, ...) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, ...) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, ...) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, ...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, ...) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, ...) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, ...) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, ...) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, ...) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, ...) const&&>::value), "");
 #endif
 
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...)>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) const>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&, ...)>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&, ...) const>::value), "");
 #if TEST_STD_VER >= 11
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) const &>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) &&>::value), "");
-static_assert(( std::__is_referenceable<void (Foo::*)(int, float, Foo &, ...) const &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&, ...) &>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&, ...) const&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&, ...) &&>::value), "");
+static_assert((std::__libcpp_is_referenceable<void (Foo::*)(int, float, Foo&, ...) const&&>::value), "");
 #endif
 
 int main(int, char**) {


        


More information about the libcxx-commits mailing list