diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1014,6 +1014,12 @@ # define _LIBCPP_USE_NO_UNIQUE_ADDRESS 1 #endif +#if __has_cpp_attribute(clang::trivial_abi) && defined(_LIBCPP_ABI_UNSTABLE) +# define _LIBCPP_TRIVIAL_ABI [[clang::trivial_abi]] +#else +# define _LIBCPP_TRIVIAL_ABI +#endif + #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) # define _LIBCPP_INLINE_VAR inline #else diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -2395,7 +2395,7 @@ }; template > -class _LIBCPP_TEMPLATE_VIS unique_ptr { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_TRIVIAL_ABI unique_ptr { public: typedef _Tp element_type; typedef _Dp deleter_type; @@ -2691,7 +2691,7 @@ template -class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_TRIVIAL_ABI unique_ptr<_Tp[], _Dp> { public: typedef _Tp element_type; typedef _Dp deleter_type; @@ -3848,7 +3848,7 @@ template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this; template -class _LIBCPP_TEMPLATE_VIS shared_ptr +class _LIBCPP_TEMPLATE_VIS _LIBCPP_TRIVIAL_ABI shared_ptr { public: typedef _Tp element_type; @@ -5109,7 +5109,7 @@ #endif // _LIBCPP_NO_RTTI template -class _LIBCPP_TEMPLATE_VIS weak_ptr +class _LIBCPP_TEMPLATE_VIS _LIBCPP_TRIVIAL_ABI weak_ptr { public: typedef _Tp element_type;