Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libcxx and libcxxabi to LLVM 18.1.2 #21638

Merged
merged 21 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c49d831
Update libcxxabi to LLVM 18.1.2
aheejin Mar 25, 2024
e9a39c1
Update libcxx to LLVM 18.1.2
aheejin Mar 26, 2024
31ac683
Fix unused variable compile error
aheejin Mar 27, 2024
6a0909e
Fix destructor return type in __cxa_init_primary_exception
aheejin Mar 27, 2024
df9af64
Disable C++20 time zone support
aheejin Mar 27, 2024
2bd7c67
Set _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT to 0
aheejin Mar 27, 2024
e508f3d
Disable hardening mode
aheejin Mar 27, 2024
8d51927
Add default __assertion_handler to libcxx/include
aheejin Mar 28, 2024
78af7d4
Add comments to https://github.com/emscripten-core/emscripten/commit/…
aheejin Mar 28, 2024
72283aa
Rebaseline other.test_metadce_files_wasmfs
aheejin Mar 28, 2024
e4d4bc7
Disable __libcpp_verbose_abort directly in code
aheejin Mar 28, 2024
39c27d1
Add __cxa_init_primary_exception to library_exception.js
aheejin Mar 28, 2024
047d130
Rebaseline other.test_minimal_runtime_code_size_hello_embind_val
aheejin Mar 29, 2024
f628139
Merge branch 'main' into update_libcxx
aheejin Mar 29, 2024
5eeb965
Rebaseline other.test_minimal_runtime_code_size_hello_embind_val
aheejin Mar 29, 2024
57dbfba
Make __cxa_init_primary_exception return exception ptr
aheejin Mar 30, 2024
3504d7c
Remove stale comment line
aheejin Mar 30, 2024
942b0d4
Merge branch 'main' into update_libcxx
aheejin Apr 1, 2024
5f265c7
Restore deps for __cxa_thorw
aheejin Apr 1, 2024
1fbe318
Merge branch 'main' into update_libcxx
aheejin Apr 1, 2024
a4ec944
Move __cxa_init_primary_exception to native
aheejin Apr 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion system/lib/libcxx/include/__algorithm/any_of.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD

template <class _InputIterator, class _Predicate>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
for (; __first != __last; ++__first)
if (__pred(*__first))
Expand Down
20 changes: 7 additions & 13 deletions system/lib/libcxx/include/__algorithm/binary_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD

template <class _ForwardIterator, class _Tp, class _Compare>
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
return __first != __last && !__comp(__value, *__first);
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
return __first != __last && !__comp(__value, *__first);
}

template <class _ForwardIterator, class _Tp>
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{
return std::binary_search(__first, __last, __value, __less<>());
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
return std::binary_search(__first, __last, __value, __less<>());
}

_LIBCPP_END_NAMESPACE_STD
Expand Down
30 changes: 14 additions & 16 deletions system/lib/libcxx/include/__algorithm/clamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@
_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 17
template<class _Tp, class _Compare>
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY constexpr
const _Tp&
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
{
_LIBCPP_ASSERT_UNCATEGORIZED(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;

template <class _Tp, class _Compare>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
_LIBCPP_LIFETIMEBOUND const _Tp& __hi,
_Compare __comp) {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
}

template<class _Tp>
_LIBCPP_NODISCARD_EXT inline
_LIBCPP_INLINE_VISIBILITY constexpr
const _Tp&
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
{
return _VSTD::clamp(__v, __lo, __hi, __less<>());
template <class _Tp>
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
_LIBCPP_LIFETIMEBOUND const _Tp& __hi) {
return std::clamp(__v, __lo, __hi, __less<>());
}
#endif

Expand Down
6 changes: 3 additions & 3 deletions system/lib/libcxx/include/__algorithm/comp.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/predicate_traits.h>
#include <__type_traits/operation_traits.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand All @@ -26,8 +26,8 @@ struct __equal_to {
}
};

template <class _Lhs, class _Rhs>
struct __is_trivial_equality_predicate<__equal_to, _Lhs, _Rhs> : true_type {};
template <class _Tp, class _Up>
struct __desugars_to<__equal_tag, __equal_to, _Tp, _Up> : true_type {};

// The definition is required because __less is part of the ABI, but it's empty
// because all comparisons should be transparent.
Expand Down
69 changes: 29 additions & 40 deletions system/lib/libcxx/include/__algorithm/comp_ref_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,41 @@
_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Compare>
struct __debug_less
{
_Compare &__comp_;
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}
struct __debug_less {
_Compare& __comp_;
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __debug_less(_Compare& __c) : __comp_(__c) {}

template <class _Tp, class _Up>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp& __x, const _Up& __y)
{
bool __r = __comp_(__x, __y);
if (__r)
__do_compare_assert(0, __y, __x);
return __r;
}
template <class _Tp, class _Up>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Up& __y) {
bool __r = __comp_(__x, __y);
if (__r)
__do_compare_assert(0, __y, __x);
return __r;
}

template <class _Tp, class _Up>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(_Tp& __x, _Up& __y)
{
bool __r = __comp_(__x, __y);
if (__r)
__do_compare_assert(0, __y, __x);
return __r;
}
template <class _Tp, class _Up>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(_Tp& __x, _Up& __y) {
bool __r = __comp_(__x, __y);
if (__r)
__do_compare_assert(0, __y, __x);
return __r;
}

template <class _LHS, class _RHS>
_LIBCPP_CONSTEXPR_SINCE_CXX14
inline _LIBCPP_INLINE_VISIBILITY
decltype((void)std::declval<_Compare&>()(
std::declval<_LHS &>(), std::declval<_RHS &>()))
__do_compare_assert(int, _LHS & __l, _RHS & __r) {
_LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r),
"Comparator does not induce a strict weak ordering");
(void)__l;
(void)__r;
}
template <class _LHS, class _RHS>
_LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(
std::declval<_LHS&>(), std::declval<_RHS&>()))
__do_compare_assert(int, _LHS& __l, _RHS& __r) {
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
(void)__l;
(void)__r;
}

template <class _LHS, class _RHS>
_LIBCPP_CONSTEXPR_SINCE_CXX14
inline _LIBCPP_INLINE_VISIBILITY
void __do_compare_assert(long, _LHS &, _RHS &) {}
template <class _LHS, class _RHS>
_LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI void __do_compare_assert(long, _LHS&, _RHS&) {}
};

// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
#if _LIBCPP_ENABLE_DEBUG_MODE
// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference.
#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
template <class _Comp>
using __comp_ref_type = __debug_less<_Comp>;
#else
Expand Down
7 changes: 4 additions & 3 deletions system/lib/libcxx/include/__algorithm/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ struct __copy_loop {

_OutIter& __result_;

_LIBCPP_HIDE_FROM_ABI _CopySegment(_OutIter& __result) : __result_(__result) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit _CopySegment(_OutIter& __result)
: __result_(__result) {}

_LIBCPP_HIDE_FROM_ABI void
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
operator()(typename _Traits::__local_iterator __lfirst, typename _Traits::__local_iterator __llast) {
__result_ = std::__copy<_AlgPolicy>(__lfirst, __llast, std::move(__result_)).second;
}
Expand Down Expand Up @@ -112,7 +113,7 @@ __copy(_InIter __first, _Sent __last, _OutIter __result) {
}

template <class _InputIterator, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
return std::__copy<_ClassicAlgPolicy>(__first, __last, __result).second;
}
Expand Down
16 changes: 6 additions & 10 deletions system/lib/libcxx/include/__algorithm/copy_backward.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ struct __copy_backward_loop {

struct __copy_backward_trivial {
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
template <class _In, class _Out,
__enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
template <class _In, class _Out, __enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
operator()(_In* __first, _In* __last, _Out* __result) const {
return std::__copy_backward_trivial_impl(__first, __last, __result);
Expand All @@ -124,16 +123,13 @@ __copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _Bidirectiona
}

template <class _BidirectionalIterator1, class _BidirectionalIterator2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
_BidirectionalIterator2
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
_BidirectionalIterator2 __result)
{
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
std::is_copy_constructible<_BidirectionalIterator1>::value,
"Iterators must be copy constructible.");

return std::__copy_backward<_ClassicAlgPolicy>(
std::move(__first), std::move(__last), std::move(__result)).second;
return std::__copy_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
}

_LIBCPP_END_NAMESPACE_STD
Expand Down
23 changes: 9 additions & 14 deletions system/lib/libcxx/include/__algorithm/copy_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@

_LIBCPP_BEGIN_NAMESPACE_STD

template<class _InputIterator, class _OutputIterator, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
_OutputIterator
copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred)
{
for (; __first != __last; ++__first)
{
if (__pred(*__first))
{
*__result = *__first;
++__result;
}
template <class _InputIterator, class _OutputIterator, class _Predicate>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) {
for (; __first != __last; ++__first) {
if (__pred(*__first)) {
*__result = *__first;
++__result;
}
return __result;
}
return __result;
}

_LIBCPP_END_NAMESPACE_STD
Expand Down
30 changes: 16 additions & 14 deletions system/lib/libcxx/include/__algorithm/copy_move_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,29 @@
# pragma GCC system_header
#endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

// Type traits.

template <class _From, class _To>
struct __can_lower_copy_assignment_to_memmove {
static const bool value =
// If the types are always bitcastable, it's valid to do a bitwise copy between them.
__is_always_bitcastable<_From, _To>::value &&
// Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
is_trivially_assignable<_To&, const _From&>::value &&
// `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
!is_volatile<_From>::value &&
!is_volatile<_To>::value;
// If the types are always bitcastable, it's valid to do a bitwise copy between them.
__is_always_bitcastable<_From, _To>::value &&
// Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
is_trivially_assignable<_To&, const _From&>::value &&
// `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
!is_volatile<_From>::value && !is_volatile<_To>::value;
};

template <class _From, class _To>
struct __can_lower_move_assignment_to_memmove {
static const bool value =
__is_always_bitcastable<_From, _To>::value &&
is_trivially_assignable<_To&, _From&&>::value &&
!is_volatile<_From>::value &&
!is_volatile<_To>::value;
__is_always_bitcastable<_From, _To>::value && is_trivially_assignable<_To&, _From&&>::value &&
!is_volatile<_From>::value && !is_volatile<_To>::value;
};

// `memmove` algorithms implementation.
Expand Down Expand Up @@ -95,8 +95,8 @@ struct __can_rewrap<_InIter,
_Sent,
_OutIter,
// Note that sentinels are always copy-constructible.
__enable_if_t< is_copy_constructible<_InIter>::value &&
is_copy_constructible<_OutIter>::value > > : true_type {};
__enable_if_t< is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value > >
: true_type {};

template <class _Algorithm,
class _InIter,
Expand All @@ -108,7 +108,7 @@ __unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
auto __range = std::__unwrap_range(__first, std::move(__last));
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
}

template <class _Algorithm,
Expand All @@ -135,4 +135,6 @@ __dispatch_copy_or_move(_InIter __first, _Sent __last, _OutIter __out_first) {

_LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H
Loading
Loading