From nobody Wed Oct 23 18:30:40 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XYd001hc3z5ZXBn; Wed, 23 Oct 2024 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XYd001M0Mz59SW; Wed, 23 Oct 2024 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729708240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OhE3/3tg70Tg2jBbqTeb1M3vjWmItm6ONXMhsJ2UVvI=; b=LwP4Zd7yRCYs6nKIQgiXEXwLpC0k4dwfbODC9UpP0QhCiQXbMmEc3EdirFKg8rH2id5Yvl SFjeAoRMDzLY4THXsC4SUux0sRBbonZyUcSNcu9rZAy912IMzmLhP0sZyZANjPhAUb5x/t FiXgx2e+L5JG1P0MH1/uV5KnzSVUNDS2AobSfmYuSb+ZhQjjXMuVGMLXHfAKz9/9PFHxVe pe8bVojmlCHnMzHRNx79+8EfRAPv+1i0+7+WOoMzU3tr91w4b6nw15chsAqBmVs+Ayo+8t 9vCM7GGN3iDsHC3KQHVW5fab1/BrIkxPrZy5tpw5FGErg/Qq1gelcSP+XxJ5uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729708240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OhE3/3tg70Tg2jBbqTeb1M3vjWmItm6ONXMhsJ2UVvI=; b=LF2cezF3Ky/8z9xEeqTWcZ255izQ6bVA/MUnHGbVwGKjsD111EuY+AkcVpnR1m6a73uBAP 8sBIE1W0NNmiMNVTPi78l9krcnikL4OpVcRa+r8C7fq8hZJpuEPYfm5VS/NeKk4vvj9U+K BxoOSB9H7WNHOmS+NBTR9pLOG76UuPsBvle3N9HjVuwSs6CaBy8GW8NAXbuUEfikYZbt45 6/PutniV2YFuAr3pykXSz0yVwH1muAJ1geGtN5fPV4FbzLiENxtBhxpnZNOHH2v4Qdy5Fr v169zRO9HIeUI6uJ1GN5uscP664uAtC1/n0da7Gk91qyukfVpKdmQt+FmDoZZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729708240; a=rsa-sha256; cv=none; b=AiU8iYZy5fC8QKP7EqY/3XdMluotdb7tQIbbzXYmsjbbvRccAyIyYGCEA1b4N4lQyMpeSa dqbxDw+BPycc0EBhGRmJM0cUgx7W9rEPSp76nyFo9p6CfNXVVWiTCl9CO3OAXzvhNhUheV nSulz53wAzysgjm8SR8S3m85yunnOnvue8X8Gs/r7M3HCbhHKa05mFpW1Po5J3PvVGP2Fw t2DAXuejoKhMXpImBSzmH4sPsLQ/T3oTSoAS4I6MYsIyPHrOgieWJgUt6ZBojnFsuUjPxl M+VLwhynqAnf7rp7VRzRo8HRAFzffLo5YEI6u/fop1gbwTZpnAZtiHmqnv3uLg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XYd000Kkjz18MH; Wed, 23 Oct 2024 18:30:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49NIUetD069432; Wed, 23 Oct 2024 18:30:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49NIUeL8069429; Wed, 23 Oct 2024 18:30:40 GMT (envelope-from git) Date: Wed, 23 Oct 2024 18:30:40 GMT Message-Id: <202410231830.49NIUeL8069429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 2f2ebe758bea - main - libcxx-compat: revert llvmorg-19-init-17473-g69fecaa1a455: List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f2ebe758bea201830bd021525424813f7fc6c6b Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=2f2ebe758bea201830bd021525424813f7fc6c6b commit 2f2ebe758bea201830bd021525424813f7fc6c6b Author: Dimitry Andric AuthorDate: 2024-08-05 20:26:02 +0000 Commit: Dimitry Andric CommitDate: 2024-10-23 18:26:44 +0000 libcxx-compat: revert llvmorg-19-init-17473-g69fecaa1a455: [libc++] Clean up some now dead code with the upgrade to GCC 14 (#97746) PR: 280562 MFC after: 1 month --- contrib/llvm-project/libcxx/include/__config | 58 ++++++++++++++------ .../libcxx/include/__tuple/tuple_element.h | 26 +++++++++ .../libcxx/include/__type_traits/is_function.h | 14 ++++- .../__type_traits/is_member_function_pointer.h | 31 +++++++++++ .../__type_traits/is_member_object_pointer.h | 15 ++++++ .../include/__type_traits/is_member_pointer.h | 16 ++++++ .../__type_traits/is_nothrow_constructible.h | 61 ++++++++++++++++++++++ .../libcxx/include/__type_traits/is_object.h | 25 ++++++++- .../libcxx/include/__type_traits/is_reference.h | 29 ++++++---- .../libcxx/include/__type_traits/is_scoped_enum.h | 22 ++++++++ 10 files changed, 266 insertions(+), 31 deletions(-) diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config index 2010e45ba13c..f44f18d52099 100644 --- a/contrib/llvm-project/libcxx/include/__config +++ b/contrib/llvm-project/libcxx/include/__config @@ -162,6 +162,16 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_CXX03_LANG # endif +// TODO: Remove once we switch to GCC 14 +# ifndef __has_extension +# define __has_extension(__x) 0 +# endif + +// TODO: Remove once we switch to GCC 14 +# ifndef __has_feature +# define __has_feature(__x) 0 +# endif + # ifndef __has_constexpr_builtin # define __has_constexpr_builtin(x) 0 # endif @@ -338,30 +348,44 @@ typedef __char32_t char32_t; # define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) +# if defined(_LIBCPP_COMPILER_CLANG_BASED) + // Objective-C++ features (opt-in) -# if __has_feature(objc_arc) -# define _LIBCPP_HAS_OBJC_ARC -# endif +# if __has_feature(objc_arc) +# define _LIBCPP_HAS_OBJC_ARC +# endif -# if __has_feature(objc_arc_weak) -# define _LIBCPP_HAS_OBJC_ARC_WEAK -# endif +# if __has_feature(objc_arc_weak) +# define _LIBCPP_HAS_OBJC_ARC_WEAK +# endif -# if __has_extension(blocks) -# define _LIBCPP_HAS_EXTENSION_BLOCKS -# endif +# if __has_extension(blocks) +# define _LIBCPP_HAS_EXTENSION_BLOCKS +# endif -# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) -# define _LIBCPP_HAS_BLOCKS_RUNTIME -# endif +# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) +# define _LIBCPP_HAS_BLOCKS_RUNTIME +# endif -# if !__has_feature(address_sanitizer) -# define _LIBCPP_HAS_NO_ASAN -# endif +# if !__has_feature(address_sanitizer) +# define _LIBCPP_HAS_NO_ASAN +# endif + +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) + +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ + +# elif defined(_LIBCPP_COMPILER_GCC) + +# if !defined(__SANITIZE_ADDRESS__) +# define _LIBCPP_HAS_NO_ASAN +# endif + +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +# endif // _LIBCPP_COMPILER_[CLANG|GCC] # if defined(_LIBCPP_OBJECT_FORMAT_COFF) diff --git a/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h b/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h index 9127c47dc8f1..55b3b47619f6 100644 --- a/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h +++ b/contrib/llvm-project/libcxx/include/__tuple/tuple_element.h @@ -40,6 +40,32 @@ struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> { #ifndef _LIBCPP_CXX03_LANG +# if !__has_builtin(__type_pack_element) + +namespace __indexer_detail { + +template +struct __indexed { + using type _LIBCPP_NODEBUG = _Tp; +}; + +template +struct __indexer; + +template +struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> : __indexed<_Idx, _Types>... {}; + +template +__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); + +} // namespace __indexer_detail + +template +using __type_pack_element _LIBCPP_NODEBUG = typename decltype(__indexer_detail::__at_index<_Idx>( + __indexer_detail::__indexer< __tuple_types<_Types...>, + typename __make_tuple_indices::type >{}))::type; +# endif + template struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> > { static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_function.h b/contrib/llvm-project/libcxx/include/__type_traits/is_function.h index 98fedd0ad96d..f09f19adf4aa 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_function.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_function.h @@ -11,6 +11,8 @@ #include <__config> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_const.h> +#include <__type_traits/is_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -18,12 +20,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__is_function) + template struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant {}; +#else + +template +struct _LIBCPP_TEMPLATE_VIS is_function + : public integral_constant::value || is_const::value)> {}; + +#endif // __has_builtin(__is_function) + #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_function_v = __is_function(_Tp); +inline constexpr bool is_function_v = is_function<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h b/contrib/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h index 037d5ca04ab0..11c8a00c9975 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h @@ -11,6 +11,9 @@ #include <__config> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_function.h> +#include <__type_traits/remove_cv.h> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -18,6 +21,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template +struct __libcpp_is_member_pointer { + enum { __is_member = false, __is_func = false, __is_obj = false }; +}; +template +struct __libcpp_is_member_pointer<_Tp _Up::*> { + enum { + __is_member = true, + __is_func = is_function<_Tp>::value, + __is_obj = !__is_func, + }; +}; + +#if __has_builtin(__is_member_function_pointer) + template struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {}; @@ -26,6 +44,19 @@ template inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); # endif +#else // __has_builtin(__is_member_function_pointer) + +template +struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer + : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func> {}; + +# if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; +# endif + +#endif // __has_builtin(__is_member_function_pointer) + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h b/contrib/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h index 555794bfe038..9141f9da530f 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h @@ -18,6 +18,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__is_member_object_pointer) + template struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {}; @@ -26,6 +28,19 @@ template inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); # endif +#else // __has_builtin(__is_member_object_pointer) + +template +struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer + : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj> {}; + +# if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; +# endif + +#endif // __has_builtin(__is_member_object_pointer) + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_FUNCTION_POINTER_H diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_member_pointer.h b/contrib/llvm-project/libcxx/include/__type_traits/is_member_pointer.h index 149634fde758..4ca01d1c2fc8 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_member_pointer.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_member_pointer.h @@ -11,6 +11,7 @@ #include <__config> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_member_function_pointer.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -18,6 +19,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__is_member_pointer) + template struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {}; @@ -26,6 +29,19 @@ template inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); # endif +#else // __has_builtin(__is_member_pointer) + +template +struct _LIBCPP_TEMPLATE_VIS is_member_pointer + : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member> {}; + +# if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; +# endif + +#endif // __has_builtin(__is_member_pointer) + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_MEMBER_POINTER_H diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h b/contrib/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h index 58d2b2475140..2f7ed8487e76 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h @@ -13,6 +13,10 @@ #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_reference.h> +#include <__utility/declval.h> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,28 +24,85 @@ _LIBCPP_BEGIN_NAMESPACE_STD +// GCC is disabled due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 +#if __has_builtin(__is_nothrow_constructible) && !defined(_LIBCPP_COMPILER_GCC) + template < class _Tp, class... _Args> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible : public integral_constant {}; +#else + +template +struct __libcpp_is_nothrow_constructible; + +template +struct __libcpp_is_nothrow_constructible + : public integral_constant()...))> {}; + +template +void __implicit_conversion_to(_Tp) noexcept {} + +template +struct __libcpp_is_nothrow_constructible + : public integral_constant(std::declval<_Arg>()))> {}; + +template +struct __libcpp_is_nothrow_constructible : public false_type { +}; + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible + : __libcpp_is_nothrow_constructible::value, + is_reference<_Tp>::value, + _Tp, + _Args...> {}; + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> + : __libcpp_is_nothrow_constructible::value, is_reference<_Tp>::value, _Tp> {}; + +#endif // __has_builtin(__is_nothrow_constructible) #if _LIBCPP_STD_VER >= 17 template inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; #endif +// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed +#ifdef _LIBCPP_COMPILER_GCC + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible + : public is_nothrow_constructible<_Tp, __add_lvalue_reference_t > {}; + +#else // _LIBCPP_COMPILER_GCC + template struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible : public integral_constant< bool, __is_nothrow_constructible(_Tp, __add_lvalue_reference_t)> {}; +#endif // _LIBCPP_COMPILER_GCC + #if _LIBCPP_STD_VER >= 17 template inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; #endif +// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed +#ifndef _LIBCPP_COMPILER_GCC + template struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible : public integral_constant)> {}; +#else // _LIBCPP_COMPILER_GCC + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible + : public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > {}; + +#endif // _LIBCPP_COMPILER_GCC + #if _LIBCPP_STD_VER >= 17 template inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_object.h b/contrib/llvm-project/libcxx/include/__type_traits/is_object.h index ec04508402ce..5ac1d854a695 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_object.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_object.h @@ -11,6 +11,10 @@ #include <__config> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_class.h> +#include <__type_traits/is_scalar.h> +#include <__type_traits/is_union.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -18,13 +22,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__is_object) + template struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> {}; -#if _LIBCPP_STD_VER >= 17 +# if _LIBCPP_STD_VER >= 17 template inline constexpr bool is_object_v = __is_object(_Tp); -#endif +# endif + +#else // __has_builtin(__is_object) + +template +struct _LIBCPP_TEMPLATE_VIS is_object + : public integral_constant::value || is_array<_Tp>::value || is_union<_Tp>::value || + is_class<_Tp>::value > {}; + +# if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_object_v = is_object<_Tp>::value; +# endif + +#endif // __has_builtin(__is_object) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_reference.h b/contrib/llvm-project/libcxx/include/__type_traits/is_reference.h index cc157a438e49..42853d479039 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_reference.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_reference.h @@ -18,15 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template -struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {}; - -#if _LIBCPP_STD_VER >= 17 -template -inline constexpr bool is_reference_v = __is_reference(_Tp); -#endif - -#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) +#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) && __has_builtin(__is_reference) template struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> {}; @@ -34,14 +26,19 @@ struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_refe template struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {}; + # if _LIBCPP_STD_VER >= 17 template +inline constexpr bool is_reference_v = __is_reference(_Tp); +template inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); template inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); # endif -#else // __has_builtin(__is_lvalue_reference) +#else // __has_builtin(__is_lvalue_reference) && etc... template struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {}; @@ -53,7 +50,17 @@ struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {}; template struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {}; +template +struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {}; +template +struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; +template +struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; + # if _LIBCPP_STD_VER >= 17 +template +inline constexpr bool is_reference_v = is_reference<_Tp>::value; + template inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; @@ -61,7 +68,7 @@ template inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; # endif -#endif // __has_builtin(__is_lvalue_reference) +#endif // __has_builtin(__is_lvalue_reference) && etc... _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h b/contrib/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h index cb3e25cf5733..1db88e13356e 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h @@ -11,6 +11,9 @@ #include <__config> #include <__type_traits/integral_constant.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_enum.h> +#include <__type_traits/underlying_type.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,12 +23,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 23 +// TODO: GCC and Clang both have this builtin. Remove the false case once we've updated to GCC 14. +# if __has_builtin(__is_scoped_enum) + template struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {}; template inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); +# else + +template > +struct __is_scoped_enum_helper : false_type {}; + +template +struct __is_scoped_enum_helper<_Tp, true> : public bool_constant > > {}; + +template +struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : public __is_scoped_enum_helper<_Tp> {}; + +template +inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; + +# endif // __has_builtin(__is_scoped_enum) + #endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD