aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-01-24 19:17:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:13:49 +0000
commit7a6dacaca14b62ca4b74406814becb87a3fefac0 (patch)
tree273a870ac27484bb1f5ee55e7ef0dc0d061f63e7 /contrib/llvm-project/libcxx
parent46c59ea9b61755455ff6bf9f3e7b834e1af634ea (diff)
parent4df029cc74e5ec124f14a5682e44999ce4f086df (diff)
Diffstat (limited to 'contrib/llvm-project/libcxx')
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/clamp.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/nth_element.h8
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/ranges_clamp.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/sort.h22
-rw-r--r--contrib/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h6
-rw-r--r--contrib/llvm-project/libcxx/include/__assert6
-rw-r--r--contrib/llvm-project/libcxx/include/__atomic/is_always_lock_free.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__availability29
-rw-r--r--contrib/llvm-project/libcxx/include/__bit/bit_ceil.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__chrono/ostream.h9
-rw-r--r--contrib/llvm-project/libcxx/include/__concepts/arithmetic.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__config71
-rw-r--r--contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h16
-rw-r--r--contrib/llvm-project/libcxx/include/__debug_utils/strict_weak_ordering_check.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__exception/exception_ptr.h50
-rw-r--r--contrib/llvm-project/libcxx/include/__expected/expected.h1142
-rw-r--r--contrib/llvm-project/libcxx/include/__hash_table2
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/allocator.h14
-rw-r--r--contrib/llvm-project/libcxx/include/__memory/assume_aligned.h4
-rw-r--r--contrib/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h5
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__numeric/saturation_arithmetic.h110
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/chunk_by_view.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/drop_while_view.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/filter_view.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/repeat_view.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/single_view.h2
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/take_while_view.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__ranges/transform_view.h3
-rw-r--r--contrib/llvm-project/libcxx/include/__utility/cmp.h43
-rw-r--r--contrib/llvm-project/libcxx/include/any3
-rw-r--r--contrib/llvm-project/libcxx/include/barrier23
-rw-r--r--contrib/llvm-project/libcxx/include/chrono4
-rw-r--r--contrib/llvm-project/libcxx/include/concepts2
-rw-r--r--contrib/llvm-project/libcxx/include/condition_variable93
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h3
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h7
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/simd.h6
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h6
-rw-r--r--contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h11
-rw-r--r--contrib/llvm-project/libcxx/include/future11
-rw-r--r--contrib/llvm-project/libcxx/include/latch21
-rw-r--r--contrib/llvm-project/libcxx/include/libcxx.imp888
-rw-r--r--contrib/llvm-project/libcxx/include/locale12
-rw-r--r--contrib/llvm-project/libcxx/include/memory2
-rw-r--r--contrib/llvm-project/libcxx/include/module.modulemap.in1
-rw-r--r--contrib/llvm-project/libcxx/include/new1
-rw-r--r--contrib/llvm-project/libcxx/include/numeric13
-rw-r--r--contrib/llvm-project/libcxx/include/ostream21
-rw-r--r--contrib/llvm-project/libcxx/include/print18
-rw-r--r--contrib/llvm-project/libcxx/include/regex11
-rw-r--r--contrib/llvm-project/libcxx/include/semaphore19
-rw-r--r--contrib/llvm-project/libcxx/include/shared_mutex11
-rw-r--r--contrib/llvm-project/libcxx/include/span16
-rw-r--r--contrib/llvm-project/libcxx/include/sstream2
-rw-r--r--contrib/llvm-project/libcxx/include/stop_token11
-rw-r--r--contrib/llvm-project/libcxx/include/string5
-rw-r--r--contrib/llvm-project/libcxx/include/string_view7
-rw-r--r--contrib/llvm-project/libcxx/include/thread11
-rw-r--r--contrib/llvm-project/libcxx/include/typeinfo1
-rw-r--r--contrib/llvm-project/libcxx/include/variant53
-rw-r--r--contrib/llvm-project/libcxx/include/vector14
-rw-r--r--contrib/llvm-project/libcxx/include/version4
-rw-r--r--contrib/llvm-project/libcxx/modules/modules.json.in26
-rw-r--r--contrib/llvm-project/libcxx/modules/std.compat.cppm.in125
-rw-r--r--contrib/llvm-project/libcxx/modules/std.compat/cstdlib.inc4
-rw-r--r--contrib/llvm-project/libcxx/modules/std.compat/ctime.inc2
-rw-r--r--contrib/llvm-project/libcxx/modules/std.cppm.in1
-rw-r--r--contrib/llvm-project/libcxx/modules/std/ctime.inc2
-rw-r--r--contrib/llvm-project/libcxx/modules/std/memory.inc2
-rw-r--r--contrib/llvm-project/libcxx/modules/std/numeric.inc10
-rw-r--r--contrib/llvm-project/libcxx/src/filesystem/operations.cpp26
-rw-r--r--contrib/llvm-project/libcxx/src/include/overridable_function.h119
-rw-r--r--contrib/llvm-project/libcxx/src/include/to_chars_floating_point.h2
-rw-r--r--contrib/llvm-project/libcxx/src/memory_resource.cpp3
-rw-r--r--contrib/llvm-project/libcxx/src/mutex.cpp8
-rw-r--r--contrib/llvm-project/libcxx/src/new.cpp107
-rw-r--r--contrib/llvm-project/libcxx/src/ostream.cpp2
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp8
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp8
-rw-r--r--contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp6
-rw-r--r--contrib/llvm-project/libcxx/vendor/llvm/default_assertion_handler.in31
84 files changed, 2560 insertions, 836 deletions
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/clamp.h b/contrib/llvm-project/libcxx/include/__algorithm/clamp.h
index 1631b2673c3f..003bf70dd4f0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/clamp.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/clamp.h
@@ -26,7 +26,7 @@ clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
_LIBCPP_LIFETIMEBOUND const _Tp& __hi,
_Compare __comp) {
- _LIBCPP_ASSERT_UNCATEGORIZED(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
}
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h b/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
index 15f4a535a30b..aa9350c38caa 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/comp_ref_type.h
@@ -44,7 +44,7 @@ struct __debug_less {
_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_UNCATEGORIZED(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
(void)__l;
(void)__r;
}
@@ -53,8 +53,7 @@ struct __debug_less {
_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.
+// 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>;
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h b/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
index a05970512595..37ddfbdacf04 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/nth_element.h
@@ -114,12 +114,12 @@ __nth_element(
while (true) {
while (!__comp(*__first, *__i)) {
++__i;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__i != __last,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
}
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__j != __first,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__j;
@@ -150,13 +150,13 @@ __nth_element(
// __m still guards upward moving __i
while (__comp(*__i, *__m)) {
++__i;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__i != __last,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
}
// It is now known that a guard exists for downward moving __j
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__j != __first,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__j;
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_clamp.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
index e6c86207254a..a1185e7278f0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
@@ -34,8 +34,9 @@ struct __fn {
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr const _Type& operator()(
const _Type& __value, const _Type& __low, const _Type& __high, _Comp __comp = {}, _Proj __proj = {}) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(!bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))),
- "Bad bounds passed to std::ranges::clamp");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ !bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))),
+ "Bad bounds passed to std::ranges::clamp");
auto&& __projected = std::invoke(__proj, __value);
if (std::invoke(__comp, std::forward<decltype(__projected)>(__projected), std::invoke(__proj, __low)))
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/sort.h b/contrib/llvm-project/libcxx/include/__algorithm/sort.h
index ac47489af0aa..451133a2d193 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/sort.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/sort.h
@@ -325,7 +325,7 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
do {
*__j = _Ops::__iter_move(__k);
__j = __k;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__k != __leftmost,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
} while (__comp(__t, *--__k)); // No need for bounds check due to the assumption stated above.
@@ -544,7 +544,7 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
// Not guarded since we know the last element is greater than the pivot.
do {
++__first;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__first != __end,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
} while (!__comp(__pivot, *__first));
@@ -557,7 +557,7 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
// It will be always guarded because __introsort will do the median-of-three
// before calling this.
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__last != __begin,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__last;
@@ -635,7 +635,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
// this.
do {
++__first;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__first != __end,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
} while (__comp(*__first, __pivot));
@@ -647,7 +647,7 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
} else {
// Guarded.
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__last != __begin,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__last;
@@ -665,12 +665,12 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
_Ops::iter_swap(__first, __last);
do {
++__first;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__first != __end,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
} while (__comp(*__first, __pivot));
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__last != __begin,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__last;
@@ -702,7 +702,7 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
// Guarded.
do {
++__first;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__first != __end,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
} while (!__comp(__pivot, *__first));
@@ -715,7 +715,7 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
// It will be always guarded because __introsort will do the
// median-of-three before calling this.
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__last != __begin,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__last;
@@ -725,12 +725,12 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
_Ops::iter_swap(__first, __last);
do {
++__first;
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__first != __end,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
} while (!__comp(__pivot, *__first));
do {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__last != __begin,
"Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?");
--__last;
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h b/contrib/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h
index 8fd15c5d66f2..70c5818976f0 100644
--- a/contrib/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h
+++ b/contrib/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h
@@ -50,14 +50,14 @@ struct __debug_three_way_comp {
__expected = _Order::greater;
if (__o == _Order::greater)
__expected = _Order::less;
- _LIBCPP_ASSERT_UNCATEGORIZED(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
+ __comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
(void)__l;
(void)__r;
}
};
-// Pass the comparator by lvalue reference. Or in debug mode, using a
-// debugging wrapper that stores a reference.
+// 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 __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
diff --git a/contrib/llvm-project/libcxx/include/__assert b/contrib/llvm-project/libcxx/include/__assert
index d4af7e6c7192..eb862b5369b2 100644
--- a/contrib/llvm-project/libcxx/include/__assert
+++ b/contrib/llvm-project/libcxx/include/__assert
@@ -10,8 +10,8 @@
#ifndef _LIBCPP___ASSERT
#define _LIBCPP___ASSERT
+#include <__assertion_handler> // Note: this include is generated by CMake and is potentially vendor-provided.
#include <__config>
-#include <__verbose_abort>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -20,8 +20,8 @@
#define _LIBCPP_ASSERT(expression, message) \
(__builtin_expect(static_cast<bool>(expression), 1) \
? (void)0 \
- : _LIBCPP_VERBOSE_ABORT( \
- "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message))
+ : _LIBCPP_ASSERTION_HANDLER(__FILE__ ":" _LIBCPP_TOSTRING(__LINE__) ": assertion " _LIBCPP_TOSTRING( \
+ expression) " failed: " message "\n"))
// TODO: __builtin_assume can currently inhibit optimizations. Until this has been fixed and we can add
// assumptions without a clear optimization intent, disable that to avoid worsening the code generation.
diff --git a/contrib/llvm-project/libcxx/include/__atomic/is_always_lock_free.h b/contrib/llvm-project/libcxx/include/__atomic/is_always_lock_free.h
index fbbd43707499..f928e79f70ce 100644
--- a/contrib/llvm-project/libcxx/include/__atomic/is_always_lock_free.h
+++ b/contrib/llvm-project/libcxx/include/__atomic/is_always_lock_free.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct __libcpp_is_always_lock_free {
// __atomic_always_lock_free is available in all Standard modes
- static const bool __value = __atomic_always_lock_free(sizeof(_Tp), 0);
+ static const bool __value = __atomic_always_lock_free(sizeof(_Tp), nullptr);
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__availability b/contrib/llvm-project/libcxx/include/__availability
index 5df2783dd0c7..c5069a027750 100644
--- a/contrib/llvm-project/libcxx/include/__availability
+++ b/contrib/llvm-project/libcxx/include/__availability
@@ -101,6 +101,12 @@
# define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST 1
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
+// These macros controls the availability of __cxa_init_primary_exception
+// in the built library, which std::make_exception_ptr might use
+// (see libcxx/include/__exception/exception_ptr.h).
+# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 1
+# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
+
// These macros control the availability of all parts of <filesystem> that
// depend on something in the dylib.
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1
@@ -136,9 +142,9 @@
# define _LIBCPP_AVAILABILITY_HAS_TZDB 1
# define _LIBCPP_AVAILABILITY_TZDB
- // This controls the availability of C++23 <print>, which
- // has a dependency on the built library (it needs access to
- // the underlying buffer types of std::cout, std::cerr, and std::clog.
+// This controls the availability of C++23 <print>, which
+// has a dependency on the built library (it needs access to
+// the underlying buffer types of std::cout, std::cerr, and std::clog.
# define _LIBCPP_AVAILABILITY_HAS_PRINT 1
# define _LIBCPP_AVAILABILITY_PRINT
@@ -167,6 +173,10 @@
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+// TODO: Update once this is released
+# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0
+# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION __attribute__((unavailable))
+
// <filesystem>
// clang-format off
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
@@ -264,6 +274,10 @@
# define _LIBCPP_AVAILABILITY_HAS_TZDB 0
# define _LIBCPP_AVAILABILITY_TZDB __attribute__((unavailable))
+// Warning: This availability macro works differently than the other macros.
+// The dylib part of print is not needed on Apple platforms. Therefore when
+// the macro is not available the code calling the dylib is commented out.
+// The macro _LIBCPP_AVAILABILITY_PRINT is not used.
# define _LIBCPP_AVAILABILITY_HAS_PRINT 0
# define _LIBCPP_AVAILABILITY_PRINT __attribute__((unavailable))
@@ -299,4 +313,13 @@
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
#endif
+// Define availability attributes that depend on both
+// _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI.
+#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI)
+# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
+# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
+# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0
+# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
+#endif
+
#endif // _LIBCPP___AVAILABILITY
diff --git a/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h b/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
index 17fe06aa41cc..77fa739503bc 100644
--- a/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
+++ b/contrib/llvm-project/libcxx/include/__bit/bit_ceil.h
@@ -28,7 +28,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp __bit_ceil(_Tp __t) no
if (__t < 2)
return 1;
const unsigned __n = numeric_limits<_Tp>::digits - std::__countl_zero((_Tp)(__t - 1u));
- _LIBCPP_ASSERT_UNCATEGORIZED(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil");
if constexpr (sizeof(_Tp) >= sizeof(unsigned))
return _Tp{1} << __n;
diff --git a/contrib/llvm-project/libcxx/include/__chrono/ostream.h b/contrib/llvm-project/libcxx/include/__chrono/ostream.h
index f171944b5cab..b687ef8059d5 100644
--- a/contrib/llvm-project/libcxx/include/__chrono/ostream.h
+++ b/contrib/llvm-project/libcxx/include/__chrono/ostream.h
@@ -42,11 +42,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono {
template <class _CharT, class _Traits, class _Duration>
+ requires(!treat_as_floating_point_v<typename _Duration::rep> && _Duration{1} < days{1})
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration> __tp) {
+operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration>& __tp) {
return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp);
}
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_days& __dp) {
+ return __os << year_month_day{__dp};
+}
+
template <class _CharT, class _Traits, class _Duration>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const file_time<_Duration> __tp) {
diff --git a/contrib/llvm-project/libcxx/include/__concepts/arithmetic.h b/contrib/llvm-project/libcxx/include/__concepts/arithmetic.h
index f41e4c9f2747..0c44f117805f 100644
--- a/contrib/llvm-project/libcxx/include/__concepts/arithmetic.h
+++ b/contrib/llvm-project/libcxx/include/__concepts/arithmetic.h
@@ -42,9 +42,13 @@ concept floating_point = is_floating_point_v<_Tp>;
template <class _Tp>
concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
+
template <class _Tp>
concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
+template <class _Tp>
+concept __libcpp_integer = __libcpp_unsigned_integer<_Tp> || __libcpp_signed_integer<_Tp>;
+
#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config
index 9154be8d8577..2eada10e96ce 100644
--- a/contrib/llvm-project/libcxx/include/__config
+++ b/contrib/llvm-project/libcxx/include/__config
@@ -16,6 +16,17 @@
# pragma GCC system_header
#endif
+#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
+# pragma clang deprecated( \
+ _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES, \
+ "_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES is deprecated in LLVM 18 and will be removed in LLVM 19")
+#endif
+#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
+# pragma clang deprecated( \
+ _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES, \
+ "_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES is deprecated in LLVM 18 and will be removed in LLVM 19")
+#endif
+
#if defined(__apple_build_version__)
// Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403)
# define _LIBCPP_COMPILER_CLANG_BASED
@@ -209,8 +220,8 @@
// https://github.com/llvm/llvm-project/issues/70494
//
// To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions.
-// The below macro is used for all classes whose ABI have changed as part of fixing these bugs.
-# define _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG __attribute__((__abi_tag__("subobj_fix_2023")))
+// The macro below is used for all classes whose ABI have changed as part of fixing these bugs.
+# define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua")))
// Changes the iterator type of select containers (see below) to a bounded iterator that keeps track of whether it's
// within the bounds of the original container and asserts it on every dereference.
@@ -282,12 +293,32 @@
// - `_LIBCPP_ASSERT_NON_OVERLAPPING_RANGES` -- for functions that take several ranges as arguments, checks that the
// given ranges do not overlap.
//
+// - `_LIBCPP_ASSERT_VALID_DEALLOCATION` -- checks that an attempt to deallocate memory is valid (e.g. the given object
+// was allocated by the given allocator). Violating this category typically results in a memory leak.
+//
+// - `_LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL` -- checks that a call to an external API doesn't fail in
+// an unexpected manner. This includes triggering documented cases of undefined behavior in an external library (like
+// attempting to unlock an unlocked mutex in pthreads). Any API external to the library falls under this category
+// (from system calls to compiler intrinsics). We generally don't expect these failures to compromize memory safety or
+// otherwise create an immediate security issue.
+//
// - `_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR` -- checks any operations that exchange nodes between containers to make sure
// the containers have compatible allocators.
//
+// - `_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN` -- checks that the given argument is within the domain of valid arguments
+// for the function. Violating this typically produces an incorrect result (e.g. the clamp algorithm returns the
+// original value without clamping it due to incorrect functors) or puts an object into an invalid state (e.g.
+// a string view where only a subset of elements is possible to access). This category is for assertions violating
+// which doesn't cause any immediate issues in the library -- whatever the consequences are, they will happen in the
+// user code.
+//
// - `_LIBCPP_ASSERT_PEDANTIC` -- checks prerequisites which are imposed by the Standard, but violating which happens to
// be benign in our implementation.
//
+// - `_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT` -- checks that the given argument satisfies the semantic requirements imposed
+// by the Standard. Typically, there is no simple way to completely prove that a semantic requirement is satisfied;
+// thus, this would often be a heuristic check and it might be quite expensive.
+//
// - `_LIBCPP_ASSERT_INTERNAL` -- checks that internal invariants of the library hold. These assertions don't depend on
// user input.
//
@@ -329,8 +360,12 @@ _LIBCPP_HARDENING_MODE_DEBUG
// Overlapping ranges will make algorithms produce incorrect results but don't directly lead to a security
// vulnerability.
# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
@@ -343,10 +378,14 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message)
-# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
// Disabled checks.
+# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
// Debug hardening mode checks.
@@ -358,8 +397,12 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSERT(expression, message)
+# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSERT(expression, message)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message)
@@ -372,8 +415,12 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_NON_NULL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_VALID_DEALLOCATION(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_PEDANTIC(expression, message) _LIBCPP_ASSUME(expression)
+# define _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_INTERNAL(expression, message) _LIBCPP_ASSUME(expression)
# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression)
@@ -1191,7 +1238,18 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
# define _LIBCPP_CONSTINIT
# endif
-# if __has_attribute(__noinline__)
+# if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
+// The CUDA SDK contains an unfortunate definition for the __noinline__ macro,
+// which breaks the regular __attribute__((__noinline__)) syntax. Therefore,
+// when compiling for CUDA we use the non-underscored version of the noinline
+// attribute.
+//
+// This is a temporary workaround and we still expect the CUDA SDK team to solve
+// this issue properly in the SDK headers.
+//
+// See https://github.com/llvm/llvm-project/pull/73838 for more details.
+# define _LIBCPP_NOINLINE __attribute__((noinline))
+# elif __has_attribute(__noinline__)
# define _LIBCPP_NOINLINE __attribute__((__noinline__))
# else
# define _LIBCPP_NOINLINE
@@ -1505,6 +1563,11 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
# endif
+// Clang-18 has support for deducing this, but it does not set the FTM.
+# if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1800)
+# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
+# endif
+
#endif // __cplusplus
#endif // _LIBCPP___CONFIG
diff --git a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
index 54bfe5b44f4c..4557a6643c23 100644
--- a/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
+++ b/contrib/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
@@ -55,7 +55,7 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
_LIBCPP_HIDE_FROM_ABI bool done() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
return __builtin_coro_done(__handle_);
}
@@ -63,13 +63,13 @@ public:
_LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
_LIBCPP_HIDE_FROM_ABI void resume() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "resume() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(!done(), "resume() has undefined behavior when the coroutine is done");
__builtin_coro_resume(__handle_);
}
_LIBCPP_HIDE_FROM_ABI void destroy() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "destroy() can be called only on suspended coroutines");
__builtin_coro_destroy(__handle_);
}
@@ -130,7 +130,7 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __handle_ != nullptr; }
_LIBCPP_HIDE_FROM_ABI bool done() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "done() can be called only on suspended coroutines");
return __builtin_coro_done(__handle_);
}
@@ -138,13 +138,13 @@ public:
_LIBCPP_HIDE_FROM_ABI void operator()() const { resume(); }
_LIBCPP_HIDE_FROM_ABI void resume() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines");
- _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "resume() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(!done(), "resume() has undefined behavior when the coroutine is done");
__builtin_coro_resume(__handle_);
}
_LIBCPP_HIDE_FROM_ABI void destroy() const {
- _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(__is_suspended(), "destroy() can be called only on suspended coroutines");
__builtin_coro_destroy(__handle_);
}
diff --git a/contrib/llvm-project/libcxx/include/__debug_utils/strict_weak_ordering_check.h b/contrib/llvm-project/libcxx/include/__debug_utils/strict_weak_ordering_check.h
index 99200ad65eac..3a9d88728416 100644
--- a/contrib/llvm-project/libcxx/include/__debug_utils/strict_weak_ordering_check.h
+++ b/contrib/llvm-project/libcxx/include/__debug_utils/strict_weak_ordering_check.h
@@ -26,12 +26,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _RandomAccessIterator, class _Comp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
__check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) {
-#ifdef _LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
using __diff_t = __iter_diff_t<_RandomAccessIterator>;
using _Comp_ref = __comp_ref_type<_Comp>;
if (!__libcpp_is_constant_evaluated()) {
// Check if the range is actually sorted.
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
(std::is_sorted<_RandomAccessIterator, _Comp_ref>(__first, __last, _Comp_ref(__comp))),
"The range is not sorted after the sort, your comparator is not a valid strict-weak ordering");
// Limit the number of elements we need to check.
@@ -46,18 +46,18 @@ __check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccess
// Check that the elements from __p to __q are equal between each other.
for (__diff_t __b = __p; __b < __q; ++__b) {
for (__diff_t __a = __p; __a <= __b; ++__a) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
!__comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering");
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
!__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering");
}
}
// Check that elements between __p and __q are less than between __q and __size.
for (__diff_t __a = __p; __a < __q; ++__a) {
for (__diff_t __b = __q; __b < __size; ++__b) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
__comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering");
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(
!__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering");
}
}
@@ -69,7 +69,7 @@ __check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccess
(void)__first;
(void)__last;
(void)__comp;
-#endif
+#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__exception/exception_ptr.h b/contrib/llvm-project/libcxx/include/__exception/exception_ptr.h
index 970d8196724b..53e2f718bc1b 100644
--- a/contrib/llvm-project/libcxx/include/__exception/exception_ptr.h
+++ b/contrib/llvm-project/libcxx/include/__exception/exception_ptr.h
@@ -9,16 +9,44 @@
#ifndef _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
#define _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
+#include <__availability>
#include <__config>
#include <__exception/operations.h>
#include <__memory/addressof.h>
+#include <__memory/construct_at.h>
+#include <__type_traits/decay.h>
#include <cstddef>
#include <cstdlib>
+#include <new>
+#include <typeinfo>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
+#ifndef _LIBCPP_ABI_MICROSOFT
+
+namespace __cxxabiv1 {
+
+extern "C" {
+_LIBCPP_OVERRIDABLE_FUNC_VIS void* __cxa_allocate_exception(size_t) throw();
+_LIBCPP_OVERRIDABLE_FUNC_VIS void __cxa_free_exception(void*) throw();
+
+struct __cxa_exception;
+_LIBCPP_OVERRIDABLE_FUNC_VIS __cxa_exception* __cxa_init_primary_exception(
+ void*,
+ std::type_info*,
+ void(
+# if defined(_WIN32)
+ __thiscall
+# endif
+ *)(void*)) throw();
+}
+
+} // namespace __cxxabiv1
+
+#endif
+
namespace std { // purposefully not using versioning namespace
#ifndef _LIBCPP_ABI_MICROSOFT
@@ -26,6 +54,11 @@ namespace std { // purposefully not using versioning namespace
class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
void* __ptr_;
+ static exception_ptr __from_native_exception_pointer(void*) _NOEXCEPT;
+
+ template <class _Ep>
+ friend _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT;
+
public:
_LIBCPP_HIDE_FROM_ABI exception_ptr() _NOEXCEPT : __ptr_() {}
_LIBCPP_HIDE_FROM_ABI exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
@@ -51,11 +84,28 @@ public:
template <class _Ep>
_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L
+ using _Ep2 = __decay_t<_Ep>;
+
+ void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep));
+ (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) {
+ std::__destroy_at(static_cast<_Ep2*>(__p));
+ });
+
+ try {
+ ::new (__ex) _Ep2(__e);
+ return exception_ptr::__from_native_exception_pointer(__ex);
+ } catch (...) {
+ __cxxabiv1::__cxa_free_exception(__ex);
+ return current_exception();
+ }
+# else
try {
throw __e;
} catch (...) {
return current_exception();
}
+# endif
# else
((void)__e);
std::abort();
diff --git a/contrib/llvm-project/libcxx/include/__expected/expected.h b/contrib/llvm-project/libcxx/include/__expected/expected.h
index 97f92bdfe44c..443d9257dc59 100644
--- a/contrib/llvm-project/libcxx/include/__expected/expected.h
+++ b/contrib/llvm-project/libcxx/include/__expected/expected.h
@@ -88,8 +88,372 @@ _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
# endif
}
+// If parameter type `_Tp` of `__conditional_no_unique_address` is neither
+// copyable nor movable, a constructor with this tag is provided. For that
+// constructor, the user has to provide a function and arguments. The function
+// must return an object of type `_Tp`. When the function is invoked by the
+// constructor, guaranteed copy elision kicks in and the `_Tp` is constructed
+// in place.
+struct __conditional_no_unique_address_invoke_tag {};
+
+// This class implements an object with `[[no_unique_address]]` conditionally applied to it,
+// based on the value of `_NoUnique`.
+//
+// A member of this class must always have `[[no_unique_address]]` applied to
+// it. Otherwise, the `[[no_unique_address]]` in the "`_NoUnique == true`" case
+// would not have any effect. In the `false` case, the `__v` is not
+// `[[no_unique_address]]`, so nullifies the effects of the "outer"
+// `[[no_unique_address]]` regarding data layout.
+//
+// If we had a language feature, this class would basically be replaced by `[[no_unique_address(condition)]]`.
+template <bool _NoUnique, class _Tp>
+struct __conditional_no_unique_address;
+
+template <class _Tp>
+struct __conditional_no_unique_address<true, _Tp> {
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(in_place_t, _Args&&... __args)
+ : __v(std::forward<_Args>(__args)...) {}
+
+ template <class _Func, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(
+ __conditional_no_unique_address_invoke_tag, _Func&& __f, _Args&&... __args)
+ : __v(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _Tp __v;
+};
+
+template <class _Tp>
+struct __conditional_no_unique_address<false, _Tp> {
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(in_place_t, _Args&&... __args)
+ : __v(std::forward<_Args>(__args)...) {}
+
+ template <class _Func, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __conditional_no_unique_address(
+ __conditional_no_unique_address_invoke_tag, _Func&& __f, _Args&&... __args)
+ : __v(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+
+ _Tp __v;
+};
+
+// This function returns whether the type `_Second` can be stuffed into the tail padding
+// of the `_First` type if both of them are given `[[no_unique_address]]`.
+template <class _First, class _Second>
+inline constexpr bool __fits_in_tail_padding = []() {
+ struct __x {
+ _LIBCPP_NO_UNIQUE_ADDRESS _First __first;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Second __second;
+ };
+ return sizeof(__x) == sizeof(_First);
+}();
+
+// This class implements the storage used by `std::expected`. We have a few
+// goals for this storage:
+// 1. Whenever the underlying {_Tp | _Unex} combination has free bytes in its
+// tail padding, we should reuse it to store the bool discriminator of the
+// expected, so as to save space.
+// 2. Whenever the `expected<_Tp, _Unex>` as a whole has free bytes in its tail
+// padding, we should allow an object following the expected to be stored in
+// its tail padding.
+// 3. However, we never want a user object (say `X`) that would follow an
+// `expected<_Tp, _Unex>` to be stored in the padding bytes of the
+// underlying {_Tp | _Unex} union, if any. That is because we use
+// `construct_at` on that union, which would end up overwriting the `X`
+// member if it is stored in the tail padding of the union.
+//
+// To achieve this, `__expected_base`'s logic is implemented in an inner
+// `__repr` class. `__expected_base` holds one `__repr` member which is
+// conditionally `[[no_unique_address]]`. The `__repr` class holds the
+// underlying {_Tp | _Unex} union and a boolean "has value" flag.
+//
+// Which one of the `__repr_`/`__union_` members is `[[no_unique_address]]`
+// depends on whether the "has value" boolean fits into the tail padding of
+// the underlying {_Tp | _Unex} union:
+//
+// - In case the "has value" bool fits into the tail padding of the union, the
+// whole `__repr_` member is _not_ `[[no_unique_address]]` as it needs to be
+// transparently replaced on `emplace()`/`swap()` etc.
+// - In case the "has value" bool does not fit into the tail padding of the
+// union, only the union member must be transparently replaced (therefore is
+// _not_ `[[no_unique_address]]`) and the "has value" flag must be adjusted
+// manually.
+//
+// This way, the member that is transparently replaced on mutating operations
+// is never `[[no_unique_address]]`, satisfying the requirements from
+// "[basic.life]" in the standard.
+//
+// Stripped away of all superfluous elements, the layout of `__expected_base`
+// then looks like this:
+//
+// template <class Tp, class Err>
+// class expected_base {
+// union union_t {
+// [[no_unique_address]] Tp val;
+// [[no_unique_address]] Err unex;
+// };
+//
+// static constexpr bool put_flag_in_tail = fits_in_tail_padding<union_t, bool>;
+// static constexpr bool allow_reusing_expected_tail_padding = !put_flag_in_tail;
+//
+// struct repr {
+// private:
+// // If "has value" fits into the tail, this should be
+// // `[[no_unique_address]]`, otherwise not.
+// [[no_unique_address]] conditional_no_unique_address<
+// put_flag_in_tail,
+// union_t>::type union_;
+// [[no_unique_address]] bool has_val_;
+// };
+//
+// protected:
+// // If "has value" fits into the tail, this must _not_ be
+// // `[[no_unique_address]]` so that we fill out the
+// // complete `expected` object.
+// [[no_unique_address]] conditional_no_unique_address<
+// allow_reusing_expected_tail_padding,
+// repr>::type repr_;
+// };
+//
template <class _Tp, class _Err>
-class expected {
+class __expected_base {
+ // use named union because [[no_unique_address]] cannot be applied to an unnamed union,
+ // also guaranteed elision into a potentially-overlapping subobject is unsettled (and
+ // it's not clear that it's implementable, given that the function is allowed to clobber
+ // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107.
+ union __union_t {
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&)
+ requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
+ is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>)
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&)
+ requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
+ is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(__union_t&&) = delete;
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(in_place_t, _Args&&... __args)
+ : __val_(std::forward<_Args>(__args)...) {}
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(unexpect_t, _Args&&... __args)
+ : __unex_(std::forward<_Args>(__args)...) {}
+
+ template <class _Func, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
+ std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args)
+ : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+
+ template <class _Func, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
+ std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
+ : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
+ requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>)
+ = default;
+
+ // __repr's destructor handles this
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {}
+
+ _LIBCPP_NO_UNIQUE_ADDRESS _Tp __val_;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_;
+ };
+
+ static constexpr bool __put_flag_in_tail = __fits_in_tail_padding<__union_t, bool>;
+ static constexpr bool __allow_reusing_expected_tail_padding = !__put_flag_in_tail;
+
+ struct __repr {
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr() = delete;
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(in_place_t __tag, _Args&&... __args)
+ : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(true) {}
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(unexpect_t __tag, _Args&&... __args)
+ : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_in_place_from_invoke_tag __tag,
+ _Args&&... __args)
+ : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(true) {}
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_unexpected_from_invoke_tag __tag,
+ _Args&&... __args)
+ : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
+
+ // The return value of `__make_union` must be constructed in place in the
+ // `__v` member of `__union_`, relying on guaranteed copy elision. To do
+ // this, the `__conditional_no_unique_address_invoke_tag` constructor is
+ // called with a lambda that is immediately called inside
+ // `__conditional_no_unique_address`'s constructor.
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(bool __has_val, _OtherUnion&& __other)
+ requires(__allow_reusing_expected_tail_padding)
+ : __union_(__conditional_no_unique_address_invoke_tag{},
+ [&] { return __make_union(__has_val, std::forward<_OtherUnion>(__other)); }),
+ __has_val_(__has_val) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&)
+ requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
+ is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>)
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&)
+ requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
+ is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>)
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(const __repr&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(__repr&&) = delete;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
+ requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>)
+ = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
+ requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>)
+ {
+ __destroy_union_member();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
+ requires(__allow_reusing_expected_tail_padding &&
+ (is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>))
+ {
+ // Note: Since the destructor of the union is trivial, this does nothing
+ // except to end the lifetime of the union.
+ std::destroy_at(&__union_.__v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
+ requires(__allow_reusing_expected_tail_padding &&
+ (!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>))
+ {
+ __destroy_union_member();
+ std::destroy_at(&__union_.__v);
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(in_place_t, _Args&&... __args)
+ requires(__allow_reusing_expected_tail_padding)
+ {
+ std::construct_at(&__union_.__v, in_place, std::forward<_Args>(__args)...);
+ __has_val_ = true;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(unexpect_t, _Args&&... __args)
+ requires(__allow_reusing_expected_tail_padding)
+ {
+ std::construct_at(&__union_.__v, unexpect, std::forward<_Args>(__args)...);
+ __has_val_ = false;
+ }
+
+ private:
+ template <class, class>
+ friend class __expected_base;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union_member()
+ requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>)
+ {
+ if (__has_val_) {
+ std::destroy_at(std::addressof(__union_.__v.__val_));
+ } else {
+ std::destroy_at(std::addressof(__union_.__v.__unex_));
+ }
+ }
+
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI static constexpr __union_t __make_union(bool __has_val, _OtherUnion&& __other)
+ requires(__allow_reusing_expected_tail_padding)
+ {
+ if (__has_val)
+ return __union_t(in_place, std::forward<_OtherUnion>(__other).__val_);
+ else
+ return __union_t(unexpect, std::forward<_OtherUnion>(__other).__unex_);
+ }
+
+ _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__put_flag_in_tail, __union_t> __union_;
+ _LIBCPP_NO_UNIQUE_ADDRESS bool __has_val_;
+ };
+
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI static constexpr __repr __make_repr(bool __has_val, _OtherUnion&& __other)
+ requires(__put_flag_in_tail)
+ {
+ if (__has_val)
+ return __repr(in_place, std::forward<_OtherUnion>(__other).__val_);
+ else
+ return __repr(unexpect, std::forward<_OtherUnion>(__other).__unex_);
+ }
+
+protected:
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_base(_Args&&... __args)
+ : __repr_(in_place, std::forward<_Args>(__args)...) {}
+
+ // In case we copy/move construct from another `expected` we need to create
+ // our `expected` so that it either has a value or not, depending on the "has
+ // value" flag of the other `expected`. To do this without falling back on
+ // `std::construct_at` we rely on guaranteed copy elision using two helper
+ // functions `__make_repr` and `__make_union`. There have to be two since
+ // there are two data layouts with different members being
+ // `[[no_unique_address]]`. GCC (as of version 13) does not do guaranteed
+ // copy elision when initializing `[[no_unique_address]]` members. The two
+ // cases are:
+ //
+ // - `__make_repr`: This is used when the "has value" flag lives in the tail
+ // of the union. In this case, the `__repr` member is _not_
+ // `[[no_unique_address]]`.
+ // - `__make_union`: When the "has value" flag does _not_ fit in the tail of
+ // the union, the `__repr` member is `[[no_unique_address]]` and the union
+ // is not.
+ //
+ // This constructor "catches" the first case and leaves the second case to
+ // `__union_t`, its constructors and `__make_union`.
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_base(bool __has_val, _OtherUnion&& __other)
+ requires(__put_flag_in_tail)
+ : __repr_(__conditional_no_unique_address_invoke_tag{},
+ [&] { return __make_repr(__has_val, std::forward<_OtherUnion>(__other)); }) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy() {
+ if constexpr (__put_flag_in_tail)
+ std::destroy_at(&__repr_.__v);
+ else
+ __repr_.__v.__destroy_union();
+ }
+
+ template <class _Tag, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __construct(_Tag __tag, _Args&&... __args) {
+ if constexpr (__put_flag_in_tail)
+ std::construct_at(&__repr_.__v, __tag, std::forward<_Args>(__args)...);
+ else
+ __repr_.__v.__construct_union(__tag, std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_val() const { return __repr_.__v.__has_val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t& __union() { return __repr_.__v.__union_.__v; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const __union_t& __union() const { return __repr_.__v.__union_.__v; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Tp& __val() { return __repr_.__v.__union_.__v.__val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& __val() const { return __repr_.__v.__union_.__v.__val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Err& __unex() { return __repr_.__v.__union_.__v.__unex_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Err& __unex() const { return __repr_.__v.__union_.__v.__unex_; }
+
+private:
+ _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_;
+};
+
+template <class _Tp, class _Err>
+class expected : private __expected_base<_Tp, _Err> {
static_assert(!is_reference_v<_Tp> && !is_function_v<_Tp> && !is_same_v<remove_cv_t<_Tp>, in_place_t> &&
!is_same_v<remove_cv_t<_Tp>, unexpect_t> && !__is_std_unexpected<remove_cv_t<_Tp>>::value &&
__valid_std_unexpected<_Err>::value,
@@ -102,6 +466,8 @@ class expected {
template <class _Up, class _OtherErr>
friend class expected;
+ using __base = __expected_base<_Tp, _Err>;
+
public:
using value_type = _Tp;
using error_type = _Err;
@@ -113,7 +479,7 @@ public:
// [expected.object.ctor], constructors
_LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept(is_nothrow_default_constructible_v<_Tp>) // strengthened
requires is_default_constructible_v<_Tp>
- : __union_(std::in_place), __has_val_(true) {}
+ : __base(in_place) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
@@ -126,7 +492,7 @@ public:
is_nothrow_copy_constructible_v<_Tp> && is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_constructible_v<_Tp> && is_copy_constructible_v<_Err> &&
!(is_trivially_copy_constructible_v<_Tp> && is_trivially_copy_constructible_v<_Err>))
- : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {}
+ : __base(__other.__has_val(), __other.__union()) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Tp> &&
@@ -137,7 +503,7 @@ public:
is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_constructible_v<_Err>)
requires(is_move_constructible_v<_Tp> && is_move_constructible_v<_Err> &&
!(is_trivially_move_constructible_v<_Tp> && is_trivially_move_constructible_v<_Err>))
- : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {}
+ : __base(__other.__has_val(), std::move(__other.__union())) {}
private:
template <class _Up, class _OtherErr, class _UfQual, class _OtherErrQual>
@@ -162,12 +528,12 @@ private:
template <class _Func, class... _Args>
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
std::__expected_construct_in_place_from_invoke_tag __tag, _Func&& __f, _Args&&... __args)
- : __union_(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...), __has_val_(true) {}
+ : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {}
template <class _Func, class... _Args>
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
std::__expected_construct_unexpected_from_invoke_tag __tag, _Func&& __f, _Args&&... __args)
- : __union_(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...), __has_val_(false) {}
+ : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {}
public:
template <class _Up, class _OtherErr>
@@ -177,14 +543,14 @@ public:
expected(const expected<_Up, _OtherErr>& __other) noexcept(
is_nothrow_constructible_v<_Tp, const _Up&> &&
is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __union_(__other.__has_val_, __other.__union_), __has_val_(__other.__has_val_) {}
+ : __base(__other.__has_val(), __other.__union()) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, _Up, _OtherErr>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp> || !is_convertible_v<_OtherErr, _Err>)
expected(expected<_Up, _OtherErr>&& __other) noexcept(
is_nothrow_constructible_v<_Tp, _Up> && is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __union_(__other.__has_val_, std::move(__other.__union_)), __has_val_(__other.__has_val_) {}
+ : __base(__other.__has_val(), std::move(__other.__union())) {}
template <class _Up = _Tp>
requires(!is_same_v<remove_cvref_t<_Up>, in_place_t> && !is_same_v<expected, remove_cvref_t<_Up>> &&
@@ -192,80 +558,67 @@ public:
(!is_same_v<remove_cv_t<_Tp>, bool> || !__is_std_expected<remove_cvref_t<_Up>>::value))
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up, _Tp>)
expected(_Up&& __u) noexcept(is_nothrow_constructible_v<_Tp, _Up>) // strengthened
- : __union_(std::in_place, std::forward<_Up>(__u)), __has_val_(true) {}
+ : __base(in_place, std::forward<_Up>(__u)) {}
template <class _OtherErr>
requires is_constructible_v<_Err, const _OtherErr&>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __union_(std::unexpect, __unex.error()), __has_val_(false) {}
+ : __base(unexpect, __unex.error()) {}
template <class _OtherErr>
requires is_constructible_v<_Err, _OtherErr>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {}
+ : __base(unexpect, std::move(__unex.error())) {}
template <class... _Args>
requires is_constructible_v<_Tp, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Tp, _Args...>) // strengthened
- : __union_(std::in_place, std::forward<_Args>(__args)...), __has_val_(true) {}
+ : __base(in_place, std::forward<_Args>(__args)...) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Tp, initializer_list<_Up>&, _Args... >
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) // strengthened
- : __union_(std::in_place, __il, std::forward<_Args>(__args)...), __has_val_(true) {}
+ : __base(in_place, __il, std::forward<_Args>(__args)...) {}
template <class... _Args>
requires is_constructible_v<_Err, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Err, _Args...>) // strengthened
- : __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {}
+ : __base(unexpect, std::forward<_Args>(__args)...) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
- : __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {}
+ : __base(unexpect, __il, std::forward<_Args>(__args)...) {}
// [expected.object.dtor], destructor
- _LIBCPP_HIDE_FROM_ABI constexpr ~expected()
- requires(is_trivially_destructible_v<_Tp> && is_trivially_destructible_v<_Err>)
- = default;
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~expected()
- requires(!is_trivially_destructible_v<_Tp> || !is_trivially_destructible_v<_Err>)
- {
- if (__has_val_) {
- std::destroy_at(std::addressof(__union_.__val_));
- } else {
- std::destroy_at(std::addressof(__union_.__unex_));
- }
- }
+ _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default;
private:
- template <class _T1, class _T2, class... _Args>
- _LIBCPP_HIDE_FROM_ABI static constexpr void __reinit_expected(_T1& __newval, _T2& __oldval, _Args&&... __args) {
+ template <class _Tag, class _OtherTag, class _T1, class _T2, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(_T2& __oldval, _Args&&... __args) {
if constexpr (is_nothrow_constructible_v<_T1, _Args...>) {
- std::destroy_at(std::addressof(__oldval));
- std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...);
+ this->__destroy();
+ this->__construct(_Tag{}, std::forward<_Args>(__args)...);
} else if constexpr (is_nothrow_move_constructible_v<_T1>) {
_T1 __tmp(std::forward<_Args>(__args)...);
- std::destroy_at(std::addressof(__oldval));
- std::construct_at(std::addressof(__newval), std::move(__tmp));
+ this->__destroy();
+ this->__construct(_Tag{}, std::move(__tmp));
} else {
static_assert(
is_nothrow_move_constructible_v<_T2>,
"To provide strong exception guarantee, T2 has to satisfy `is_nothrow_move_constructible_v` so that it can "
"be reverted to the previous state in case an exception is thrown during the assignment.");
_T2 __tmp(std::move(__oldval));
- std::destroy_at(std::addressof(__oldval));
- auto __trans =
- std::__make_exception_guard([&] { std::construct_at(std::addressof(__oldval), std::move(__tmp)); });
- std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...);
+ this->__destroy();
+ auto __trans = std::__make_exception_guard([&] { this->__construct(_OtherTag{}, std::move(__tmp)); });
+ this->__construct(_Tag{}, std::forward<_Args>(__args)...);
__trans.__complete();
}
}
@@ -281,17 +634,15 @@ public:
is_copy_constructible_v<_Err> &&
(is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
- if (__has_val_ && __rhs.__has_val_) {
- __union_.__val_ = __rhs.__union_.__val_;
- } else if (__has_val_) {
- __reinit_expected(__union_.__unex_, __union_.__val_, __rhs.__union_.__unex_);
- } else if (__rhs.__has_val_) {
- __reinit_expected(__union_.__val_, __union_.__unex_, __rhs.__union_.__val_);
+ if (this->__has_val() && __rhs.__has_val()) {
+ this->__val() = __rhs.__val();
+ } else if (this->__has_val()) {
+ __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), __rhs.__unex());
+ } else if (__rhs.__has_val()) {
+ __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), __rhs.__val());
} else {
- __union_.__unex_ = __rhs.__union_.__unex_;
+ this->__unex() = __rhs.__unex();
}
- // note: only reached if no exception+rollback was done inside __reinit_expected
- __has_val_ = __rhs.__has_val_;
return *this;
}
@@ -302,17 +653,15 @@ public:
is_move_assignable_v<_Err> &&
(is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
- if (__has_val_ && __rhs.__has_val_) {
- __union_.__val_ = std::move(__rhs.__union_.__val_);
- } else if (__has_val_) {
- __reinit_expected(__union_.__unex_, __union_.__val_, std::move(__rhs.__union_.__unex_));
- } else if (__rhs.__has_val_) {
- __reinit_expected(__union_.__val_, __union_.__unex_, std::move(__rhs.__union_.__val_));
+ if (this->__has_val() && __rhs.__has_val()) {
+ this->__val() = std::move(__rhs.__val());
+ } else if (this->__has_val()) {
+ __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), std::move(__rhs.__unex()));
+ } else if (__rhs.__has_val()) {
+ __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), std::move(__rhs.__val()));
} else {
- __union_.__unex_ = std::move(__rhs.__union_.__unex_);
+ this->__unex() = std::move(__rhs.__unex());
}
- // note: only reached if no exception+rollback was done inside __reinit_expected
- __has_val_ = __rhs.__has_val_;
return *this;
}
@@ -323,11 +672,10 @@ public:
(is_nothrow_constructible_v<_Tp, _Up> || is_nothrow_move_constructible_v<_Tp> ||
is_nothrow_move_constructible_v<_Err>))
{
- if (__has_val_) {
- __union_.__val_ = std::forward<_Up>(__v);
+ if (this->__has_val()) {
+ this->__val() = std::forward<_Up>(__v);
} else {
- __reinit_expected(__union_.__val_, __union_.__unex_, std::forward<_Up>(__v));
- __has_val_ = true;
+ __reinit_expected<in_place_t, unexpect_t, _Tp, _Err>(this->__unex(), std::forward<_Up>(__v));
}
return *this;
}
@@ -346,11 +694,10 @@ public:
template <class _OtherErr>
requires(__can_assign_from_unexpected<const _OtherErr&>)
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) {
- if (__has_val_) {
- __reinit_expected(__union_.__unex_, __union_.__val_, __un.error());
- __has_val_ = false;
+ if (this->__has_val()) {
+ __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), __un.error());
} else {
- __union_.__unex_ = __un.error();
+ this->__unex() = __un.error();
}
return *this;
}
@@ -358,11 +705,10 @@ public:
template <class _OtherErr>
requires(__can_assign_from_unexpected<_OtherErr>)
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) {
- if (__has_val_) {
- __reinit_expected(__union_.__unex_, __union_.__val_, std::move(__un.error()));
- __has_val_ = false;
+ if (this->__has_val()) {
+ __reinit_expected<unexpect_t, in_place_t, _Err, _Tp>(this->__val(), std::move(__un.error()));
} else {
- __union_.__unex_ = std::move(__un.error());
+ this->__unex() = std::move(__un.error());
}
return *this;
}
@@ -370,27 +716,17 @@ public:
template <class... _Args>
requires is_nothrow_constructible_v<_Tp, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(_Args&&... __args) noexcept {
- if (__has_val_) {
- std::destroy_at(std::addressof(__union_.__val_));
- } else {
- std::destroy_at(std::addressof(__union_.__unex_));
- }
- std::construct_at(std::addressof(__union_.__val_), std::forward<_Args>(__args)...);
- __has_val_ = true;
- return __union_.__val_;
+ this->__destroy();
+ this->__construct(in_place, std::forward<_Args>(__args)...);
+ return this->__val();
}
template <class _Up, class... _Args>
- requires is_nothrow_constructible_v< _Tp, initializer_list<_Up>&, _Args... >
+ requires is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) noexcept {
- if (__has_val_) {
- std::destroy_at(std::addressof(__union_.__val_));
- } else {
- std::destroy_at(std::addressof(__union_.__unex_));
- }
- std::construct_at(std::addressof(__union_.__val_), __il, std::forward<_Args>(__args)...);
- __has_val_ = true;
- return __union_.__val_;
+ this->__destroy();
+ this->__construct(in_place, __il, std::forward<_Args>(__args)...);
+ return this->__val();
}
public:
@@ -402,48 +738,42 @@ public:
is_move_constructible_v<_Err> &&
(is_nothrow_move_constructible_v<_Tp> || is_nothrow_move_constructible_v<_Err>))
{
- auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) {
+ auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) {
if constexpr (is_nothrow_move_constructible_v<_Err>) {
- _Err __tmp(std::move(__with_err.__union_.__unex_));
- std::destroy_at(std::addressof(__with_err.__union_.__unex_));
- auto __trans = std::__make_exception_guard([&] {
- std::construct_at(std::addressof(__with_err.__union_.__unex_), std::move(__tmp));
- });
- std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__with_val.__union_.__val_));
+ _Err __tmp(std::move(__with_err.__unex()));
+ __with_err.__destroy();
+ auto __trans = std::__make_exception_guard([&] { __with_err.__construct(unexpect, std::move(__tmp)); });
+ __with_err.__construct(in_place, std::move(__with_val.__val()));
__trans.__complete();
- std::destroy_at(std::addressof(__with_val.__union_.__val_));
- std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__tmp));
+ __with_val.__destroy();
+ __with_val.__construct(unexpect, std::move(__tmp));
} else {
static_assert(is_nothrow_move_constructible_v<_Tp>,
"To provide strong exception guarantee, Tp has to satisfy `is_nothrow_move_constructible_v` so "
"that it can be reverted to the previous state in case an exception is thrown during swap.");
- _Tp __tmp(std::move(__with_val.__union_.__val_));
- std::destroy_at(std::addressof(__with_val.__union_.__val_));
- auto __trans = std::__make_exception_guard([&] {
- std::construct_at(std::addressof(__with_val.__union_.__val_), std::move(__tmp));
- });
- std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_));
+ _Tp __tmp(std::move(__with_val.__val()));
+ __with_val.__destroy();
+ auto __trans = std::__make_exception_guard([&] { __with_val.__construct(in_place, std::move(__tmp)); });
+ __with_val.__construct(unexpect, std::move(__with_err.__unex()));
__trans.__complete();
- std::destroy_at(std::addressof(__with_err.__union_.__unex_));
- std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__tmp));
+ __with_err.__destroy();
+ __with_err.__construct(in_place, std::move(__tmp));
}
- __with_val.__has_val_ = false;
- __with_err.__has_val_ = true;
};
- if (__has_val_) {
- if (__rhs.__has_val_) {
+ if (this->__has_val()) {
+ if (__rhs.__has_val()) {
using std::swap;
- swap(__union_.__val_, __rhs.__union_.__val_);
+ swap(this->__val(), __rhs.__val());
} else {
__swap_val_unex_impl(*this, __rhs);
}
} else {
- if (__rhs.__has_val_) {
+ if (__rhs.__has_val()) {
__swap_val_unex_impl(__rhs, *this);
} else {
using std::swap;
- swap(__union_.__unex_, __rhs.__union_.__unex_);
+ swap(this->__unex(), __rhs.__unex());
}
}
}
@@ -456,105 +786,115 @@ public:
// [expected.object.obs], observers
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator-> requires the expected to contain a value");
- return std::addressof(__union_.__val_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator-> requires the expected to contain a value");
+ return std::addressof(this->__val());
}
_LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator-> requires the expected to contain a value");
- return std::addressof(__union_.__val_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator-> requires the expected to contain a value");
+ return std::addressof(this->__val());
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value");
- return __union_.__val_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator* requires the expected to contain a value");
+ return this->__val();
}
_LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value");
- return __union_.__val_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator* requires the expected to contain a value");
+ return this->__val();
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value");
- return std::move(__union_.__val_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator* requires the expected to contain a value");
+ return std::move(this->__val());
}
_LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value");
- return std::move(__union_.__val_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator* requires the expected to contain a value");
+ return std::move(this->__val());
}
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __has_val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); }
- _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& value() const& {
static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
- if (!__has_val_) {
+ if (!this->__has_val()) {
std::__throw_bad_expected_access<_Err>(std::as_const(error()));
}
- return __union_.__val_;
+ return this->__val();
}
_LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() & {
static_assert(is_copy_constructible_v<_Err>, "error_type has to be copy constructible");
- if (!__has_val_) {
+ if (!this->__has_val()) {
std::__throw_bad_expected_access<_Err>(std::as_const(error()));
}
- return __union_.__val_;
+ return this->__val();
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& value() const&& {
static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>,
"error_type has to be both copy constructible and constructible from decltype(std::move(error()))");
- if (!__has_val_) {
+ if (!this->__has_val()) {
std::__throw_bad_expected_access<_Err>(std::move(error()));
}
- return std::move(__union_.__val_);
+ return std::move(this->__val());
}
_LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() && {
static_assert(is_copy_constructible_v<_Err> && is_constructible_v<_Err, decltype(std::move(error()))>,
"error_type has to be both copy constructible and constructible from decltype(std::move(error()))");
- if (!__has_val_) {
+ if (!this->__has_val()) {
std::__throw_bad_expected_access<_Err>(std::move(error()));
}
- return std::move(__union_.__val_);
+ return std::move(this->__val());
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return __union_.__unex_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return this->__unex();
}
_LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return __union_.__unex_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return this->__unex();
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return std::move(__union_.__unex_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return std::move(this->__unex());
}
_LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return std::move(__union_.__unex_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return std::move(this->__unex());
}
template <class _Up>
_LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
static_assert(is_copy_constructible_v<_Tp>, "value_type has to be copy constructible");
static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type");
- return __has_val_ ? __union_.__val_ : static_cast<_Tp>(std::forward<_Up>(__v));
+ return this->__has_val() ? this->__val() : static_cast<_Tp>(std::forward<_Up>(__v));
}
template <class _Up>
_LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
static_assert(is_move_constructible_v<_Tp>, "value_type has to be move constructible");
static_assert(is_convertible_v<_Up, _Tp>, "argument has to be convertible to value_type");
- return __has_val_ ? std::move(__union_.__val_) : static_cast<_Tp>(std::forward<_Up>(__v));
+ return this->__has_val() ? std::move(this->__val()) : static_cast<_Tp>(std::forward<_Up>(__v));
}
template <class _Up = _Err>
@@ -584,7 +924,7 @@ public:
static_assert(is_same_v<typename _Up::error_type, _Err>,
"The result of f(**this) must have the same error_type as this expected");
if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), __union_.__val_);
+ return std::invoke(std::forward<_Func>(__f), this->__val());
}
return _Up(unexpect, error());
}
@@ -597,7 +937,7 @@ public:
static_assert(is_same_v<typename _Up::error_type, _Err>,
"The result of f(**this) must have the same error_type as this expected");
if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), __union_.__val_);
+ return std::invoke(std::forward<_Func>(__f), this->__val());
}
return _Up(unexpect, error());
}
@@ -611,7 +951,7 @@ public:
static_assert(is_same_v<typename _Up::error_type, _Err>,
"The result of f(std::move(**this)) must have the same error_type as this expected");
if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_));
+ return std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
}
return _Up(unexpect, std::move(error()));
}
@@ -625,7 +965,7 @@ public:
static_assert(is_same_v<typename _Up::error_type, _Err>,
"The result of f(std::move(**this)) must have the same error_type as this expected");
if (has_value()) {
- return std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_));
+ return std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
}
return _Up(unexpect, std::move(error()));
}
@@ -638,7 +978,7 @@ public:
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(error()) must have the same value_type as this expected");
if (has_value()) {
- return _Gp(in_place, __union_.__val_);
+ return _Gp(in_place, this->__val());
}
return std::invoke(std::forward<_Func>(__f), error());
}
@@ -651,7 +991,7 @@ public:
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(error()) must have the same value_type as this expected");
if (has_value()) {
- return _Gp(in_place, __union_.__val_);
+ return _Gp(in_place, this->__val());
}
return std::invoke(std::forward<_Func>(__f), error());
}
@@ -665,7 +1005,7 @@ public:
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(std::move(error())) must have the same value_type as this expected");
if (has_value()) {
- return _Gp(in_place, std::move(__union_.__val_));
+ return _Gp(in_place, std::move(this->__val()));
}
return std::invoke(std::forward<_Func>(__f), std::move(error()));
}
@@ -679,7 +1019,7 @@ public:
static_assert(is_same_v<typename _Gp::value_type, _Tp>,
"The result of f(std::move(error())) must have the same value_type as this expected");
if (has_value()) {
- return _Gp(in_place, std::move(__union_.__val_));
+ return _Gp(in_place, std::move(this->__val()));
}
return std::invoke(std::forward<_Func>(__f), std::move(error()));
}
@@ -693,9 +1033,9 @@ public:
}
if constexpr (!is_void_v<_Up>) {
return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), this->__val());
} else {
- std::invoke(std::forward<_Func>(__f), __union_.__val_);
+ std::invoke(std::forward<_Func>(__f), this->__val());
return expected<_Up, _Err>();
}
}
@@ -709,9 +1049,9 @@ public:
}
if constexpr (!is_void_v<_Up>) {
return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), __union_.__val_);
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), this->__val());
} else {
- std::invoke(std::forward<_Func>(__f), __union_.__val_);
+ std::invoke(std::forward<_Func>(__f), this->__val());
return expected<_Up, _Err>();
}
}
@@ -725,9 +1065,9 @@ public:
}
if constexpr (!is_void_v<_Up>) {
return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(__union_.__val_));
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(this->__val()));
} else {
- std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_));
+ std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
return expected<_Up, _Err>();
}
}
@@ -741,9 +1081,9 @@ public:
}
if constexpr (!is_void_v<_Up>) {
return expected<_Up, _Err>(
- __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(__union_.__val_));
+ __expected_construct_in_place_from_invoke_tag{}, std::forward<_Func>(__f), std::move(this->__val()));
} else {
- std::invoke(std::forward<_Func>(__f), std::move(__union_.__val_));
+ std::invoke(std::forward<_Func>(__f), std::move(this->__val()));
return expected<_Up, _Err>();
}
}
@@ -755,7 +1095,7 @@ public:
static_assert(__valid_std_unexpected<_Gp>::value,
"The result of f(error()) must be a valid template argument for unexpected");
if (has_value()) {
- return expected<_Tp, _Gp>(in_place, __union_.__val_);
+ return expected<_Tp, _Gp>(in_place, this->__val());
}
return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error());
}
@@ -767,7 +1107,7 @@ public:
static_assert(__valid_std_unexpected<_Gp>::value,
"The result of f(error()) must be a valid template argument for unexpected");
if (has_value()) {
- return expected<_Tp, _Gp>(in_place, __union_.__val_);
+ return expected<_Tp, _Gp>(in_place, this->__val());
}
return expected<_Tp, _Gp>(__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), error());
}
@@ -779,7 +1119,7 @@ public:
static_assert(__valid_std_unexpected<_Gp>::value,
"The result of f(std::move(error())) must be a valid template argument for unexpected");
if (has_value()) {
- return expected<_Tp, _Gp>(in_place, std::move(__union_.__val_));
+ return expected<_Tp, _Gp>(in_place, std::move(this->__val()));
}
return expected<_Tp, _Gp>(
__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error()));
@@ -792,7 +1132,7 @@ public:
static_assert(__valid_std_unexpected<_Gp>::value,
"The result of f(std::move(error())) must be a valid template argument for unexpected");
if (has_value()) {
- return expected<_Tp, _Gp>(in_place, std::move(__union_.__val_));
+ return expected<_Tp, _Gp>(in_place, std::move(this->__val()));
}
return expected<_Tp, _Gp>(
__expected_construct_unexpected_from_invoke_tag{}, std::forward<_Func>(__f), std::move(error()));
@@ -802,123 +1142,220 @@ public:
template <class _T2, class _E2>
requires(!is_void_v<_T2>)
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) {
- if (__x.__has_val_ != __y.__has_val_) {
+ if (__x.__has_val() != __y.__has_val()) {
return false;
} else {
- if (__x.__has_val_) {
- return __x.__union_.__val_ == __y.__union_.__val_;
+ if (__x.__has_val()) {
+ return __x.__val() == __y.__val();
} else {
- return __x.__union_.__unex_ == __y.__union_.__unex_;
+ return __x.__unex() == __y.__unex();
}
}
}
template <class _T2>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const _T2& __v) {
- return __x.__has_val_ && static_cast<bool>(__x.__union_.__val_ == __v);
+ return __x.__has_val() && static_cast<bool>(__x.__val() == __v);
}
template <class _E2>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __e) {
- return !__x.__has_val_ && static_cast<bool>(__x.__union_.__unex_ == __e.error());
+ return !__x.__has_val() && static_cast<bool>(__x.__unex() == __e.error());
}
+};
-private:
- template <class _ValueType, class _ErrorType>
+template <class _Err>
+class __expected_void_base {
+ struct __empty_t {};
+ // use named union because [[no_unique_address]] cannot be applied to an unnamed union,
+ // also guaranteed elision into a potentially-overlapping subobject is unsettled (and
+ // it's not clear that it's implementable, given that the function is allowed to clobber
+ // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107.
union __union_t {
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&)
+ requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t(__union_t&&)
+ requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(__union_t&&) = delete;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(in_place_t) : __empty_() {}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args)
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(unexpect_t, _Args&&... __args)
: __unex_(std::forward<_Args>(__args)...) {}
template <class _Func, class... _Args>
_LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
+ __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
: __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
- template <class _Union>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) {
- if (__has_val)
- std::construct_at(std::addressof(__val_), std::forward<_Union>(__other).__val_);
- else
- std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_);
- }
-
_LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(is_trivially_destructible_v<_ValueType> && is_trivially_destructible_v<_ErrorType>)
+ requires(is_trivially_destructible_v<_Err>)
= default;
- // the expected's destructor handles this
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {}
+ // __repr's destructor handles this
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
+ requires(!is_trivially_destructible_v<_Err>)
+ {}
- _ValueType __val_;
- _ErrorType __unex_;
+ _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Err __unex_;
};
- // use named union because [[no_unique_address]] cannot be applied to an unnamed union,
- // also guaranteed elision into a potentially-overlapping subobject is unsettled (and
- // it's not clear that it's implementable, given that the function is allowed to clobber
- // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107.
- template <class _ValueType, class _ErrorType>
- requires(is_trivially_move_constructible_v<_ValueType> && is_trivially_move_constructible_v<_ErrorType>)
- union __union_t<_ValueType, _ErrorType> {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default;
+ static constexpr bool __put_flag_in_tail = __fits_in_tail_padding<__union_t, bool>;
+ static constexpr bool __allow_reusing_expected_tail_padding = !__put_flag_in_tail;
+
+ struct __repr {
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr() = delete;
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::in_place_t, _Args&&... __args)
- : __val_(std::forward<_Args>(__args)...) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(in_place_t __tag) : __union_(in_place, __tag), __has_val_(true) {}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args)
- : __unex_(std::forward<_Args>(__args)...) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(unexpect_t __tag, _Args&&... __args)
+ : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- std::__expected_construct_in_place_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __val_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(std::__expected_construct_unexpected_from_invoke_tag __tag,
+ _Args&&... __args)
+ : __union_(in_place, __tag, std::forward<_Args>(__args)...), __has_val_(false) {}
+
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __repr(bool __has_val, _OtherUnion&& __other)
+ requires(__allow_reusing_expected_tail_padding)
+ : __union_(__conditional_no_unique_address_invoke_tag{},
+ [&] { return __make_union(__has_val, std::forward<_OtherUnion>(__other)); }),
+ __has_val_(__has_val) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(const __repr&)
+ requires(is_copy_constructible_v<_Err> && is_trivially_copy_constructible_v<_Err>)
+ = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr(__repr&&)
+ requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
+ = default;
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- std::__expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(const __repr&) = delete;
+ _LIBCPP_HIDE_FROM_ABI constexpr __repr& operator=(__repr&&) = delete;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
+ requires(is_trivially_destructible_v<_Err>)
+ = default;
- template <class _Union>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) {
+ _LIBCPP_HIDE_FROM_ABI constexpr ~__repr()
+ requires(!is_trivially_destructible_v<_Err>)
+ {
+ __destroy_union_member();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
+ requires(__allow_reusing_expected_tail_padding && is_trivially_destructible_v<_Err>)
+ {
+ std::destroy_at(&__union_.__v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union()
+ requires(__allow_reusing_expected_tail_padding && !is_trivially_destructible_v<_Err>)
+ {
+ __destroy_union_member();
+ std::destroy_at(&__union_.__v);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(in_place_t)
+ requires(__allow_reusing_expected_tail_padding)
+ {
+ std::construct_at(&__union_.__v, in_place);
+ __has_val_ = true;
+ }
+
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __construct_union(unexpect_t, _Args&&... __args)
+ requires(__allow_reusing_expected_tail_padding)
+ {
+ std::construct_at(&__union_.__v, unexpect, std::forward<_Args>(__args)...);
+ __has_val_ = false;
+ }
+
+ private:
+ template <class>
+ friend class __expected_void_base;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy_union_member()
+ requires(!is_trivially_destructible_v<_Err>)
+ {
+ if (!__has_val_)
+ std::destroy_at(std::addressof(__union_.__v.__unex_));
+ }
+
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI static constexpr __union_t __make_union(bool __has_val, _OtherUnion&& __other)
+ requires(__allow_reusing_expected_tail_padding)
+ {
if (__has_val)
- std::construct_at(std::addressof(__val_), std::forward<_Union>(__other).__val_);
+ return __union_t(in_place);
else
- std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_);
+ return __union_t(unexpect, std::forward<_OtherUnion>(__other).__unex_);
}
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(is_trivially_destructible_v<_ValueType> && is_trivially_destructible_v<_ErrorType>)
- = default;
+ _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__put_flag_in_tail, __union_t> __union_;
+ _LIBCPP_NO_UNIQUE_ADDRESS bool __has_val_;
+ };
- // the expected's destructor handles this
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(!is_trivially_destructible_v<_ValueType> || !is_trivially_destructible_v<_ErrorType>)
- {}
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI static constexpr __repr __make_repr(bool __has_val, _OtherUnion&& __other)
+ requires(__put_flag_in_tail)
+ {
+ if (__has_val)
+ return __repr(in_place);
+ else
+ return __repr(unexpect, std::forward<_OtherUnion>(__other).__unex_);
+ }
- _LIBCPP_NO_UNIQUE_ADDRESS _ValueType __val_;
- _LIBCPP_NO_UNIQUE_ADDRESS _ErrorType __unex_;
- };
+protected:
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_void_base(_Args&&... __args)
+ : __repr_(in_place, std::forward<_Args>(__args)...) {}
+
+ template <class _OtherUnion>
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __expected_void_base(bool __has_val, _OtherUnion&& __other)
+ requires(__put_flag_in_tail)
+ : __repr_(__conditional_no_unique_address_invoke_tag{},
+ [&] { return __make_repr(__has_val, std::forward<_OtherUnion>(__other)); }) {}
- _LIBCPP_NO_UNIQUE_ADDRESS __union_t<_Tp, _Err> __union_;
- bool __has_val_;
+ _LIBCPP_HIDE_FROM_ABI constexpr void __destroy() {
+ if constexpr (__put_flag_in_tail)
+ std::destroy_at(&__repr_.__v);
+ else
+ __repr_.__v.__destroy_union();
+ }
+
+ template <class _Tag, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __construct(_Tag __tag, _Args&&... __args) {
+ if constexpr (__put_flag_in_tail)
+ std::construct_at(&__repr_.__v, __tag, std::forward<_Args>(__args)...);
+ else
+ __repr_.__v.__construct_union(__tag, std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr bool __has_val() const { return __repr_.__v.__has_val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr __union_t& __union() { return __repr_.__v.__union_.__v; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const __union_t& __union() const { return __repr_.__v.__union_.__v; }
+ _LIBCPP_HIDE_FROM_ABI constexpr _Err& __unex() { return __repr_.__v.__union_.__v.__unex_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr const _Err& __unex() const { return __repr_.__v.__union_.__v.__unex_; }
+
+private:
+ _LIBCPP_NO_UNIQUE_ADDRESS __conditional_no_unique_address<__allow_reusing_expected_tail_padding, __repr> __repr_;
};
template <class _Tp, class _Err>
requires is_void_v<_Tp>
-class expected<_Tp, _Err> {
+class expected<_Tp, _Err> : private __expected_void_base<_Err> {
static_assert(__valid_std_unexpected<_Err>::value,
"[expected.void.general] A program that instantiates expected<T, E> with a E that is not a "
"valid argument for unexpected<E> is ill-formed");
@@ -935,6 +1372,8 @@ class expected<_Tp, _Err> {
_Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>&>>,
_Not<is_constructible<unexpected<_Err>, const expected<_Up, _OtherErr>>>>;
+ using __base = __expected_void_base<_Err>;
+
public:
using value_type = _Tp;
using error_type = _Err;
@@ -944,7 +1383,7 @@ public:
using rebind = expected<_Up, error_type>;
// [expected.void.ctor], constructors
- _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __has_val_(true) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr expected() noexcept : __base(in_place) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected&) = delete;
@@ -955,7 +1394,7 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr expected(const expected& __rhs) noexcept(
is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_constructible_v<_Err> && !is_trivially_copy_constructible_v<_Err>)
- : __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {}
+ : __base(__rhs.__has_val(), __rhs.__union()) {}
_LIBCPP_HIDE_FROM_ABI constexpr expected(expected&&)
requires(is_move_constructible_v<_Err> && is_trivially_move_constructible_v<_Err>)
@@ -963,93 +1402,93 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr expected(expected&& __rhs) noexcept(is_nothrow_move_constructible_v<_Err>)
requires(is_move_constructible_v<_Err> && !is_trivially_move_constructible_v<_Err>)
- : __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {}
+ : __base(__rhs.__has_val(), std::move(__rhs.__union())) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, const _OtherErr&>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>)
expected(const expected<_Up, _OtherErr>& __rhs) noexcept(
is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __union_(__rhs.__has_val_, __rhs.__union_), __has_val_(__rhs.__has_val_) {}
+ : __base(__rhs.__has_val(), __rhs.__union()) {}
template <class _Up, class _OtherErr>
requires __can_convert<_Up, _OtherErr, _OtherErr>::value
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
expected(expected<_Up, _OtherErr>&& __rhs) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __union_(__rhs.__has_val_, std::move(__rhs.__union_)), __has_val_(__rhs.__has_val_) {}
+ : __base(__rhs.__has_val(), std::move(__rhs.__union())) {}
template <class _OtherErr>
requires is_constructible_v<_Err, const _OtherErr&>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<const _OtherErr&, _Err>) expected(
const unexpected<_OtherErr>& __unex) noexcept(is_nothrow_constructible_v<_Err, const _OtherErr&>) // strengthened
- : __union_(std::unexpect, __unex.error()), __has_val_(false) {}
+ : __base(unexpect, __unex.error()) {}
template <class _OtherErr>
requires is_constructible_v<_Err, _OtherErr>
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherErr, _Err>)
expected(unexpected<_OtherErr>&& __unex) noexcept(is_nothrow_constructible_v<_Err, _OtherErr>) // strengthened
- : __union_(std::unexpect, std::move(__unex.error())), __has_val_(false) {}
+ : __base(unexpect, std::move(__unex.error())) {}
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __has_val_(true) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(in_place_t) noexcept : __base(in_place) {}
template <class... _Args>
requires is_constructible_v<_Err, _Args...>
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Err, _Args...>) // strengthened
- : __union_(std::unexpect, std::forward<_Args>(__args)...), __has_val_(false) {}
+ : __base(unexpect, std::forward<_Args>(__args)...) {}
template <class _Up, class... _Args>
requires is_constructible_v< _Err, initializer_list<_Up>&, _Args... >
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(unexpect_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(
is_nothrow_constructible_v<_Err, initializer_list<_Up>&, _Args...>) // strengthened
- : __union_(std::unexpect, __il, std::forward<_Args>(__args)...), __has_val_(false) {}
+ : __base(unexpect, __il, std::forward<_Args>(__args)...) {}
private:
- template <class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit expected(__expected_construct_in_place_from_invoke_tag, _Func&& __f)
- : __has_val_(true) {
- std::invoke(std::forward<_Func>(__f));
- }
-
template <class _Func, class... _Args>
_LIBCPP_HIDE_FROM_ABI constexpr explicit expected(
__expected_construct_unexpected_from_invoke_tag __tag, _Func&& __f, _Args&&... __args)
- : __union_(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...), __has_val_(false) {}
+ : __base(__tag, std::forward<_Func>(__f), std::forward<_Args>(__args)...) {}
public:
// [expected.void.dtor], destructor
- _LIBCPP_HIDE_FROM_ABI constexpr ~expected()
- requires is_trivially_destructible_v<_Err>
- = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr ~expected() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr ~expected()
- requires(!is_trivially_destructible_v<_Err>)
- {
- if (!__has_val_) {
- std::destroy_at(std::addressof(__union_.__unex_));
- }
+private:
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(unexpect_t, _Args&&... __args) {
+ _LIBCPP_ASSERT_INTERNAL(this->__has_val(), "__reinit_expected(unexpect_t, ...) needs value to be set");
+
+ this->__destroy();
+ auto __trans = std::__make_exception_guard([&] { this->__construct(in_place); });
+ this->__construct(unexpect, std::forward<_Args>(__args)...);
+ __trans.__complete();
}
- // [expected.void.assign], assignment
+ _LIBCPP_HIDE_FROM_ABI constexpr void __reinit_expected(in_place_t) {
+ _LIBCPP_ASSERT_INTERNAL(!this->__has_val(), "__reinit_expected(in_place_t, ...) needs value to be unset");
+ this->__destroy();
+ this->__construct(in_place);
+ }
+
+public:
+ // [expected.void.assign], assignment
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected&) = delete;
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const expected& __rhs) noexcept(
is_nothrow_copy_assignable_v<_Err> && is_nothrow_copy_constructible_v<_Err>) // strengthened
requires(is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err>)
{
- if (__has_val_) {
- if (!__rhs.__has_val_) {
- std::construct_at(std::addressof(__union_.__unex_), __rhs.__union_.__unex_);
- __has_val_ = false;
+ if (this->__has_val()) {
+ if (!__rhs.__has_val()) {
+ __reinit_expected(unexpect, __rhs.__unex());
}
} else {
- if (__rhs.__has_val_) {
- std::destroy_at(std::addressof(__union_.__unex_));
- __has_val_ = true;
+ if (__rhs.__has_val()) {
+ __reinit_expected(in_place);
} else {
- __union_.__unex_ = __rhs.__union_.__unex_;
+ this->__unex() = __rhs.__unex();
}
}
return *this;
@@ -1061,17 +1500,15 @@ public:
operator=(expected&& __rhs) noexcept(is_nothrow_move_assignable_v<_Err> && is_nothrow_move_constructible_v<_Err>)
requires(is_move_assignable_v<_Err> && is_move_constructible_v<_Err>)
{
- if (__has_val_) {
- if (!__rhs.__has_val_) {
- std::construct_at(std::addressof(__union_.__unex_), std::move(__rhs.__union_.__unex_));
- __has_val_ = false;
+ if (this->__has_val()) {
+ if (!__rhs.__has_val()) {
+ __reinit_expected(unexpect, std::move(__rhs.__unex()));
}
} else {
- if (__rhs.__has_val_) {
- std::destroy_at(std::addressof(__union_.__unex_));
- __has_val_ = true;
+ if (__rhs.__has_val()) {
+ __reinit_expected(in_place);
} else {
- __union_.__unex_ = std::move(__rhs.__union_.__unex_);
+ this->__unex() = std::move(__rhs.__unex());
}
}
return *this;
@@ -1080,11 +1517,10 @@ public:
template <class _OtherErr>
requires(is_constructible_v<_Err, const _OtherErr&> && is_assignable_v<_Err&, const _OtherErr&>)
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(const unexpected<_OtherErr>& __un) {
- if (__has_val_) {
- std::construct_at(std::addressof(__union_.__unex_), __un.error());
- __has_val_ = false;
+ if (this->__has_val()) {
+ __reinit_expected(unexpect, __un.error());
} else {
- __union_.__unex_ = __un.error();
+ this->__unex() = __un.error();
}
return *this;
}
@@ -1092,19 +1528,17 @@ public:
template <class _OtherErr>
requires(is_constructible_v<_Err, _OtherErr> && is_assignable_v<_Err&, _OtherErr>)
_LIBCPP_HIDE_FROM_ABI constexpr expected& operator=(unexpected<_OtherErr>&& __un) {
- if (__has_val_) {
- std::construct_at(std::addressof(__union_.__unex_), std::move(__un.error()));
- __has_val_ = false;
+ if (this->__has_val()) {
+ __reinit_expected(unexpect, std::move(__un.error()));
} else {
- __union_.__unex_ = std::move(__un.error());
+ this->__unex() = std::move(__un.error());
}
return *this;
}
_LIBCPP_HIDE_FROM_ABI constexpr void emplace() noexcept {
- if (!__has_val_) {
- std::destroy_at(std::addressof(__union_.__unex_));
- __has_val_ = true;
+ if (!this->__has_val()) {
+ __reinit_expected(in_place);
}
}
@@ -1113,23 +1547,23 @@ public:
swap(expected& __rhs) noexcept(is_nothrow_move_constructible_v<_Err> && is_nothrow_swappable_v<_Err>)
requires(is_swappable_v<_Err> && is_move_constructible_v<_Err>)
{
- auto __swap_val_unex_impl = [&](expected& __with_val, expected& __with_err) {
- std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_));
- std::destroy_at(std::addressof(__with_err.__union_.__unex_));
- __with_val.__has_val_ = false;
- __with_err.__has_val_ = true;
+ auto __swap_val_unex_impl = [](expected& __with_val, expected& __with_err) {
+ // May throw, but will re-engage `__with_val` in that case.
+ __with_val.__reinit_expected(unexpect, std::move(__with_err.__unex()));
+ // Will not throw.
+ __with_err.__reinit_expected(in_place);
};
- if (__has_val_) {
- if (!__rhs.__has_val_) {
+ if (this->__has_val()) {
+ if (!__rhs.__has_val()) {
__swap_val_unex_impl(*this, __rhs);
}
} else {
- if (__rhs.__has_val_) {
+ if (__rhs.__has_val()) {
__swap_val_unex_impl(__rhs, *this);
} else {
using std::swap;
- swap(__union_.__unex_, __rhs.__union_.__unex_);
+ swap(this->__unex(), __rhs.__unex());
}
}
}
@@ -1141,44 +1575,51 @@ public:
}
// [expected.void.obs], observers
- _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return __has_val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit operator bool() const noexcept { return this->__has_val(); }
- _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; }
+ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__has_val(); }
_LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__has_val_, "expected::operator* requires the expected to contain a value");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ this->__has_val(), "expected::operator* requires the expected to contain a value");
}
_LIBCPP_HIDE_FROM_ABI constexpr void value() const& {
- if (!__has_val_) {
- std::__throw_bad_expected_access<_Err>(__union_.__unex_);
+ static_assert(is_copy_constructible_v<_Err>);
+ if (!this->__has_val()) {
+ std::__throw_bad_expected_access<_Err>(this->__unex());
}
}
_LIBCPP_HIDE_FROM_ABI constexpr void value() && {
- if (!__has_val_) {
- std::__throw_bad_expected_access<_Err>(std::move(__union_.__unex_));
+ static_assert(is_copy_constructible_v<_Err> && is_move_constructible_v<_Err>);
+ if (!this->__has_val()) {
+ std::__throw_bad_expected_access<_Err>(std::move(this->__unex()));
}
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return __union_.__unex_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return this->__unex();
}
_LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return __union_.__unex_;
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return this->__unex();
}
_LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return std::move(__union_.__unex_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return std::move(this->__unex());
}
_LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept {
- _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!__has_val_, "expected::error requires the expected to contain an error");
- return std::move(__union_.__unex_);
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
+ !this->__has_val(), "expected::error requires the expected to contain an error");
+ return std::move(this->__unex());
}
template <class _Up = _Err>
@@ -1414,96 +1855,17 @@ public:
template <class _T2, class _E2>
requires is_void_v<_T2>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) {
- if (__x.__has_val_ != __y.__has_val_) {
+ if (__x.__has_val() != __y.__has_val()) {
return false;
} else {
- return __x.__has_val_ || static_cast<bool>(__x.__union_.__unex_ == __y.__union_.__unex_);
+ return __x.__has_val() || static_cast<bool>(__x.__unex() == __y.__unex());
}
}
template <class _E2>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const unexpected<_E2>& __y) {
- return !__x.__has_val_ && static_cast<bool>(__x.__union_.__unex_ == __y.error());
+ return !__x.__has_val() && static_cast<bool>(__x.__unex() == __y.error());
}
-
-private:
- struct __empty_t {};
-
- template <class _ErrorType>
- union __union_t {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {}
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args)
- : __unex_(std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- template <class _Union>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) {
- if (__has_val)
- std::construct_at(std::addressof(__empty_));
- else
- std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(is_trivially_destructible_v<_ErrorType>)
- = default;
-
- // the expected's destructor handles this
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t() {}
-
- __empty_t __empty_;
- _ErrorType __unex_;
- };
-
- // use named union because [[no_unique_address]] cannot be applied to an unnamed union,
- // also guaranteed elision into a potentially-overlapping subobject is unsettled (and
- // it's not clear that it's implementable, given that the function is allowed to clobber
- // the tail padding) - see https://github.com/itanium-cxx-abi/cxx-abi/issues/107.
- template <class _ErrorType>
- requires is_trivially_move_constructible_v<_ErrorType>
- union __union_t<_ErrorType> {
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t() : __empty_() {}
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t(const __union_t&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __union_t& operator=(const __union_t&) = default;
-
- template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(std::unexpect_t, _Args&&... __args)
- : __unex_(std::forward<_Args>(__args)...) {}
-
- template <class _Func, class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(
- __expected_construct_unexpected_from_invoke_tag, _Func&& __f, _Args&&... __args)
- : __unex_(std::invoke(std::forward<_Func>(__f), std::forward<_Args>(__args)...)) {}
-
- template <class _Union>
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __union_t(bool __has_val, _Union&& __other) {
- if (__has_val)
- std::construct_at(std::addressof(__empty_));
- else
- std::construct_at(std::addressof(__unex_), std::forward<_Union>(__other).__unex_);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(is_trivially_destructible_v<_ErrorType>)
- = default;
-
- // the expected's destructor handles this
- _LIBCPP_HIDE_FROM_ABI constexpr ~__union_t()
- requires(!is_trivially_destructible_v<_ErrorType>)
- {}
-
- _LIBCPP_NO_UNIQUE_ADDRESS __empty_t __empty_;
- _LIBCPP_NO_UNIQUE_ADDRESS _ErrorType __unex_;
- };
-
- _LIBCPP_NO_UNIQUE_ADDRESS __union_t<_Err> __union_;
- bool __has_val_;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/__hash_table b/contrib/llvm-project/libcxx/include/__hash_table
index 4ca49fe42606..13420012006e 100644
--- a/contrib/llvm-project/libcxx/include/__hash_table
+++ b/contrib/llvm-project/libcxx/include/__hash_table
@@ -861,7 +861,7 @@ public:
template <class _Key>
_LIBCPP_HIDE_FROM_ABI size_type bucket(const _Key& __k) const {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
bucket_count() > 0, "unordered container::bucket(key) called when bucket_count() == 0");
return std::__constrain_hash(hash_function()(__k), bucket_count());
}
diff --git a/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h b/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
index dae8cc75ae34..2cd82525ba06 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/iterator_traits.h
@@ -121,7 +121,7 @@ private:
__void_t<typename _Up::pointer>* = nullptr);
public:
- static const bool value = decltype(__test<_Tp>(0, 0, 0, 0, 0))::value;
+ static const bool value = decltype(__test<_Tp>(nullptr, nullptr, nullptr, nullptr, nullptr))::value;
};
template <class _Tp>
diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator.h b/contrib/llvm-project/libcxx/include/__memory/allocator.h
index 747ce30d8fef..4e6303914c38 100644
--- a/contrib/llvm-project/libcxx/include/__memory/allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory/allocator.h
@@ -31,6 +31,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
class allocator;
+#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
+# pragma clang deprecated( \
+ _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS, \
+ "_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS is deprecated in LLVM 18 and will be removed in LLVM 19")
+#endif
+
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION)
// These specializations shouldn't be marked _LIBCPP_DEPRECATED_IN_CXX17.
// Specializing allocator<void> is deprecated, but not using it.
@@ -101,7 +107,9 @@ public:
typedef ptrdiff_t difference_type;
typedef _Tp value_type;
typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
+#if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS)
+ _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal;
+#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
@@ -179,7 +187,9 @@ public:
typedef ptrdiff_t difference_type;
typedef const _Tp value_type;
typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
+#if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS)
+ _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal;
+#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
diff --git a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
index c66fb49ebb3c..526eb3334f95 100644
--- a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
+++ b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h
@@ -27,9 +27,11 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __ass
static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0, "std::assume_aligned<N>(p) requires N to be a power of two");
if (__libcpp_is_constant_evaluated()) {
+ (void)__builtin_assume_aligned(__ptr, _Np);
return __ptr;
} else {
- _LIBCPP_ASSERT_UNCATEGORIZED(reinterpret_cast<uintptr_t>(__ptr) % _Np == 0, "Alignment assumption is violated");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ reinterpret_cast<uintptr_t>(__ptr) % _Np == 0, "Alignment assumption is violated");
return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Np));
}
}
diff --git a/contrib/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h b/contrib/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h
index 3a2794931767..cfd07bc84fe8 100644
--- a/contrib/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/contrib/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -68,7 +68,10 @@ public:
}
_LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __max_size(), "deallocate called for size which exceeds max_size()");
+ _LIBCPP_ASSERT_VALID_DEALLOCATION(
+ __n <= __max_size(),
+ "deallocate() called for a size which exceeds max_size(), leading to a memory leak "
+ "(the argument will overflow and result in too few objects being deleted)");
__res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
}
diff --git a/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h b/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
index 3e9c244f25c2..48df2338051e 100644
--- a/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
+++ b/contrib/llvm-project/libcxx/include/__numeric/gcd_lcm.h
@@ -77,7 +77,7 @@ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up
using _Rp = common_type_t<_Tp, _Up>;
_Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
_Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
- _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
return __val1 * __val2;
}
diff --git a/contrib/llvm-project/libcxx/include/__numeric/saturation_arithmetic.h b/contrib/llvm-project/libcxx/include/__numeric/saturation_arithmetic.h
new file mode 100644
index 000000000000..50274c6bbd9f
--- /dev/null
+++ b/contrib/llvm-project/libcxx/include/__numeric/saturation_arithmetic.h
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+#define _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
+
+#include <__concepts/arithmetic.h>
+#include <__config>
+#include <__utility/cmp.h>
+#include <limits>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 26
+
+template <__libcpp_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp add_sat(_Tp __x, _Tp __y) noexcept {
+ if (_Tp __sum; !__builtin_add_overflow(__x, __y, &__sum))
+ return __sum;
+ // Handle overflow
+ if constexpr (__libcpp_unsigned_integer<_Tp>) {
+ return std::numeric_limits<_Tp>::max();
+ } else {
+ // Signed addition overflow
+ if (__x > 0)
+ // Overflows if (x > 0 && y > 0)
+ return std::numeric_limits<_Tp>::max();
+ else
+ // Overflows if (x < 0 && y < 0)
+ return std::numeric_limits<_Tp>::min();
+ }
+}
+
+template <__libcpp_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp sub_sat(_Tp __x, _Tp __y) noexcept {
+ if (_Tp __sub; !__builtin_sub_overflow(__x, __y, &__sub))
+ return __sub;
+ // Handle overflow
+ if constexpr (__libcpp_unsigned_integer<_Tp>) {
+ // Overflows if (x < y)
+ return std::numeric_limits<_Tp>::min();
+ } else {
+ // Signed subtration overflow
+ if (__x >= 0)
+ // Overflows if (x >= 0 && y < 0)
+ return std::numeric_limits<_Tp>::max();
+ else
+ // Overflows if (x < 0 && y > 0)
+ return std::numeric_limits<_Tp>::min();
+ }
+}
+
+template <__libcpp_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp mul_sat(_Tp __x, _Tp __y) noexcept {
+ if (_Tp __mul; !__builtin_mul_overflow(__x, __y, &__mul))
+ return __mul;
+ // Handle overflow
+ if constexpr (__libcpp_unsigned_integer<_Tp>) {
+ return std::numeric_limits<_Tp>::max();
+ } else {
+ // Signed multiplication overflow
+ if ((__x > 0 && __y > 0) || (__x < 0 && __y < 0))
+ return std::numeric_limits<_Tp>::max();
+ // Overflows if (x < 0 && y > 0) || (x > 0 && y < 0)
+ return std::numeric_limits<_Tp>::min();
+ }
+}
+
+template <__libcpp_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp div_sat(_Tp __x, _Tp __y) noexcept {
+ _LIBCPP_ASSERT_UNCATEGORIZED(__y != 0, "Division by 0 is undefined");
+ if constexpr (__libcpp_unsigned_integer<_Tp>) {
+ return __x / __y;
+ } else {
+ // Handle signed division overflow
+ if (__x == std::numeric_limits<_Tp>::min() && __y == _Tp{-1})
+ return std::numeric_limits<_Tp>::max();
+ return __x / __y;
+ }
+}
+
+template <__libcpp_integer _Rp, __libcpp_integer _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Rp saturate_cast(_Tp __x) noexcept {
+ // Saturation is impossible edge case when ((min _Rp) < (min _Tp) && (max _Rp) > (max _Tp)) and it is expected to be
+ // optimized out by the compiler.
+
+ // Handle overflow
+ if (std::cmp_less(__x, std::numeric_limits<_Rp>::min()))
+ return std::numeric_limits<_Rp>::min();
+ if (std::cmp_greater(__x, std::numeric_limits<_Rp>::max()))
+ return std::numeric_limits<_Rp>::max();
+ // No overflow
+ return static_cast<_Rp>(__x);
+}
+
+#endif // _LIBCPP_STD_VER >= 26
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___NUMERIC_SATURATION_ARITHMETIC_H
diff --git a/contrib/llvm-project/libcxx/include/__ranges/chunk_by_view.h b/contrib/llvm-project/libcxx/include/__ranges/chunk_by_view.h
index c5b3240a7d0b..b04a23de99fb 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/chunk_by_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/chunk_by_view.h
@@ -54,8 +54,7 @@ namespace ranges {
template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred>
requires view<_View> && is_object_v<_Pred>
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG chunk_by_view
- : public view_interface<chunk_by_view<_View, _Pred>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> {
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
_LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
diff --git a/contrib/llvm-project/libcxx/include/__ranges/drop_while_view.h b/contrib/llvm-project/libcxx/include/__ranges/drop_while_view.h
index b367f735c141..4e3ef61678f4 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/drop_while_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/drop_while_view.h
@@ -45,8 +45,7 @@ namespace ranges {
template <view _View, class _Pred>
requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG drop_while_view
- : public view_interface<drop_while_view<_View, _Pred>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interface<drop_while_view<_View, _Pred>> {
public:
_LIBCPP_HIDE_FROM_ABI drop_while_view()
requires default_initializable<_View> && default_initializable<_Pred>
diff --git a/contrib/llvm-project/libcxx/include/__ranges/filter_view.h b/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
index ecb78eee3810..6e6719c14470 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/filter_view.h
@@ -51,7 +51,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred>
requires view<_View> && is_object_v<_Pred>
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG filter_view : public view_interface<filter_view<_View, _Pred>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface<filter_view<_View, _Pred>> {
_LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
_LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
diff --git a/contrib/llvm-project/libcxx/include/__ranges/repeat_view.h b/contrib/llvm-project/libcxx/include/__ranges/repeat_view.h
index 479eca96acb0..d9759abe1cba 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/repeat_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/repeat_view.h
@@ -68,7 +68,7 @@ struct __fn;
template <move_constructible _Tp, semiregular _Bound = unreachable_sentinel_t>
requires(is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> &&
(__integer_like_with_usable_difference_type<_Bound> || same_as<_Bound, unreachable_sentinel_t>))
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG repeat_view : public view_interface<repeat_view<_Tp, _Bound>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS repeat_view : public view_interface<repeat_view<_Tp, _Bound>> {
friend struct views::__take::__fn;
friend struct views::__drop::__fn;
class __iterator;
diff --git a/contrib/llvm-project/libcxx/include/__ranges/single_view.h b/contrib/llvm-project/libcxx/include/__ranges/single_view.h
index 0ae2036a66a9..ead597a9be17 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/single_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/single_view.h
@@ -37,7 +37,7 @@ template <move_constructible _Tp>
template <copy_constructible _Tp>
# endif
requires is_object_v<_Tp>
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG single_view : public view_interface<single_view<_Tp>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS single_view : public view_interface<single_view<_Tp>> {
_LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Tp> __value_;
public:
diff --git a/contrib/llvm-project/libcxx/include/__ranges/take_while_view.h b/contrib/llvm-project/libcxx/include/__ranges/take_while_view.h
index 4534210d9794..46cfe4f70ac8 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/take_while_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/take_while_view.h
@@ -43,8 +43,7 @@ namespace ranges {
template <view _View, class _Pred>
requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>>
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG take_while_view
- : public view_interface<take_while_view<_View, _Pred>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interface<take_while_view<_View, _Pred>> {
template <bool>
class __sentinel;
diff --git a/contrib/llvm-project/libcxx/include/__ranges/transform_view.h b/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
index 744f597ccef5..3c8d825789cb 100644
--- a/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
+++ b/contrib/llvm-project/libcxx/include/__ranges/transform_view.h
@@ -67,8 +67,7 @@ template <input_range _View, move_constructible _Fn>
template <input_range _View, copy_constructible _Fn>
# endif
requires __transform_view_constraints<_View, _Fn>
-class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG transform_view
- : public view_interface<transform_view<_View, _Fn>> {
+class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS transform_view : public view_interface<transform_view<_View, _Fn>> {
template <bool>
class __iterator;
template <bool>
diff --git a/contrib/llvm-project/libcxx/include/__utility/cmp.h b/contrib/llvm-project/libcxx/include/__utility/cmp.h
index 5f88f4b32703..b7c1ed614dfc 100644
--- a/contrib/llvm-project/libcxx/include/__utility/cmp.h
+++ b/contrib/llvm-project/libcxx/include/__utility/cmp.h
@@ -9,14 +9,10 @@
#ifndef _LIBCPP___UTILITY_CMP_H
#define _LIBCPP___UTILITY_CMP_H
+#include <__concepts/arithmetic.h>
#include <__config>
-#include <__type_traits/disjunction.h>
-#include <__type_traits/is_integral.h>
-#include <__type_traits/is_same.h>
#include <__type_traits/is_signed.h>
#include <__type_traits/make_unsigned.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
#include <limits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -29,28 +25,8 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template <class _Tp, class... _Up>
-struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {};
-
-template <class _Tp>
-concept __is_safe_integral_cmp =
- is_integral_v<_Tp> &&
- !_IsSameAsAny<_Tp,
- bool,
- char,
- char16_t,
- char32_t
-# ifndef _LIBCPP_HAS_NO_CHAR8_T
- ,
- char8_t
-# endif
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- ,
- wchar_t
-# endif
- >::value;
-
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
return __t == __u;
@@ -60,12 +36,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u);
}
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_equal(__t, __u);
}
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
return __t < __u;
@@ -75,26 +51,27 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u);
}
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
return std::cmp_less(__u, __t);
}
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_greater(__t, __u);
}
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
return !std::cmp_less(__t, __u);
}
-template <__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
+template <__libcpp_integer _Tp, __libcpp_integer _Up>
_LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
std::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
}
+
#endif // _LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/llvm-project/libcxx/include/any b/contrib/llvm-project/libcxx/include/any
index b9e0a8d94550..378dfb6e21b5 100644
--- a/contrib/llvm-project/libcxx/include/any
+++ b/contrib/llvm-project/libcxx/include/any
@@ -98,6 +98,7 @@ namespace std {
#include <__type_traits/is_nothrow_move_constructible.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_same.h>
+#include <__type_traits/is_void.h>
#include <__type_traits/remove_cv.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h>
@@ -555,6 +556,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
template <class _ValueType>
inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT {
+ static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
return std::any_cast<_ValueType>(const_cast<any*>(__any));
}
@@ -572,6 +574,7 @@ inline _LIBCPP_HIDE_FROM_ABI _RetType __pointer_or_func_cast(void*, /*IsFunction
template <class _ValueType>
_LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
using __any_imp::_Action;
+ static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
static_assert(!is_reference<_ValueType>::value, "_ValueType may not be a reference.");
typedef add_pointer_t<_ValueType> _ReturnType;
if (__any && __any->__h_) {
diff --git a/contrib/llvm-project/libcxx/include/barrier b/contrib/llvm-project/libcxx/include/barrier
index fcfc96cb0484..f91452c8d006 100644
--- a/contrib/llvm-project/libcxx/include/barrier
+++ b/contrib/llvm-project/libcxx/include/barrier
@@ -45,11 +45,16 @@ namespace std
*/
+#include <__config>
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+# error "<barrier> is not supported since libc++ has been configured without support for threads."
+#endif
+
#include <__assert> // all public C++ headers provide the assertion handler
#include <__atomic/atomic_base.h>
#include <__atomic/memory_order.h>
#include <__availability>
-#include <__config>
#include <__memory/unique_ptr.h>
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
@@ -63,10 +68,6 @@ namespace std
# pragma GCC system_header
#endif
-#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<barrier> is not supported since libc++ has been configured without support for threads."
-#endif
-
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -128,7 +129,7 @@ public:
__completion_(std::move(__completion)),
__phase_(0) {}
[[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__update <= __expected_, "update is greater than the expected count for the current barrier phase");
auto const __old_phase = __phase_.load(memory_order_relaxed);
@@ -186,7 +187,7 @@ public:
auto const __result = __arrived.fetch_sub(update, memory_order_acq_rel) - update;
auto const new_expected = __expected.load(memory_order_relaxed);
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
update <= new_expected, "update is greater than the expected count for the current barrier phase");
if (0 == __result) {
@@ -231,7 +232,7 @@ public:
auto const __inc = __arrived_unit * update;
auto const __old = __phase_arrived_expected.fetch_add(__inc, memory_order_acq_rel);
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
update <= __old, "update is greater than the expected count for the current barrier phase");
if ((__old ^ (__old + __inc)) & __phase_bit) {
@@ -267,10 +268,10 @@ public:
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI explicit barrier(
ptrdiff_t __count, _CompletionF __completion = _CompletionF())
: __b_(__count, std::move(__completion)) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__count >= 0,
"barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__count <= max(),
"barrier::barrier(ptrdiff_t, CompletionFunction): barrier cannot be initialized with "
"a value greater than max()");
@@ -280,7 +281,7 @@ public:
barrier& operator=(barrier const&) = delete;
[[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI arrival_token arrive(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update > 0, "barrier:arrive must be called with a value greater than 0");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update > 0, "barrier:arrive must be called with a value greater than 0");
return __b_.arrive(__update);
}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(arrival_token&& __phase) const {
diff --git a/contrib/llvm-project/libcxx/include/chrono b/contrib/llvm-project/libcxx/include/chrono
index b3ed9acc5e5d..c80fa78a56ba 100644
--- a/contrib/llvm-project/libcxx/include/chrono
+++ b/contrib/llvm-project/libcxx/include/chrono
@@ -296,6 +296,10 @@ template<class charT, class traits, class Duration> // C++20
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp);
+template<class charT, class traits> // C++20
+ basic_ostream<charT, traits>&
+ operator<<(basic_ostream<charT, traits>& os, const sys_days& dp);
+
class file_clock // C++20
{
public:
diff --git a/contrib/llvm-project/libcxx/include/concepts b/contrib/llvm-project/libcxx/include/concepts
index 196fa2e0ea70..5fdf30ecfbd3 100644
--- a/contrib/llvm-project/libcxx/include/concepts
+++ b/contrib/llvm-project/libcxx/include/concepts
@@ -155,7 +155,7 @@ namespace std {
#include <__config>
#include <version>
-#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES)
+#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
# include <type_traits>
#endif
diff --git a/contrib/llvm-project/libcxx/include/condition_variable b/contrib/llvm-project/libcxx/include/condition_variable
index cf7a570b6cb6..e375c986e7f1 100644
--- a/contrib/llvm-project/libcxx/include/condition_variable
+++ b/contrib/llvm-project/libcxx/include/condition_variable
@@ -126,11 +126,11 @@ public:
#include <__condition_variable/condition_variable.h>
#include <__config>
#include <__memory/shared_ptr.h>
-#include <__memory/unique_ptr.h>
#include <__mutex/lock_guard.h>
#include <__mutex/mutex.h>
#include <__mutex/tag_types.h>
#include <__mutex/unique_lock.h>
+#include <__stop_token/stop_callback.h>
#include <__stop_token/stop_token.h>
#include <__utility/move.h>
#include <version>
@@ -200,19 +200,26 @@ inline void condition_variable_any::notify_all() _NOEXCEPT {
__cv_.notify_all();
}
-struct __lock_external {
- template <class _Lock>
- _LIBCPP_HIDE_FROM_ABI void operator()(_Lock* __m) {
- __m->lock();
+template <class _Lock>
+struct __unlock_guard {
+ _Lock& __lock_;
+
+ _LIBCPP_HIDE_FROM_ABI __unlock_guard(_Lock& __lock) : __lock_(__lock) { __lock_.unlock(); }
+
+ _LIBCPP_HIDE_FROM_ABI ~__unlock_guard() _NOEXCEPT // turns exception to std::terminate
+ {
+ __lock_.lock();
}
+
+ __unlock_guard(const __unlock_guard&) = delete;
+ __unlock_guard& operator=(const __unlock_guard&) = delete;
};
template <class _Lock>
void condition_variable_any::wait(_Lock& __lock) {
shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut);
- __lock.unlock();
- unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ __unlock_guard<_Lock> __unlock(__lock);
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
__cv_.wait(__lk);
} // __mut_.unlock(), __lock.lock()
@@ -227,8 +234,7 @@ template <class _Lock, class _Clock, class _Duration>
cv_status condition_variable_any::wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t) {
shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut);
- __lock.unlock();
- unique_ptr<_Lock, __lock_external> __lxx(&__lock);
+ __unlock_guard<_Lock> __unlock(__lock);
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t());
return __cv_.wait_until(__lk, __t);
} // __mut_.unlock(), __lock.lock()
@@ -256,24 +262,75 @@ condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Pe
# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN)
template <class _Lock, class _Predicate>
-bool condition_variable_any::wait(_Lock& __lock, stop_token __stoken, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
+bool condition_variable_any::wait(_Lock& __user_lock, stop_token __stoken, _Predicate __pred) {
+ if (__stoken.stop_requested())
+ return __pred();
+
+ // Per https://eel.is/c++draft/thread.condition.condvarany#general-note-2,
+ // we do need to take a copy of the shared pointer __mut_
+ // This ensures that a thread can call the destructor immediately after calling
+ // notify_all, without waiting all the wait calls.
+ // A thread can also safely call the destructor immediately after calling
+ // request_stop, as the call to request_stop would evaluate the callback,
+ // which accesses the internal condition variable, immediately on the same thread.
+ // In this situation, it is OK even without copying a shared ownership the internal
+ // condition variable. However, this needs the evaluation of stop_callback to
+ // happen-before the destruction.
+ // The spec only says "Only the notification to unblock the wait needs to happen
+ // before destruction". To make this work, we need to copy the shared ownership of
+ // the internal condition variable inside this function, which is not possible
+ // with the current ABI.
+ shared_ptr<mutex> __mut = __mut_;
+
+ stop_callback __cb(__stoken, [this] { notify_all(); });
+
+ while (true) {
if (__pred())
return true;
- wait(__lock);
- }
+
+ // We need to take the internal lock before checking stop_requested,
+ // so that the notification cannot come in between the stop_requested
+ // check and entering the wait.
+ // Note that the stop_callback takes the same internal lock before notifying
+ unique_lock<mutex> __internal_lock(*__mut);
+ if (__stoken.stop_requested())
+ break;
+
+ __unlock_guard<_Lock> __unlock(__user_lock);
+ unique_lock<mutex> __internal_lock2(
+ std::move(__internal_lock)); // switch unlock order between __internal_lock and __user_lock
+ __cv_.wait(__internal_lock2);
+ } // __internal_lock2.unlock(), __user_lock.lock()
return __pred();
}
template <class _Lock, class _Clock, class _Duration, class _Predicate>
bool condition_variable_any::wait_until(
- _Lock& __lock, stop_token __stoken, const chrono::time_point<_Clock, _Duration>& __abs_time, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
+ _Lock& __user_lock,
+ stop_token __stoken,
+ const chrono::time_point<_Clock, _Duration>& __abs_time,
+ _Predicate __pred) {
+ if (__stoken.stop_requested())
+ return __pred();
+
+ shared_ptr<mutex> __mut = __mut_;
+ stop_callback __cb(__stoken, [this] { notify_all(); });
+
+ while (true) {
if (__pred())
return true;
- if (wait_until(__lock, __abs_time) == cv_status::timeout)
- return __pred();
- }
+
+ unique_lock<mutex> __internal_lock(*__mut);
+ if (__stoken.stop_requested())
+ break;
+
+ __unlock_guard<_Lock> __unlock(__user_lock);
+ unique_lock<mutex> __internal_lock2(
+ std::move(__internal_lock)); // switch unlock order between __internal_lock and __user_lock
+
+ if (__cv_.wait_until(__internal_lock2, __abs_time) == cv_status::timeout)
+ break;
+ } // __internal_lock2.unlock(), __user_lock.lock()
return __pred();
}
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h b/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
index edbb3b24931f..31d2b50aa1dd 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/aligned_tag.h
@@ -11,6 +11,7 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
#include <__memory/assume_aligned.h>
+#include <__type_traits/remove_const.h>
#include <cstddef>
#include <experimental/__config>
#include <experimental/__simd/traits.h>
@@ -35,7 +36,7 @@ inline constexpr bool is_simd_flag_type_v<element_aligned_tag> = true;
struct vector_aligned_tag {
template <class _Tp, class _Up = typename _Tp::value_type>
- static constexpr size_t __alignment = memory_alignment_v<_Tp, _Up>;
+ static constexpr size_t __alignment = memory_alignment_v<_Tp, remove_const_t<_Up>>;
template <class _Tp, class _Up>
static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) {
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h b/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
index 5eeff4c1e82a..717fd6cd92d7 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/scalar.h
@@ -56,6 +56,11 @@ struct __simd_operations<_Tp, simd_abi::__scalar> {
static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate(_Generator&& __g) noexcept {
return {__g(std::integral_constant<size_t, 0>())};
}
+
+ template <class _Up>
+ static _LIBCPP_HIDE_FROM_ABI void __load(_SimdStorage& __s, const _Up* __mem) noexcept {
+ __s.__data = static_cast<_Tp>(__mem[0]);
+ }
};
template <class _Tp>
@@ -63,6 +68,8 @@ struct __mask_operations<_Tp, simd_abi::__scalar> {
using _MaskStorage = __mask_storage<_Tp, simd_abi::__scalar>;
static _LIBCPP_HIDE_FROM_ABI _MaskStorage __broadcast(bool __v) noexcept { return {__v}; }
+
+ static _LIBCPP_HIDE_FROM_ABI void __load(_MaskStorage& __s, const bool* __mem) noexcept { __s.__data = __mem[0]; }
};
} // namespace parallelism_v2
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h b/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
index c345811fee7f..db4ebb8e4a38 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/simd.h
@@ -64,6 +64,12 @@ public:
explicit _LIBCPP_HIDE_FROM_ABI simd(_Generator&& __g) noexcept
: __s_(_Impl::__generate(std::forward<_Generator>(__g))) {}
+ // load constructor
+ template <class _Up, class _Flags, enable_if_t<__is_vectorizable_v<_Up> && is_simd_flag_type_v<_Flags>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI simd(const _Up* __mem, _Flags) {
+ _Impl::__load(__s_, _Flags::template __apply<simd>(__mem));
+ }
+
// scalar access [simd.subscr]
_LIBCPP_HIDE_FROM_ABI reference operator[](size_t __i) noexcept { return reference(__s_, __i); }
_LIBCPP_HIDE_FROM_ABI value_type operator[](size_t __i) const noexcept { return __s_.__get(__i); }
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h b/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
index db03843b46e3..754db7992683 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/simd_mask.h
@@ -52,6 +52,12 @@ public:
}
}
+ // load constructor
+ template <class _Flags, enable_if_t<is_simd_flag_type_v<_Flags>, int> = 0>
+ _LIBCPP_HIDE_FROM_ABI simd_mask(const value_type* __mem, _Flags) {
+ _Impl::__load(__s_, _Flags::template __apply<simd_mask>(__mem));
+ }
+
// scalar access [simd.mask.subscr]
_LIBCPP_HIDE_FROM_ABI reference operator[](size_t __i) noexcept { return reference(__s_, __i); }
_LIBCPP_HIDE_FROM_ABI value_type operator[](size_t __i) const noexcept { return __s_.__get(__i); }
diff --git a/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h b/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
index 07ba032f493b..7883132ba6c0 100644
--- a/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
+++ b/contrib/llvm-project/libcxx/include/experimental/__simd/vec_ext.h
@@ -73,6 +73,12 @@ struct __simd_operations<_Tp, simd_abi::__vec_ext<_Np>> {
static _LIBCPP_HIDE_FROM_ABI _SimdStorage __generate(_Generator&& __g) noexcept {
return __generate_init(std::forward<_Generator>(__g), std::make_index_sequence<_Np>());
}
+
+ template <class _Up>
+ static _LIBCPP_HIDE_FROM_ABI void __load(_SimdStorage& __s, const _Up* __mem) noexcept {
+ for (size_t __i = 0; __i < _Np; __i++)
+ __s.__data[__i] = static_cast<_Tp>(__mem[__i]);
+ }
};
template <class _Tp, int _Np>
@@ -87,6 +93,11 @@ struct __mask_operations<_Tp, simd_abi::__vec_ext<_Np>> {
}
return __result;
}
+
+ static _LIBCPP_HIDE_FROM_ABI void __load(_MaskStorage& __s, const bool* __mem) noexcept {
+ for (size_t __i = 0; __i < _Np; __i++)
+ __s.__data[__i] = experimental::__set_all_bits<_Tp>(__mem[__i]);
+ }
};
} // namespace parallelism_v2
diff --git a/contrib/llvm-project/libcxx/include/future b/contrib/llvm-project/libcxx/include/future
index 92ba18821069..5602ae41c142 100644
--- a/contrib/llvm-project/libcxx/include/future
+++ b/contrib/llvm-project/libcxx/include/future
@@ -362,11 +362,16 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
*/
+#include <__config>
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+# error "<future> is not supported since libc++ has been configured without support for threads."
+#endif
+
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/time_point.h>
-#include <__config>
#include <__exception/exception_ptr.h>
#include <__memory/addressof.h>
#include <__memory/allocator.h>
@@ -396,10 +401,6 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
# pragma GCC system_header
#endif
-#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<future> is not supported since libc++ has been configured without support for threads."
-#endif
-
_LIBCPP_BEGIN_NAMESPACE_STD
// enum class future_errc
diff --git a/contrib/llvm-project/libcxx/include/latch b/contrib/llvm-project/libcxx/include/latch
index ef52c0562a7c..ad7b35579913 100644
--- a/contrib/llvm-project/libcxx/include/latch
+++ b/contrib/llvm-project/libcxx/include/latch
@@ -40,12 +40,17 @@ namespace std
*/
+#include <__config>
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+# error "<latch> is not supported since libc++ has been configured without support for threads."
+#endif
+
#include <__assert> // all public C++ headers provide the assertion handler
#include <__atomic/atomic_base.h>
#include <__atomic/atomic_sync.h>
#include <__atomic/memory_order.h>
#include <__availability>
-#include <__config>
#include <cstddef>
#include <limits>
#include <version>
@@ -54,10 +59,6 @@ namespace std
# pragma GCC system_header
#endif
-#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<latch> is not supported since libc++ has been configured without support for threads."
-#endif
-
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -72,11 +73,11 @@ public:
static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return numeric_limits<ptrdiff_t>::max(); }
inline _LIBCPP_HIDE_FROM_ABI constexpr explicit latch(ptrdiff_t __expected) : __a_(__expected) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__expected >= 0,
"latch::latch(ptrdiff_t): latch cannot be "
"initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__expected <= max(),
"latch::latch(ptrdiff_t): latch cannot be "
"initialized with a value greater than max()");
@@ -87,9 +88,9 @@ public:
latch& operator=(const latch&) = delete;
inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void count_down(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::count_down called with a negative value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::count_down called with a negative value");
auto const __old = __a_.fetch_sub(__update, memory_order_release);
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__update <= __old,
"latch::count_down called with a value greater "
"than the internal counter");
@@ -101,7 +102,7 @@ public:
__cxx_atomic_wait(&__a_.__a_, [this]() -> bool { return try_wait(); });
}
inline _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void arrive_and_wait(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "latch::arrive_and_wait called with a negative value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "latch::arrive_and_wait called with a negative value");
// other preconditions on __update are checked in count_down()
count_down(__update);
diff --git a/contrib/llvm-project/libcxx/include/libcxx.imp b/contrib/llvm-project/libcxx/include/libcxx.imp
index 3eb2aa849314..45fa4a954191 100644
--- a/contrib/llvm-project/libcxx/include/libcxx.imp
+++ b/contrib/llvm-project/libcxx/include/libcxx.imp
@@ -1,53 +1,839 @@
[
- { include: [ "<__hash_table>", "private", "<unordered_map>", "public" ] },
- { include: [ "<__hash_table>", "private", "<unordered_set>", "public" ] },
- { include: [ "<__locale>", "private", "<locale>", "public" ] },
- { include: [ "<__node_handle>", "private", "<map>", "public" ] },
- { include: [ "<__node_handle>", "private", "<set>", "public" ] },
- { include: [ "<__node_handle>", "private", "<unordered_map>", "public" ] },
- { include: [ "<__node_handle>", "private", "<unordered_set>", "public" ] },
- { include: [ "<__split_buffer>", "private", "<deque>", "public" ] },
- { include: [ "<__split_buffer>", "private", "<vector>", "public" ] },
- { include: [ "<__threading_support>", "private", "<atomic>", "public" ] },
- { include: [ "<__threading_support>", "private", "<mutex>", "public" ] },
- { include: [ "<__threading_support>", "private", "<semaphore>", "public" ] },
- { include: [ "<__threading_support>", "private", "<thread>", "public" ] },
- { include: [ "<__tree>", "private", "<map>", "public" ] },
- { include: [ "<__tree>", "private", "<set>", "public" ] },
- { include: [ "@<__algorithm/.*>", "private", "<algorithm>", "public" ] },
- { include: [ "@<__atomic/.*>", "private", "<atomic>", "public" ] },
- { include: [ "@<__bit/.*>", "private", "<bit>", "public" ] },
- { include: [ "@<__charconv/.*>", "private", "<charconv>", "public" ] },
- { include: [ "@<__chrono/.*>", "private", "<chrono>", "public" ] },
- { include: [ "@<__compare/.*>", "private", "<compare>", "public" ] },
- { include: [ "@<__concepts/.*>", "private", "<concepts>", "public" ] },
- { include: [ "@<__condition_variable/.*>", "private", "<condition_variable>", "public" ] },
- { include: [ "@<__coroutine/.*>", "private", "<coroutine>", "public" ] },
- { include: [ "@<__debug_utils/.*>", "private", "<debug_utils>", "public" ] },
- { include: [ "@<__exception/.*>", "private", "<exception>", "public" ] },
- { include: [ "@<__expected/.*>", "private", "<expected>", "public" ] },
- { include: [ "@<__filesystem/.*>", "private", "<filesystem>", "public" ] },
- { include: [ "@<__format/.*>", "private", "<format>", "public" ] },
- { include: [ "@<__functional/.*>", "private", "<functional>", "public" ] },
- { include: [ "@<__fwd/.*>", "private", "<fwd>", "public" ] },
- { include: [ "@<__ios/.*>", "private", "<ios>", "public" ] },
- { include: [ "@<__iterator/.*>", "private", "<iterator>", "public" ] },
- { include: [ "@<__locale_dir/.*>", "private", "<locale>", "public" ] },
- { include: [ "@<__math/.*>", "private", "<math>", "public" ] },
- { include: [ "@<__mdspan/.*>", "private", "<mdspan>", "public" ] },
- { include: [ "@<__memory/.*>", "private", "<memory>", "public" ] },
- { include: [ "@<__memory_resource/.*>", "private", "<memory_resource>", "public" ] },
- { include: [ "@<__mutex/.*>", "private", "<mutex>", "public" ] },
- { include: [ "@<__numeric/.*>", "private", "<numeric>", "public" ] },
- { include: [ "@<__random/.*>", "private", "<random>", "public" ] },
- { include: [ "@<__ranges/.*>", "private", "<ranges>", "public" ] },
- { include: [ "@<__stop_token/.*>", "private", "<stop_token>", "public" ] },
- { include: [ "@<__string/.*>", "private", "<string>", "public" ] },
- { include: [ "@<__support/.*>", "private", "<support>", "public" ] },
- { include: [ "@<__system_error/.*>", "private", "<system_error>", "public" ] },
- { include: [ "@<__thread/.*>", "private", "<thread>", "public" ] },
- { include: [ "@<__tuple/.*>", "private", "<tuple>", "public" ] },
- { include: [ "@<__type_traits/.*>", "private", "<type_traits>", "public" ] },
- { include: [ "@<__utility/.*>", "private", "<utility>", "public" ] },
- { include: [ "@<__variant/.*>", "private", "<variant>", "public" ] },
+ { include: [ "<__algorithm/adjacent_find.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/all_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/any_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/binary_search.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/clamp.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/comp.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/comp_ref_type.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/copy_backward.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/copy_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/copy_move_common.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/copy_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/count.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/count_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/equal.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/equal_range.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/fill.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/fill_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/find.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/find_end.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/find_first_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/find_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/find_if_not.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/find_segment_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/fold.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/for_each.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/for_each_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/for_each_segment.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/generate.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/generate_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/half_positive.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/in_found_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/in_fun_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/in_in_out_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/in_in_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/in_out_out_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/in_out_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/includes.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/inplace_merge.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/is_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/is_heap_until.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/is_partitioned.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/is_permutation.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/is_sorted.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/is_sorted_until.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/iter_swap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/iterator_operations.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/lexicographical_compare.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/lexicographical_compare_three_way.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/lower_bound.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/make_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/make_projected.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/max.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/max_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/merge.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/min.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/min_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/min_max_result.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/minmax.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/minmax_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/mismatch.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/move.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/move_backward.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/next_permutation.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/none_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/nth_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/partial_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/partial_sort_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/partition.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/partition_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/partition_point.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pop_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/prev_permutation.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_any_all_none_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backend.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backend.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/any_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/backend.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/fill.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/find_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/for_each.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/libdispatch.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/merge.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/serial.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/stable_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/thread.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/transform.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_backends/cpu_backends/transform_reduce.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_count.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_equal.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_fill.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_find.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_for_each.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_frontend_dispatch.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_generate.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_is_partitioned.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_merge.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_move.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_replace.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_rotate_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_stable_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/pstl_transform.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/push_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_adjacent_find.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_all_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_any_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_binary_search.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_clamp.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_contains.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_copy_backward.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_copy_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_copy_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_count.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_count_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_ends_with.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_equal.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_equal_range.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_fill.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_fill_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_find.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_find_end.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_find_first_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_find_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_find_if_not.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_for_each.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_for_each_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_generate.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_generate_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_includes.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_inplace_merge.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_is_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_is_heap_until.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_is_partitioned.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_is_permutation.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_is_sorted.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_is_sorted_until.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_iterator_concept.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_lexicographical_compare.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_lower_bound.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_make_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_max.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_max_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_merge.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_min.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_min_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_minmax.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_minmax_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_mismatch.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_move.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_move_backward.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_next_permutation.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_none_of.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_nth_element.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_partial_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_partial_sort_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_partition.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_partition_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_partition_point.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_pop_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_prev_permutation.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_push_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_remove.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_remove_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_remove_copy_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_remove_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_replace.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_replace_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_replace_copy_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_replace_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_reverse.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_reverse_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_rotate.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_rotate_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_sample.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_search.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_search_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_set_difference.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_set_intersection.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_set_symmetric_difference.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_set_union.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_shuffle.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_sort_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_stable_partition.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_stable_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_starts_with.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_swap_ranges.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_transform.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_unique.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_unique_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/ranges_upper_bound.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/remove.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/remove_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/remove_copy_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/remove_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/replace.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/replace_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/replace_copy_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/replace_if.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/reverse.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/reverse_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/rotate.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/rotate_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/sample.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/search.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/search_n.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/set_difference.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/set_intersection.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/set_symmetric_difference.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/set_union.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/shift_left.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/shift_right.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/shuffle.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/sift_down.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/sort_heap.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/stable_partition.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/stable_sort.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/swap_ranges.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/three_way_comp_ref_type.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/transform.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/uniform_random_bit_generator_adaptor.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/unique.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/unique_copy.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/unwrap_iter.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/unwrap_range.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__algorithm/upper_bound.h>", "private", "<algorithm>", "public" ] },
+ { include: [ "<__atomic/aliases.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/atomic.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/atomic_base.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/atomic_flag.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/atomic_init.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/atomic_lock_free.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/atomic_sync.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/check_memory_order.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/contention_t.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/cxx_atomic_impl.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/fence.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/is_always_lock_free.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/kill_dependency.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__atomic/memory_order.h>", "private", "<atomic>", "public" ] },
+ { include: [ "<__bit/bit_cast.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/bit_ceil.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/bit_floor.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/bit_log2.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/bit_width.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/blsr.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/byteswap.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/countl.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/countr.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/endian.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/has_single_bit.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/invert_if.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/popcount.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__bit/rotate.h>", "private", "<bit>", "public" ] },
+ { include: [ "<__charconv/chars_format.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/from_chars_integral.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/from_chars_result.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/tables.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/to_chars.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/to_chars_base_10.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/to_chars_floating_point.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/to_chars_integral.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/to_chars_result.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__charconv/traits.h>", "private", "<charconv>", "public" ] },
+ { include: [ "<__chrono/calendar.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/concepts.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/convert_to_timespec.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/convert_to_tm.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/day.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/duration.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/file_clock.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/formatter.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/hh_mm_ss.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/high_resolution_clock.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/literals.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/month.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/month_weekday.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/monthday.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/ostream.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/parser_std_format_spec.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/statically_widen.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/steady_clock.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/system_clock.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/time_point.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/tzdb.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/tzdb_list.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/weekday.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/year.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/year_month.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/year_month_day.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__chrono/year_month_weekday.h>", "private", "<chrono>", "public" ] },
+ { include: [ "<__compare/common_comparison_category.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/compare_partial_order_fallback.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/compare_strong_order_fallback.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/compare_three_way.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/compare_three_way_result.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/compare_weak_order_fallback.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/is_eq.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/ordering.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/partial_order.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/strong_order.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/synth_three_way.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/three_way_comparable.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__compare/weak_order.h>", "private", "<compare>", "public" ] },
+ { include: [ "<__concepts/arithmetic.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/assignable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/boolean_testable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/class_or_enum.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/common_reference_with.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/common_with.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/constructible.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/convertible_to.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/copyable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/derived_from.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/destructible.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/different_from.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/equality_comparable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/invocable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/movable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/predicate.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/regular.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/relation.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/same_as.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/semiregular.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/swappable.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__concepts/totally_ordered.h>", "private", "<concepts>", "public" ] },
+ { include: [ "<__condition_variable/condition_variable.h>", "private", "<condition_variable>", "public" ] },
+ { include: [ "<__coroutine/coroutine_handle.h>", "private", "<coroutine>", "public" ] },
+ { include: [ "<__coroutine/coroutine_traits.h>", "private", "<coroutine>", "public" ] },
+ { include: [ "<__coroutine/noop_coroutine_handle.h>", "private", "<coroutine>", "public" ] },
+ { include: [ "<__coroutine/trivial_awaitables.h>", "private", "<coroutine>", "public" ] },
+ { include: [ "<__exception/exception.h>", "private", "<exception>", "public" ] },
+ { include: [ "<__exception/exception_ptr.h>", "private", "<exception>", "public" ] },
+ { include: [ "<__exception/nested_exception.h>", "private", "<exception>", "public" ] },
+ { include: [ "<__exception/operations.h>", "private", "<exception>", "public" ] },
+ { include: [ "<__exception/terminate.h>", "private", "<exception>", "public" ] },
+ { include: [ "<__expected/bad_expected_access.h>", "private", "<expected>", "public" ] },
+ { include: [ "<__expected/expected.h>", "private", "<expected>", "public" ] },
+ { include: [ "<__expected/unexpect.h>", "private", "<expected>", "public" ] },
+ { include: [ "<__expected/unexpected.h>", "private", "<expected>", "public" ] },
+ { include: [ "<__filesystem/copy_options.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/directory_entry.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/directory_iterator.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/directory_options.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/file_status.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/file_time_type.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/file_type.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/filesystem_error.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/operations.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/path.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/path_iterator.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/perm_options.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/perms.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/recursive_directory_iterator.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/space_info.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__filesystem/u8path.h>", "private", "<filesystem>", "public" ] },
+ { include: [ "<__format/buffer.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/concepts.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/container_adaptor.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/enable_insertable.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/escaped_output_table.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/extended_grapheme_cluster_table.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_arg.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_arg_store.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_args.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_context.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_error.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_functions.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_fwd.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_parse_context.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_string.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/format_to_n_result.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_bool.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_char.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_floating_point.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_integer.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_integral.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_output.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_pointer.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_string.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/formatter_tuple.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/parser_std_format_spec.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/range_default_formatter.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/range_formatter.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/unicode.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/width_estimation_table.h>", "private", "<format>", "public" ] },
+ { include: [ "<__format/write_escaped.h>", "private", "<format>", "public" ] },
+ { include: [ "<__functional/binary_function.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/binary_negate.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/bind.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/bind_back.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/bind_front.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/binder1st.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/binder2nd.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/boyer_moore_searcher.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/compose.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/default_searcher.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/function.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/hash.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/identity.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/invoke.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/is_transparent.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/mem_fn.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/mem_fun_ref.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/not_fn.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/operations.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/perfect_forward.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/pointer_to_binary_function.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/pointer_to_unary_function.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/ranges_operations.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/reference_wrapper.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/unary_function.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/unary_negate.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__functional/weak_result_type.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__fwd/array.h>", "private", "<array>", "public" ] },
+ { include: [ "<__fwd/bit_reference.h>", "private", "<bitset>", "public" ] },
+ { include: [ "<__fwd/bit_reference.h>", "private", "<vector>", "public" ] },
+ { include: [ "<__fwd/fstream.h>", "private", "<fstream>", "public" ] },
+ { include: [ "<__fwd/hash.h>", "private", "<functional>", "public" ] },
+ { include: [ "<__fwd/ios.h>", "private", "<ios>", "public" ] },
+ { include: [ "<__fwd/istream.h>", "private", "<istream>", "public" ] },
+ { include: [ "<__fwd/mdspan.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__fwd/memory_resource.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__fwd/ostream.h>", "private", "<ostream>", "public" ] },
+ { include: [ "<__fwd/pair.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__fwd/span.h>", "private", "<span>", "public" ] },
+ { include: [ "<__fwd/sstream.h>", "private", "<sstream>", "public" ] },
+ { include: [ "<__fwd/streambuf.h>", "private", "<streambuf>", "public" ] },
+ { include: [ "<__fwd/string.h>", "private", "<string>", "public" ] },
+ { include: [ "<__fwd/string_view.h>", "private", "<string_view>", "public" ] },
+ { include: [ "<__fwd/subrange.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__fwd/tuple.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__ios/fpos.h>", "private", "<ios>", "public" ] },
+ { include: [ "<__iterator/access.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/advance.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/back_insert_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/bounded_iter.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/common_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/concepts.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/counted_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/cpp17_iterator_concepts.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/data.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/default_sentinel.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/distance.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/empty.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/erase_if_container.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/front_insert_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/incrementable_traits.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/indirectly_comparable.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/insert_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/istream_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/istreambuf_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/iter_move.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/iter_swap.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/iterator_traits.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/iterator_with_data.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/mergeable.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/move_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/move_sentinel.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/next.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/ostream_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/ostreambuf_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/permutable.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/prev.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/projected.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/ranges_iterator_traits.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/readable_traits.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/reverse_access.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/reverse_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/segmented_iterator.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/size.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/sortable.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/unreachable_sentinel.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__iterator/wrap_iter.h>", "private", "<iterator>", "public" ] },
+ { include: [ "<__locale_dir/locale_base_api/bsd_locale_defaults.h>", "private", "<locale>", "public" ] },
+ { include: [ "<__locale_dir/locale_base_api/bsd_locale_fallbacks.h>", "private", "<locale>", "public" ] },
+ { include: [ "<__locale_dir/locale_base_api/locale_guard.h>", "private", "<locale>", "public" ] },
+ { include: [ "<__math/abs.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/copysign.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/error_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/exponential_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/fdim.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/fma.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/gamma.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/hyperbolic_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/hypot.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/inverse_hyperbolic_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/inverse_trigonometric_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/logarithms.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/min_max.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/modulo.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/remainder.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/roots.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/rounding_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/traits.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__math/trigonometric_functions.h>", "private", "<cmath>", "public" ] },
+ { include: [ "<__mdspan/default_accessor.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__mdspan/extents.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__mdspan/layout_left.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__mdspan/layout_right.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__mdspan/layout_stride.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__mdspan/mdspan.h>", "private", "<mdspan>", "public" ] },
+ { include: [ "<__memory/addressof.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/align.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/aligned_alloc.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/allocate_at_least.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/allocation_guard.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/allocator.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/allocator_arg_t.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/allocator_destructor.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/allocator_traits.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/assume_aligned.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/auto_ptr.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/builtin_new_allocator.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/compressed_pair.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/concepts.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/construct_at.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/destruct_n.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/pointer_traits.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/ranges_construct_at.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/ranges_uninitialized_algorithms.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/raw_storage_iterator.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/shared_ptr.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/swap_allocator.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/temp_value.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/temporary_buffer.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/uninitialized_algorithms.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/unique_ptr.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/uses_allocator.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/uses_allocator_construction.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/voidify.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory_resource/memory_resource.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__memory_resource/monotonic_buffer_resource.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__memory_resource/polymorphic_allocator.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__memory_resource/pool_options.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__memory_resource/synchronized_pool_resource.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__memory_resource/unsynchronized_pool_resource.h>", "private", "<memory_resource>", "public" ] },
+ { include: [ "<__mutex/lock_guard.h>", "private", "<mutex>", "public" ] },
+ { include: [ "<__mutex/mutex.h>", "private", "<mutex>", "public" ] },
+ { include: [ "<__mutex/once_flag.h>", "private", "<mutex>", "public" ] },
+ { include: [ "<__mutex/tag_types.h>", "private", "<mutex>", "public" ] },
+ { include: [ "<__mutex/unique_lock.h>", "private", "<mutex>", "public" ] },
+ { include: [ "<__numeric/accumulate.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/adjacent_difference.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/exclusive_scan.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/gcd_lcm.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/inclusive_scan.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/inner_product.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/iota.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/midpoint.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/partial_sum.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/pstl_reduce.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/pstl_transform_reduce.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/reduce.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/saturation_arithmetic.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/transform_exclusive_scan.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/transform_inclusive_scan.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__numeric/transform_reduce.h>", "private", "<numeric>", "public" ] },
+ { include: [ "<__random/bernoulli_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/binomial_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/cauchy_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/chi_squared_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/clamp_to_integral.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/default_random_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/discard_block_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/discrete_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/exponential_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/extreme_value_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/fisher_f_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/gamma_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/generate_canonical.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/geometric_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/independent_bits_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/is_seed_sequence.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/is_valid.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/knuth_b.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/linear_congruential_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/log2.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/lognormal_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/mersenne_twister_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/negative_binomial_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/normal_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/piecewise_constant_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/piecewise_linear_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/poisson_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/random_device.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/ranlux.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/seed_seq.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/shuffle_order_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/student_t_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/subtract_with_carry_engine.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/uniform_int_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/uniform_random_bit_generator.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/uniform_real_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__random/weibull_distribution.h>", "private", "<random>", "public" ] },
+ { include: [ "<__ranges/access.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/all.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/as_rvalue_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/chunk_by_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/common_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/concepts.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/container_compatible_range.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/counted.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/dangling.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/data.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/drop_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/drop_while_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/elements_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/empty.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/empty_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/enable_borrowed_range.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/enable_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/filter_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/from_range.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/iota_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/istream_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/join_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/lazy_split_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/movable_box.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/non_propagating_cache.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/owning_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/range_adaptor.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/rbegin.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/ref_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/rend.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/repeat_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/reverse_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/single_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/size.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/split_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/subrange.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/take_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/take_while_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/to.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/transform_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/view_interface.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/views.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__ranges/zip_view.h>", "private", "<ranges>", "public" ] },
+ { include: [ "<__stop_token/atomic_unique_lock.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__stop_token/intrusive_list_view.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__stop_token/intrusive_shared_ptr.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__stop_token/stop_callback.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__stop_token/stop_source.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__stop_token/stop_state.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__stop_token/stop_token.h>", "private", "<stop_token>", "public" ] },
+ { include: [ "<__string/char_traits.h>", "private", "<string>", "public" ] },
+ { include: [ "<__string/constexpr_c_functions.h>", "private", "<string>", "public" ] },
+ { include: [ "<__string/extern_template_lists.h>", "private", "<string>", "public" ] },
+ { include: [ "<__system_error/errc.h>", "private", "<system_error>", "public" ] },
+ { include: [ "<__system_error/error_category.h>", "private", "<system_error>", "public" ] },
+ { include: [ "<__system_error/error_code.h>", "private", "<system_error>", "public" ] },
+ { include: [ "<__system_error/error_condition.h>", "private", "<system_error>", "public" ] },
+ { include: [ "<__system_error/system_error.h>", "private", "<system_error>", "public" ] },
+ { include: [ "<__thread/formatter.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__thread/id.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__thread/jthread.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__thread/poll_with_backoff.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__thread/this_thread.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__thread/thread.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__thread/timed_backoff_policy.h>", "private", "<thread>", "public" ] },
+ { include: [ "<__tuple/make_tuple_types.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/pair_like.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/sfinae_helpers.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/tuple_element.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/tuple_indices.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/tuple_like.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/tuple_like_ext.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/tuple_size.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__tuple/tuple_types.h>", "private", "<tuple>", "public" ] },
+ { include: [ "<__type_traits/add_const.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/add_cv.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/add_lvalue_reference.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/add_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/add_rvalue_reference.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/add_volatile.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/aligned_storage.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/aligned_union.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/alignment_of.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/apply_cv.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/can_extract_key.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/common_reference.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/common_type.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/conditional.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/conjunction.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/copy_cv.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/copy_cvref.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/datasizeof.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/decay.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/dependent_type.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/disjunction.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/enable_if.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/extent.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/has_unique_object_representation.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/has_virtual_destructor.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/integral_constant.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/invoke.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_abstract.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_aggregate.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_allocator.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_always_bitcastable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_arithmetic.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_array.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_base_of.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_bounded_array.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_callable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_char_like_type.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_class.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_compound.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_const.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_constant_evaluated.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_convertible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_copy_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_copy_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_core_convertible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_default_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_destructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_empty.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_enum.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_equality_comparable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_execution_policy.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_final.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_floating_point.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_function.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_fundamental.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_implicitly_default_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_integral.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_literal_type.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_member_function_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_member_object_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_member_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_move_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_move_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_convertible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_copy_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_copy_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_default_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_destructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_move_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_nothrow_move_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_null_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_object.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_pod.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_polymorphic.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_primary_template.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_reference.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_reference_wrapper.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_referenceable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_same.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_scalar.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_scoped_enum.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_signed.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_signed_integer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_specialization.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_standard_layout.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_swappable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivial.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_copy_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_copy_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_copyable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_default_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_destructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_lexicographically_comparable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_move_assignable.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_trivially_move_constructible.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_unbounded_array.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_union.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_unsigned.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_unsigned_integer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_valid_expansion.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_void.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/is_volatile.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/lazy.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/make_32_64_or_128_bit.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/make_const_lvalue_ref.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/make_signed.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/make_unsigned.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/maybe_const.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/nat.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/negation.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/noexcept_move_assign_container.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/operation_traits.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/promote.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/rank.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_all_extents.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_const.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_const_ref.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_cv.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_cvref.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_extent.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_pointer.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_reference.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/remove_volatile.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/result_of.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/strip_signature.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/type_identity.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/type_list.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/underlying_type.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/unwrap_ref.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__type_traits/void_t.h>", "private", "<type_traits>", "public" ] },
+ { include: [ "<__utility/as_const.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/as_lvalue.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/auto_cast.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/cmp.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/convert_to_integral.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/declval.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/empty.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/exception_guard.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/exchange.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/forward.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/forward_like.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/in_place.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/integer_sequence.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/is_pointer_in_range.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/move.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/no_destroy.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/pair.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/piecewise_construct.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/priority_tag.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/rel_ops.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/small_buffer.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/swap.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/to_underlying.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__utility/unreachable.h>", "private", "<utility>", "public" ] },
+ { include: [ "<__variant/monostate.h>", "private", "<variant>", "public" ] },
]
diff --git a/contrib/llvm-project/libcxx/include/locale b/contrib/llvm-project/libcxx/include/locale
index 70d22ff95e1e..9e97eb9f3395 100644
--- a/contrib/llvm-project/libcxx/include/locale
+++ b/contrib/llvm-project/libcxx/include/locale
@@ -3421,7 +3421,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert() {
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() {
_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
+ if (__cv_ == 0 || __bufptr_ == nullptr)
return traits_type::eof();
bool __initial = __read_mode();
char_type __1buf;
@@ -3478,7 +3478,7 @@ template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type
wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) {
_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) {
+ if (__cv_ != 0 && __bufptr_ && this->eback() < this->gptr()) {
if (traits_type::eq_int_type(__c, traits_type::eof())) {
this->gbump(-1);
return traits_type::not_eof(__c);
@@ -3496,7 +3496,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) {
_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
+ if (__cv_ == 0 || !__bufptr_)
return traits_type::eof();
__write_mode();
char_type __1buf;
@@ -3588,7 +3588,7 @@ template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __om) {
int __width = __cv_->encoding();
- if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
+ if (__cv_ == 0 || !__bufptr_ || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
// __width > 0 || __off == 0, now check __way
if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
@@ -3601,7 +3601,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir
template <class _Codecvt, class _Elem, class _Tr>
typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type
wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) {
- if (__cv_ == 0 || __bufptr_ == 0 || sync())
+ if (__cv_ == 0 || !__bufptr_ || sync())
return pos_type(off_type(-1));
if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1)))
return pos_type(off_type(-1));
@@ -3611,7 +3611,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode
template <class _Codecvt, class _Elem, class _Tr>
int wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() {
_LIBCPP_SUPPRESS_DEPRECATED_POP
- if (__cv_ == 0 || __bufptr_ == 0)
+ if (__cv_ == 0 || !__bufptr_)
return 0;
if (__cm_ & ios_base::out) {
if (this->pptr() != this->pbase())
diff --git a/contrib/llvm-project/libcxx/include/memory b/contrib/llvm-project/libcxx/include/memory
index ee245d5fd2dc..19c11ee94987 100644
--- a/contrib/llvm-project/libcxx/include/memory
+++ b/contrib/llvm-project/libcxx/include/memory
@@ -139,7 +139,7 @@ public:
template <class U> struct rebind {typedef allocator<U> other;}; // deprecated in C++17, removed in C++20
typedef true_type propagate_on_container_move_assignment;
- typedef true_type is_always_equal;
+ typedef true_type is_always_equal; // Deprecated in C++23, removed in C++26
constexpr allocator() noexcept; // constexpr in C++20
constexpr allocator(const allocator&) noexcept; // constexpr in C++20
diff --git a/contrib/llvm-project/libcxx/include/module.modulemap.in b/contrib/llvm-project/libcxx/include/module.modulemap.in
index d10670d4faaf..194a74a1e07b 100644
--- a/contrib/llvm-project/libcxx/include/module.modulemap.in
+++ b/contrib/llvm-project/libcxx/include/module.modulemap.in
@@ -1580,6 +1580,7 @@ module std_private_numeric_pstl_transform_reduce [system] {
export *
}
module std_private_numeric_reduce [system] { header "__numeric/reduce.h" }
+module std_private_numeric_saturation_arithmetic [system] { header "__numeric/saturation_arithmetic.h" }
module std_private_numeric_transform_exclusive_scan [system] { header "__numeric/transform_exclusive_scan.h" }
module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" }
module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" }
diff --git a/contrib/llvm-project/libcxx/include/new b/contrib/llvm-project/libcxx/include/new
index 136adc41c24b..86fbcb524b66 100644
--- a/contrib/llvm-project/libcxx/include/new
+++ b/contrib/llvm-project/libcxx/include/new
@@ -362,7 +362,6 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstdlib>
-# include <exception>
# include <type_traits>
#endif
diff --git a/contrib/llvm-project/libcxx/include/numeric b/contrib/llvm-project/libcxx/include/numeric
index d09d0a81fcc0..0fe7115f1c66 100644
--- a/contrib/llvm-project/libcxx/include/numeric
+++ b/contrib/llvm-project/libcxx/include/numeric
@@ -140,6 +140,18 @@ template<class T>
template<class T>
constexpr T* midpoint(T* a, T* b); // C++20
+// [numeric.sat], saturation arithmetic
+template<class T>
+constexpr T add_sat(T x, T y) noexcept; // freestanding, Since C++26
+template<class T>
+constexpr T sub_sat(T x, T y) noexcept; // freestanding, Since C++26
+template<class T>
+constexpr T mul_sat(T x, T y) noexcept; // freestanding, Since C++26
+template<class T>
+constexpr T div_sat(T x, T y) noexcept; // freestanding, Since C++26
+template<class T, class U>
+constexpr T saturate_cast(U x) noexcept; // freestanding, Since C++26
+
} // std
*/
@@ -160,6 +172,7 @@ template<class T>
#include <__numeric/pstl_reduce.h>
#include <__numeric/pstl_transform_reduce.h>
#include <__numeric/reduce.h>
+#include <__numeric/saturation_arithmetic.h>
#include <__numeric/transform_exclusive_scan.h>
#include <__numeric/transform_inclusive_scan.h>
#include <__numeric/transform_reduce.h>
diff --git a/contrib/llvm-project/libcxx/include/ostream b/contrib/llvm-project/libcxx/include/ostream
index 88ee9d93a1d3..e2b2c0cbaaf2 100644
--- a/contrib/llvm-project/libcxx/include/ostream
+++ b/contrib/llvm-project/libcxx/include/ostream
@@ -175,8 +175,6 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
#include <__availability>
#include <__config>
#include <__exception/operations.h>
-#include <__format/format_args.h>
-#include <__format/format_functions.h>
#include <__fwd/ostream.h>
#include <__memory/shared_ptr.h>
#include <__memory/unique_ptr.h>
@@ -188,6 +186,7 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
#include <__utility/declval.h>
#include <bitset>
#include <cstdio>
+#include <format>
#include <ios>
#include <locale>
#include <new>
@@ -1084,12 +1083,15 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(ostream& __os, string_view _
// native Unicode API;
// Whether the returned FILE* is "a terminal capable of displaying Unicode"
// is determined in the same way as the print(FILE*, ...) overloads.
-_LIBCPP_AVAILABILITY_PRINT _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
+_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os);
# ifndef _LIBCPP_HAS_NO_UNICODE
template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+_LIBCPP_HIDE_FROM_ABI void
__vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __write_nl) {
+#if _LIBCPP_AVAILABILITY_HAS_PRINT == 0
+ return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
+#else
FILE* __file = std::__get_ostream_file(__os);
if (!__file || !__print::__is_terminal(__file))
return std::__vprint_nonunicode(__os, __fmt, __args, __write_nl);
@@ -1124,20 +1126,21 @@ __vprint_unicode(ostream& __os, string_view __fmt, format_args __args, bool __wr
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
+#endif // _LIBCPP_AVAILABILITY_HAS_PRINT
}
template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI inline void
+_LIBCPP_HIDE_FROM_ABI inline void
vprint_unicode(ostream& __os, string_view __fmt, format_args __args) {
std::__vprint_unicode(__os, __fmt, __args, false);
}
# endif // _LIBCPP_HAS_NO_UNICODE
template <class... _Args>
-_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+_LIBCPP_HIDE_FROM_ABI void
print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
# ifndef _LIBCPP_HAS_NO_UNICODE
- if constexpr (__print::__use_unicode)
+ if constexpr (__print::__use_unicode_execution_charset)
std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false);
else
std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
@@ -1147,13 +1150,13 @@ print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
}
template <class... _Args>
-_LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
+_LIBCPP_HIDE_FROM_ABI void
println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
# ifndef _LIBCPP_HAS_NO_UNICODE
// Note the wording in the Standard is inefficient. The output of
// std::format is a std::string which is then copied. This solution
// just appends a newline at the end of the output.
- if constexpr (__print::__use_unicode)
+ if constexpr (__print::__use_unicode_execution_charset)
std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true);
else
std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
diff --git a/contrib/llvm-project/libcxx/include/print b/contrib/llvm-project/libcxx/include/print
index 5e00fc87f47e..7f2b5bac3dcf 100644
--- a/contrib/llvm-project/libcxx/include/print
+++ b/contrib/llvm-project/libcxx/include/print
@@ -34,17 +34,11 @@ namespace std {
#include <__assert> // all public C++ headers provide the assertion handler
#include <__concepts/same_as.h>
#include <__config>
-#include <__format/buffer.h>
-#include <__format/format_arg_store.h>
-#include <__format/format_args.h>
-#include <__format/format_context.h>
-#include <__format/format_error.h>
-#include <__format/format_functions.h>
-#include <__format/unicode.h>
#include <__system_error/system_error.h>
#include <__utility/forward.h>
#include <cerrno>
#include <cstdio>
+#include <format>
#include <string>
#include <string_view>
#include <version>
@@ -192,13 +186,13 @@ namespace __print {
//
# ifdef _LIBCPP_HAS_NO_UNICODE
-inline constexpr bool __use_unicode = false;
+inline constexpr bool __use_unicode_execution_charset = false;
# elif defined(_MSVC_EXECUTION_CHARACTER_SET)
// This is the same test MSVC STL uses in their implementation of <print>
// See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
-inline constexpr bool __use_unicode = _MSVC_EXECUTION_CHARACTER_SET == 65001;
+inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTER_SET == 65001;
# else
-inline constexpr bool __use_unicode = true;
+inline constexpr bool __use_unicode_execution_charset = true;
# endif
_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) {
@@ -333,7 +327,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI void print(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
# ifndef _LIBCPP_HAS_NO_UNICODE
- if constexpr (__print::__use_unicode)
+ if constexpr (__print::__use_unicode_execution_charset)
__print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
else
__print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
@@ -353,7 +347,7 @@ _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt
// Note the wording in the Standard is inefficient. The output of
// std::format is a std::string which is then copied. This solution
// just appends a newline at the end of the output.
- if constexpr (__print::__use_unicode)
+ if constexpr (__print::__use_unicode_execution_charset)
__print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
else
__print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
diff --git a/contrib/llvm-project/libcxx/include/regex b/contrib/llvm-project/libcxx/include/regex
index 0761d9de54a9..48af5b8b57fd 100644
--- a/contrib/llvm-project/libcxx/include/regex
+++ b/contrib/llvm-project/libcxx/include/regex
@@ -1889,9 +1889,6 @@ void __r_anchor_multiline<_CharT>::__exec(__state& __s) const {
if (__s.__current_ == __s.__last_ && !(__s.__flags_ & regex_constants::match_not_eol)) {
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
- } else if (__s.__current_ == __s.__first_ && !(__s.__flags_ & regex_constants::match_not_eol)) {
- __s.__do_ = __state::__accept_but_not_consume;
- __s.__node_ = this->first();
} else if (__multiline_ && std::__is_eol(*__s.__current_)) {
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
@@ -5127,6 +5124,14 @@ bool basic_regex<_CharT, _Traits>::__search(
}
__m.__matches_.assign(__m.size(), __m.__unmatched_);
}
+ __m.__matches_.assign(__m.size(), __m.__unmatched_);
+ if (__match_at_start(__first, __last, __m, __flags, false)) {
+ __m.__prefix_.second = __m[0].first;
+ __m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
+ __m.__suffix_.first = __m[0].second;
+ __m.__suffix_.matched = __m.__suffix_.first != __m.__suffix_.second;
+ return true;
+ }
}
__m.__matches_.clear();
return false;
diff --git a/contrib/llvm-project/libcxx/include/semaphore b/contrib/llvm-project/libcxx/include/semaphore
index de45b8b5db10..ac3d2d7fe02e 100644
--- a/contrib/llvm-project/libcxx/include/semaphore
+++ b/contrib/llvm-project/libcxx/include/semaphore
@@ -45,13 +45,18 @@ using binary_semaphore = counting_semaphore<1>;
*/
+#include <__config>
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+# error "<semaphore> is not supported since libc++ has been configured without support for threads."
+#endif
+
#include <__assert> // all public C++ headers provide the assertion handler
#include <__atomic/atomic_base.h>
#include <__atomic/atomic_sync.h>
#include <__atomic/memory_order.h>
#include <__availability>
#include <__chrono/time_point.h>
-#include <__config>
#include <__thread/poll_with_backoff.h>
#include <__thread/timed_backoff_policy.h>
#include <__threading_support>
@@ -63,10 +68,6 @@ using binary_semaphore = counting_semaphore<1>;
# pragma GCC system_header
#endif
-#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<semaphore> is not supported since libc++ has been configured without support for threads."
-#endif
-
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -91,7 +92,7 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr explicit __atomic_semaphore_base(ptrdiff_t __count) : __a_(__count) {}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
auto __old = __a_.fetch_add(__update, memory_order_release);
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__update <= _LIBCPP_SEMAPHORE_MAX - __old, "update is greater than the expected value");
if (__old > 0) {
@@ -137,11 +138,11 @@ public:
static constexpr ptrdiff_t max() noexcept { return __least_max_value; }
_LIBCPP_HIDE_FROM_ABI constexpr explicit counting_semaphore(ptrdiff_t __count) : __semaphore_(__count) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__count >= 0,
"counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
"initialized with a negative value");
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__count <= max(),
"counting_semaphore::counting_semaphore(ptrdiff_t): counting_semaphore cannot be "
"initialized with a value greater than max()");
@@ -152,7 +153,7 @@ public:
counting_semaphore& operator=(const counting_semaphore&) = delete;
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void release(ptrdiff_t __update = 1) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__update >= 0, "counting_semaphore:release called with a negative value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(__update >= 0, "counting_semaphore:release called with a negative value");
__semaphore_.release(__update);
}
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void acquire() { __semaphore_.acquire(); }
diff --git a/contrib/llvm-project/libcxx/include/shared_mutex b/contrib/llvm-project/libcxx/include/shared_mutex
index 1528d108d749..ac66b3a568bf 100644
--- a/contrib/llvm-project/libcxx/include/shared_mutex
+++ b/contrib/llvm-project/libcxx/include/shared_mutex
@@ -122,13 +122,18 @@ template <class Mutex>
*/
+#include <__config>
+
+# ifdef _LIBCPP_HAS_NO_THREADS
+# error "<shared_mutex> is not supported since libc++ has been configured without support for threads."
+# endif
+
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/steady_clock.h>
#include <__chrono/time_point.h>
#include <__condition_variable/condition_variable.h>
-#include <__config>
#include <__memory/addressof.h>
#include <__mutex/mutex.h>
#include <__mutex/tag_types.h>
@@ -147,10 +152,6 @@ _LIBCPP_PUSH_MACROS
# pragma GCC system_header
# endif
-# ifdef _LIBCPP_HAS_NO_THREADS
-# error "<shared_mutex> is not supported since libc++ has been configured without support for threads."
-# endif
-
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_EXPORTED_FROM_ABI __shared_mutex_base {
diff --git a/contrib/llvm-project/libcxx/include/span b/contrib/llvm-project/libcxx/include/span
index 007a32597f96..32364b4270be 100644
--- a/contrib/llvm-project/libcxx/include/span
+++ b/contrib/llvm-project/libcxx/include/span
@@ -68,6 +68,7 @@ public:
constexpr span(const array<value_type, N>& arr) noexcept;
template<class R>
constexpr explicit(Extent != dynamic_extent) span(R&& r);
+ constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il); // Since C++26
constexpr span(const span& other) noexcept = default;
template <class OtherElementType, size_t OtherExtent>
constexpr explicit(Extent != dynamic_extent) span(const span<OtherElementType, OtherExtent>& s) noexcept;
@@ -228,6 +229,15 @@ public:
requires(_Sz == 0)
_LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr} {}
+# if _LIBCPP_STD_VER >= 26
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit span(std::initializer_list<value_type> __il)
+ requires is_const_v<element_type>
+ : __data_{__il.begin()} {
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(
+ _Extent == __il.size(), "Size mismatch in span's constructor _Extent != __il.size().");
+ }
+# endif
+
constexpr span(const span&) noexcept = default;
constexpr span& operator=(const span&) noexcept = default;
@@ -397,6 +407,12 @@ public:
// [span.cons], span constructors, copy, assignment, and destructor
_LIBCPP_HIDE_FROM_ABI constexpr span() noexcept : __data_{nullptr}, __size_{0} {}
+# if _LIBCPP_STD_VER >= 26
+ _LIBCPP_HIDE_FROM_ABI constexpr span(std::initializer_list<value_type> __il)
+ requires is_const_v<element_type>
+ : __data_{__il.begin()}, __size_{__il.size()} {}
+# endif
+
constexpr span(const span&) noexcept = default;
constexpr span& operator=(const span&) noexcept = default;
diff --git a/contrib/llvm-project/libcxx/include/sstream b/contrib/llvm-project/libcxx/include/sstream
index 9f75b7e0ac9e..6c354cf0b397 100644
--- a/contrib/llvm-project/libcxx/include/sstream
+++ b/contrib/llvm-project/libcxx/include/sstream
@@ -1108,7 +1108,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#if _LIBCPP_STD_VER <= 20 && !defined(_LIPCPP_REMOVE_TRANSITIVE_INCLUDES)
+#if _LIBCPP_STD_VER <= 20 && !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
# include <type_traits>
#endif
diff --git a/contrib/llvm-project/libcxx/include/stop_token b/contrib/llvm-project/libcxx/include/stop_token
index b223ceb27f0d..66c7a6ab5996 100644
--- a/contrib/llvm-project/libcxx/include/stop_token
+++ b/contrib/llvm-project/libcxx/include/stop_token
@@ -31,8 +31,13 @@ namespace std {
*/
-#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+# error "<stop_token> is not supported since libc++ has been configured without support for threads."
+#endif
+
+#include <__assert> // all public C++ headers provide the assertion handler
#include <__stop_token/stop_callback.h>
#include <__stop_token/stop_source.h>
#include <__stop_token/stop_token.h>
@@ -42,10 +47,6 @@ namespace std {
# pragma GCC system_header
#endif
-#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<stop_token> is not supported since libc++ has been configured without support for threads."
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <iosfwd>
#endif
diff --git a/contrib/llvm-project/libcxx/include/string b/contrib/llvm-project/libcxx/include/string
index c676182fba8b..e97139206d4f 100644
--- a/contrib/llvm-project/libcxx/include/string
+++ b/contrib/llvm-project/libcxx/include/string
@@ -922,7 +922,7 @@ public:
// Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
// does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first.
// __str's memory needs to be unpoisoned only in the case where it's a short string.
- : __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)), std::move(__str.__r_))) {
+ : __r_([](basic_string &__s) -> decltype(__s.__r_)&& { if(!__s.__is_long()) __s.__annotate_delete(); return std::move(__s.__r_); }(__str)) {
__str.__r_.first() = __rep();
__str.__annotate_new(0);
if (!__is_long())
@@ -1891,8 +1891,7 @@ private:
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
const void* __begin = data();
const void* __end = data() + capacity() + 1;
- if (!__libcpp_is_constant_evaluated() && __begin != nullptr &&
- is_same<allocator_type, __default_allocator_type>::value)
+ if (__asan_annotate_container_with_allocator<allocator_type>::value && !__libcpp_is_constant_evaluated())
__sanitizer_annotate_contiguous_container(__begin, __end, __old_mid, __new_mid);
#endif
}
diff --git a/contrib/llvm-project/libcxx/include/string_view b/contrib/llvm-project/libcxx/include/string_view
index 909224fe7e3d..e414507a7933 100644
--- a/contrib/llvm-project/libcxx/include/string_view
+++ b/contrib/llvm-project/libcxx/include/string_view
@@ -307,8 +307,11 @@ public:
: __data_(__s),
__size_(__len) {
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_ASSERT_UNCATEGORIZED(__len <= static_cast<size_type>(numeric_limits<difference_type>::max()),
- "string_view::string_view(_CharT *, size_t): length does not fit in difference_type");
+ // This will result in creating an invalid `string_view` object -- some calculations involving `size` would
+ // overflow, making it effectively truncated.
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __len <= static_cast<size_type>(numeric_limits<difference_type>::max()),
+ "string_view::string_view(_CharT *, size_t): length does not fit in difference_type");
_LIBCPP_ASSERT_NON_NULL(
__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
#endif
diff --git a/contrib/llvm-project/libcxx/include/thread b/contrib/llvm-project/libcxx/include/thread
index 1cf22bf6aaf9..84c80d04cf03 100644
--- a/contrib/llvm-project/libcxx/include/thread
+++ b/contrib/llvm-project/libcxx/include/thread
@@ -86,9 +86,14 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
*/
+#include <__config>
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+# error "<thread> is not supported since libc++ has been configured without support for threads."
+#endif
+
#include <__assert> // all public C++ headers provide the assertion handler
#include <__availability>
-#include <__config>
#include <__thread/formatter.h>
#include <__thread/jthread.h>
#include <__thread/this_thread.h>
@@ -105,10 +110,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
# pragma GCC system_header
#endif
-#ifdef _LIBCPP_HAS_NO_THREADS
-# error "<thread> is not supported since libc++ has been configured without support for threads."
-#endif
-
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
# include <cstddef>
# include <ctime>
diff --git a/contrib/llvm-project/libcxx/include/typeinfo b/contrib/llvm-project/libcxx/include/typeinfo
index 39a90676cc44..1144b5b12913 100644
--- a/contrib/llvm-project/libcxx/include/typeinfo
+++ b/contrib/llvm-project/libcxx/include/typeinfo
@@ -372,7 +372,6 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <cstdlib>
-# include <exception>
# include <type_traits>
#endif
diff --git a/contrib/llvm-project/libcxx/include/variant b/contrib/llvm-project/libcxx/include/variant
index 6179b2a1a0ab..6063739e52c8 100644
--- a/contrib/llvm-project/libcxx/include/variant
+++ b/contrib/llvm-project/libcxx/include/variant
@@ -69,6 +69,12 @@ namespace std {
// 20.7.2.6, swap
void swap(variant&) noexcept(see below);
+
+ // [variant.visit], visitation
+ template<class Self, class Visitor>
+ constexpr decltype(auto) visit(this Self&&, Visitor&&); // Since C++26
+ template<class R, class Self, class Visitor>
+ constexpr R visit(this Self&&, Visitor&&); // Since C++26
};
// 20.7.3, variant helper classes
@@ -235,6 +241,7 @@ namespace std {
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
+#include <__utility/forward_like.h>
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__utility/swap.h>
@@ -801,14 +808,15 @@ protected:
_LIBCPP_HIDE_FROM_ABI static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
__lhs.__destroy();
if (!__rhs.valueless_by_exception()) {
+ auto __rhs_index = __rhs.index();
__visitation::__base::__visit_alt_at(
- __rhs.index(),
+ __rhs_index,
[](auto& __lhs_alt, auto&& __rhs_alt) {
__construct_alt(__lhs_alt, std::forward<decltype(__rhs_alt)>(__rhs_alt).__value);
},
__lhs,
std::forward<_Rhs>(__rhs));
- __lhs.__index = __rhs.index();
+ __lhs.__index = __rhs_index;
}
}
};
@@ -1130,6 +1138,19 @@ using __best_match_t = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp,
} // namespace __variant_detail
+template <class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...>>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto)
+visit(_Visitor&& __visitor, _Vs&&... __vs);
+
+# if _LIBCPP_STD_VER >= 20
+template <class _Rp,
+ class _Visitor,
+ class... _Vs,
+ typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...>>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp
+visit(_Visitor&& __visitor, _Vs&&... __vs);
+# endif
+
template <class... _Types>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant
: private __sfinae_ctor_base< __all<is_copy_constructible_v<_Types>...>::value,
@@ -1273,6 +1294,27 @@ public:
__impl_.__swap(__that.__impl_);
}
+# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
+ // Helper class to implement [variant.visit]/10
+ // Constraints: The call to visit does not use an explicit template-argument-list
+ // that begins with a type template-argument.
+ struct __variant_visit_barrier_tag {
+ _LIBCPP_HIDE_FROM_ABI explicit __variant_visit_barrier_tag() = default;
+ };
+
+ template <__variant_visit_barrier_tag = __variant_visit_barrier_tag{}, class _Self, class _Visitor>
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) visit(this _Self&& __self, _Visitor&& __visitor) {
+ using _VariantT = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>;
+ return std::visit(std::forward<_Visitor>(__visitor), (_VariantT)__self);
+ }
+
+ template <class _Rp, class _Self, class _Visitor>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Rp visit(this _Self&& __self, _Visitor&& __visitor) {
+ using _VariantT = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>;
+ return std::visit<_Rp>(std::forward<_Visitor>(__visitor), (_VariantT)__self);
+ }
+# endif
+
private:
__variant_detail::__impl<_Types...> __impl_;
@@ -1511,7 +1553,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr vo
}
}
-template < class _Visitor, class... _Vs, typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
+template < class _Visitor, class... _Vs, typename>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr decltype(auto)
visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
@@ -1520,10 +1562,7 @@ visit(_Visitor&& __visitor, _Vs&&... __vs) {
}
# if _LIBCPP_STD_VER >= 20
-template < class _Rp,
- class _Visitor,
- class... _Vs,
- typename = void_t<decltype(std::__as_variant(std::declval<_Vs>()))...> >
+template < class _Rp, class _Visitor, class... _Vs, typename>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr _Rp
visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
diff --git a/contrib/llvm-project/libcxx/include/vector b/contrib/llvm-project/libcxx/include/vector
index 0098273a195f..e9dd57055cb1 100644
--- a/contrib/llvm-project/libcxx/include/vector
+++ b/contrib/llvm-project/libcxx/include/vector
@@ -832,12 +832,12 @@ private:
// the documentation for __sanitizer_annotate_contiguous_container.
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_contiguous_container(
- const void* __beg, const void* __end, const void* __old_mid, const void* __new_mid) const {
- (void)__beg;
- (void)__end;
+ const void* __old_mid, const void* __new_mid) const {
(void)__old_mid;
(void)__new_mid;
#ifndef _LIBCPP_HAS_NO_ASAN
+ const void* __beg = data();
+ const void* __end = data() + capacity();
if (!__libcpp_is_constant_evaluated() && __beg != nullptr &&
__asan_annotate_container_with_allocator<_Allocator>::value)
__sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
@@ -847,27 +847,27 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
(void)__current_size;
#ifndef _LIBCPP_HAS_NO_ASAN
- __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size);
+ __annotate_contiguous_container(data() + capacity(), data() + __current_size);
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
#ifndef _LIBCPP_HAS_NO_ASAN
- __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity());
+ __annotate_contiguous_container(data() + size(), data() + capacity());
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_increase(size_type __n) const _NOEXCEPT {
(void)__n;
#ifndef _LIBCPP_HAS_NO_ASAN
- __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n);
+ __annotate_contiguous_container(data() + size(), data() + size() + __n);
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
(void)__old_size;
#ifndef _LIBCPP_HAS_NO_ASAN
- __annotate_contiguous_container(data(), data() + capacity(), data() + __old_size, data() + size());
+ __annotate_contiguous_container(data() + __old_size, data() + size());
#endif
}
diff --git a/contrib/llvm-project/libcxx/include/version b/contrib/llvm-project/libcxx/include/version
index c96647894dce..9e26da8c1b24 100644
--- a/contrib/llvm-project/libcxx/include/version
+++ b/contrib/llvm-project/libcxx/include/version
@@ -504,10 +504,10 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_out_ptr 202311L
# define __cpp_lib_ratio 202306L
// # define __cpp_lib_rcu 202306L
-// # define __cpp_lib_saturation_arithmetic 202311L
+# define __cpp_lib_saturation_arithmetic 202311L
// # define __cpp_lib_smart_ptr_owner_equality 202306L
# define __cpp_lib_span_at 202311L
-// # define __cpp_lib_span_initializer_list 202311L
+# define __cpp_lib_span_initializer_list 202311L
// # define __cpp_lib_sstream_from_string_view 202306L
// # define __cpp_lib_submdspan 202306L
// # define __cpp_lib_text_encoding 202306L
diff --git a/contrib/llvm-project/libcxx/modules/modules.json.in b/contrib/llvm-project/libcxx/modules/modules.json.in
new file mode 100644
index 000000000000..ddc377f28f91
--- /dev/null
+++ b/contrib/llvm-project/libcxx/modules/modules.json.in
@@ -0,0 +1,26 @@
+{
+ "version": 1,
+ "revision": 1,
+ "modules": [
+ {
+ "logical-name": "std",
+ "source-path": "@LIBCXX_MODULE_RELATIVE_PATH@/std.cppm",
+ "is-standard-library": true,
+ "local-arguments": {
+ "system-include-directories": [
+ "@LIBCXX_MODULE_RELATIVE_PATH@"
+ ]
+ }
+ },
+ {
+ "logical-name": "std.compat",
+ "source-path": "@LIBCXX_MODULE_RELATIVE_PATH@/std.compat.cppm",
+ "is-std-library": true,
+ "local-arguments": {
+ "system-include-directories": [
+ "@LIBCXX_MODULE_RELATIVE_PATH@"
+ ]
+ }
+ }
+ ]
+}
diff --git a/contrib/llvm-project/libcxx/modules/std.compat.cppm.in b/contrib/llvm-project/libcxx/modules/std.compat.cppm.in
index f199e194e60b..651d6ec7b9fe 100644
--- a/contrib/llvm-project/libcxx/modules/std.compat.cppm.in
+++ b/contrib/llvm-project/libcxx/modules/std.compat.cppm.in
@@ -17,38 +17,17 @@ module;
// The headers of Table 24: C++ library headers [tab:headers.cpp]
// and the headers of Table 25: C++ headers for C library facilities [tab:headers.cpp.c]
-#include <algorithm>
-#include <any>
-#include <array>
-#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
-# include <atomic>
-#endif
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <barrier>
-#endif
-#include <bit>
-#include <bitset>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
-#include <charconv>
-#include <chrono>
#include <cinttypes>
#include <climits>
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
# include <clocale>
#endif
#include <cmath>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <codecvt>
-#endif
-#include <compare>
-#include <complex>
-#include <concepts>
-#include <condition_variable>
-#include <coroutine>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
@@ -65,107 +44,6 @@ module;
#if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
# include <cwctype>
#endif
-#include <deque>
-#include <exception>
-#include <execution>
-#include <expected>
-#include <filesystem>
-#include <format>
-#include <forward_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <fstream>
-#endif
-#include <functional>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <future>
-#endif
-#include <initializer_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iomanip>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <ios>
-#endif
-#include <iosfwd>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iostream>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <istream>
-#endif
-#include <iterator>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <latch>
-#endif
-#include <limits>
-#include <list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <locale>
-#endif
-#include <map>
-#include <mdspan>
-#include <memory>
-#include <memory_resource>
-#include <mutex>
-#include <new>
-#include <numbers>
-#include <numeric>
-#include <optional>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <ostream>
-#endif
-#include <print>
-#include <queue>
-#include <random>
-#include <ranges>
-#include <ratio>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <regex>
-#endif
-#include <scoped_allocator>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <semaphore>
-#endif
-#include <set>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <shared_mutex>
-#endif
-#include <source_location>
-#include <span>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <sstream>
-#endif
-#include <stack>
-#include <stdexcept>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <stop_token>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <streambuf>
-#endif
-#include <string>
-#include <string_view>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <strstream>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <syncstream>
-#endif
-#include <system_error>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <thread>
-#endif
-#include <tuple>
-#include <type_traits>
-#include <typeindex>
-#include <typeinfo>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <valarray>
-#include <variant>
-#include <vector>
-#include <version>
// *** Headers not yet available ***
#if __has_include(<debugging>)
@@ -203,6 +81,7 @@ module;
#endif // __has_include(<text_encoding>)
export module std.compat;
+export import std;
+
-@LIBCXX_MODULE_STD_INCLUDE_SOURCES@
@LIBCXX_MODULE_STD_COMPAT_INCLUDE_SOURCES@ \ No newline at end of file
diff --git a/contrib/llvm-project/libcxx/modules/std.compat/cstdlib.inc b/contrib/llvm-project/libcxx/modules/std.compat/cstdlib.inc
index 9333d8487071..a45a0a1caf8b 100644
--- a/contrib/llvm-project/libcxx/modules/std.compat/cstdlib.inc
+++ b/contrib/llvm-project/libcxx/modules/std.compat/cstdlib.inc
@@ -16,10 +16,10 @@ export {
// [support.start.term], start and termination
using ::_Exit;
using ::abort;
- using ::at_quick_exit;
+ using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
using ::atexit;
using ::exit;
- using ::quick_exit;
+ using ::quick_exit _LIBCPP_USING_IF_EXISTS;
using ::getenv;
using ::system;
diff --git a/contrib/llvm-project/libcxx/modules/std.compat/ctime.inc b/contrib/llvm-project/libcxx/modules/std.compat/ctime.inc
index 92e3403a5e58..6e621f494348 100644
--- a/contrib/llvm-project/libcxx/modules/std.compat/ctime.inc
+++ b/contrib/llvm-project/libcxx/modules/std.compat/ctime.inc
@@ -24,5 +24,5 @@ export {
using ::mktime;
using ::strftime;
using ::time;
- using ::timespec_get;
+ using ::timespec_get _LIBCPP_USING_IF_EXISTS;
} // export
diff --git a/contrib/llvm-project/libcxx/modules/std.cppm.in b/contrib/llvm-project/libcxx/modules/std.cppm.in
index b46c52e781f8..6ce8e287737b 100644
--- a/contrib/llvm-project/libcxx/modules/std.cppm.in
+++ b/contrib/llvm-project/libcxx/modules/std.cppm.in
@@ -204,4 +204,5 @@ module;
export module std;
+
@LIBCXX_MODULE_STD_INCLUDE_SOURCES@
diff --git a/contrib/llvm-project/libcxx/modules/std/ctime.inc b/contrib/llvm-project/libcxx/modules/std/ctime.inc
index c407ffc35e3f..c98cb28e649b 100644
--- a/contrib/llvm-project/libcxx/modules/std/ctime.inc
+++ b/contrib/llvm-project/libcxx/modules/std/ctime.inc
@@ -24,5 +24,5 @@ export namespace std {
using std::mktime;
using std::strftime;
using std::time;
- using std::timespec_get;
+ using std::timespec_get _LIBCPP_USING_IF_EXISTS;
} // namespace std
diff --git a/contrib/llvm-project/libcxx/modules/std/memory.inc b/contrib/llvm-project/libcxx/modules/std/memory.inc
index fba2461732c1..ef89845457fb 100644
--- a/contrib/llvm-project/libcxx/modules/std/memory.inc
+++ b/contrib/llvm-project/libcxx/modules/std/memory.inc
@@ -156,7 +156,9 @@ export namespace std {
using std::reinterpret_pointer_cast;
using std::static_pointer_cast;
+#ifndef _LIBCPP_HAS_NO_RTTI
using std::get_deleter;
+#endif // _LIBCPP_HAS_NO_RTTI
// [util.smartptr.shared.io], shared_ptr I/O
diff --git a/contrib/llvm-project/libcxx/modules/std/numeric.inc b/contrib/llvm-project/libcxx/modules/std/numeric.inc
index d2b7688d4e5f..3bc7b2316815 100644
--- a/contrib/llvm-project/libcxx/modules/std/numeric.inc
+++ b/contrib/llvm-project/libcxx/modules/std/numeric.inc
@@ -54,4 +54,14 @@ export namespace std {
// [numeric.ops.midpoint], midpoint
using std::midpoint;
+
+#if _LIBCPP_STD_VER >= 26
+ // [numeric.sat], saturation arithmetic
+ using std::add_sat;
+ using std::div_sat;
+ using std::mul_sat;
+ using std::saturate_cast;
+ using std::sub_sat;
+#endif
+
} // namespace std
diff --git a/contrib/llvm-project/libcxx/src/filesystem/operations.cpp b/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
index a84a54b27d3e..62bb248d5eca 100644
--- a/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
+++ b/contrib/llvm-project/libcxx/src/filesystem/operations.cpp
@@ -460,8 +460,21 @@ path __current_path(error_code* ec) {
typedef decltype(&::free) Deleter;
Deleter deleter = &::free;
#else
+ errno = 0; // Note: POSIX mandates that modifying `errno` is thread-safe.
auto size = ::pathconf(".", _PC_PATH_MAX);
- _LIBCPP_ASSERT_UNCATEGORIZED(size >= 0, "pathconf returned a 0 as max size");
+ if (size == -1) {
+ if (errno != 0) {
+ return err.report(capture_errno(), "call to pathconf failed");
+
+ // `pathconf` returns `-1` without an error to indicate no limit.
+ } else {
+# if defined(__MVS__) && !defined(PATH_MAX)
+ size = _XOPEN_PATH_MAX + 1;
+# else
+ size = PATH_MAX + 1;
+# endif
+ }
+ }
auto buff = unique_ptr<path::value_type[]>(new path::value_type[size + 1]);
path::value_type* ptr = buff.get();
@@ -608,10 +621,9 @@ void __permissions(const path& p, perms prms, perm_options opts, error_code* ec)
const bool resolve_symlinks = !has_opt(perm_options::nofollow);
const bool add_perms = has_opt(perm_options::add);
const bool remove_perms = has_opt(perm_options::remove);
- _LIBCPP_ASSERT_UNCATEGORIZED(
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
(add_perms + remove_perms + has_opt(perm_options::replace)) == 1,
- "One and only one of the perm_options constants replace, add, or remove "
- "is present in opts");
+ "One and only one of the perm_options constants 'replace', 'add', or 'remove' must be present in opts");
bool set_sym_perms = false;
prms &= perms::mask;
@@ -621,7 +633,9 @@ void __permissions(const path& p, perms prms, perm_options opts, error_code* ec)
set_sym_perms = is_symlink(st);
if (m_ec)
return err.report(m_ec);
- _LIBCPP_ASSERT_UNCATEGORIZED(st.permissions() != perms::unknown, "Permissions unexpectedly unknown");
+ // TODO(hardening): double-check this assertion -- it might be a valid (if rare) case when the permissions are
+ // unknown.
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(st.permissions() != perms::unknown, "Permissions unexpectedly unknown");
if (add_perms)
prms |= st.permissions();
else if (remove_perms)
@@ -668,7 +682,7 @@ path __read_symlink(const path& p, error_code* ec) {
detail::SSizeT ret;
if ((ret = detail::readlink(p.c_str(), buff.get(), size)) == -1)
return err.report(capture_errno());
- _LIBCPP_ASSERT_UNCATEGORIZED(ret > 0, "TODO");
+ // Note that `ret` returning `0` would work, resulting in a valid empty string being returned.
if (static_cast<size_t>(ret) >= size)
return err.report(errc::value_too_large);
buff[ret] = 0;
diff --git a/contrib/llvm-project/libcxx/src/include/overridable_function.h b/contrib/llvm-project/libcxx/src/include/overridable_function.h
new file mode 100644
index 000000000000..7b0fba10f47d
--- /dev/null
+++ b/contrib/llvm-project/libcxx/src/include/overridable_function.h
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H
+#define _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H
+
+#include <__config>
+#include <cstdint>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+//
+// This file provides the std::__is_function_overridden utility, which allows checking
+// whether an overridable function (typically a weak symbol) like `operator new`
+// has been overridden by a user or not.
+//
+// This is a low-level utility which does not work on all platforms, since it needs
+// to make assumptions about the object file format in use. Furthermore, it requires
+// the "base definition" of the function (the one we want to check whether it has been
+// overridden) to be annotated with the _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE macro.
+//
+// This currently works with Mach-O files (used on Darwin) and with ELF files (used on Linux
+// and others). On platforms where we know how to implement this detection, the macro
+// _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION is defined to 1, and it is defined to 0 on
+// other platforms. The _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE macro is defined to
+// nothing on unsupported platforms so that it can be used to decorate functions regardless
+// of whether detection is actually supported.
+//
+// How does this work?
+// -------------------
+//
+// Let's say we want to check whether a weak function `f` has been overridden by the user.
+// The general mechanism works by placing `f`'s definition (in the libc++ built library)
+// inside a special section, which we do using the `__section__` attribute via the
+// _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE macro.
+//
+// Then, when comes the time to check whether the function has been overridden, we take
+// the address of the function and we check whether it falls inside the special function
+// we created. This can be done by finding pointers to the start and the end of the section
+// (which is done differently for ELF and Mach-O), and then checking whether `f` falls
+// within those bounds. If it falls within those bounds, then `f` is still inside the
+// special section and so it is the version we defined in the libc++ built library, i.e.
+// it was not overridden. Otherwise, it was overridden by the user because it falls
+// outside of the section.
+//
+// Important note
+// --------------
+//
+// This mechanism should never be used outside of the libc++ built library. In particular,
+// attempting to use this within the libc++ headers will not work at all because we don't
+// want to be defining special sections inside user's executables which use our headers.
+// This is provided inside libc++'s include tree solely to make it easier to share with
+// libc++abi, which needs the same mechanism.
+//
+
+#if defined(_LIBCPP_OBJECT_FORMAT_MACHO)
+
+# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
+# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE \
+ __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions")))
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Ret, class... _Args>
+_LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) noexcept {
+ // Declare two dummy bytes and give them these special `__asm` values. These values are
+ // defined by the linker, which means that referring to `&__lcxx_override_start` will
+ // effectively refer to the address where the section starts (and same for the end).
+ extern char __lcxx_override_start __asm("section$start$__TEXT$__lcxx_override");
+ extern char __lcxx_override_end __asm("section$end$__TEXT$__lcxx_override");
+
+ // Now get a uintptr_t out of these locations, and out of the function pointer.
+ uintptr_t __start = reinterpret_cast<uintptr_t>(&__lcxx_override_start);
+ uintptr_t __end = reinterpret_cast<uintptr_t>(&__lcxx_override_end);
+ uintptr_t __ptr = reinterpret_cast<uintptr_t>(__fptr);
+
+ // Finally, the function was overridden if it falls outside of the section's bounds.
+ return __ptr < __start || __ptr > __end;
+}
+_LIBCPP_END_NAMESPACE_STD
+
+#elif defined(_LIBCPP_OBJECT_FORMAT_ELF)
+
+# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
+# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE __attribute__((__section__("__lcxx_override")))
+
+// This is very similar to what we do for Mach-O above. The ELF linker will implicitly define
+// variables with those names corresponding to the start and the end of the section.
+//
+// See https://stackoverflow.com/questions/16552710/how-do-you-get-the-start-and-end-addresses-of-a-custom-elf-section
+extern char __start___lcxx_override;
+extern char __stop___lcxx_override;
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Ret, class... _Args>
+_LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) noexcept {
+ uintptr_t __start = reinterpret_cast<uintptr_t>(&__start___lcxx_override);
+ uintptr_t __end = reinterpret_cast<uintptr_t>(&__stop___lcxx_override);
+ uintptr_t __ptr = reinterpret_cast<uintptr_t>(__fptr);
+
+ return __ptr < __start || __ptr > __end;
+}
+_LIBCPP_END_NAMESPACE_STD
+
+#else
+
+# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0
+# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE /* nothing */
+
+#endif
+
+#endif // _LIBCPP_SRC_INCLUDE_OVERRIDABLE_FUNCTION_H
diff --git a/contrib/llvm-project/libcxx/src/include/to_chars_floating_point.h b/contrib/llvm-project/libcxx/src/include/to_chars_floating_point.h
index e4715d10d97d..01c26181697b 100644
--- a/contrib/llvm-project/libcxx/src/include/to_chars_floating_point.h
+++ b/contrib/llvm-project/libcxx/src/include/to_chars_floating_point.h
@@ -994,7 +994,7 @@ to_chars_result _Floating_to_chars(
if constexpr (_Overload == _Floating_to_chars_overload::_Plain) {
_LIBCPP_ASSERT_INTERNAL(_Fmt == chars_format{}, ""); // plain overload must pass chars_format{} internally
} else {
- _LIBCPP_ASSERT_UNCATEGORIZED(_Fmt == chars_format::general || _Fmt == chars_format::scientific
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(_Fmt == chars_format::general || _Fmt == chars_format::scientific
|| _Fmt == chars_format::fixed || _Fmt == chars_format::hex,
"invalid format in to_chars()");
}
diff --git a/contrib/llvm-project/libcxx/src/memory_resource.cpp b/contrib/llvm-project/libcxx/src/memory_resource.cpp
index 42c366893f73..2117238e6348 100644
--- a/contrib/llvm-project/libcxx/src/memory_resource.cpp
+++ b/contrib/llvm-project/libcxx/src/memory_resource.cpp
@@ -189,7 +189,8 @@ void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate(
return;
}
}
- _LIBCPP_ASSERT_UNCATEGORIZED(false, "deallocating a block that was not allocated with this allocator");
+ // The request to deallocate memory ends up being a no-op, likely resulting in a memory leak.
+ _LIBCPP_ASSERT_VALID_DEALLOCATION(false, "deallocating a block that was not allocated with this allocator");
}
}
diff --git a/contrib/llvm-project/libcxx/src/mutex.cpp b/contrib/llvm-project/libcxx/src/mutex.cpp
index ce854757ac08..2f8504d602dc 100644
--- a/contrib/llvm-project/libcxx/src/mutex.cpp
+++ b/contrib/llvm-project/libcxx/src/mutex.cpp
@@ -36,7 +36,8 @@ bool mutex::try_lock() noexcept { return __libcpp_mutex_trylock(&__m_); }
void mutex::unlock() noexcept {
int ec = __libcpp_mutex_unlock(&__m_);
(void)ec;
- _LIBCPP_ASSERT_UNCATEGORIZED(ec == 0, "call to mutex::unlock failed");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(
+ ec == 0, "call to mutex::unlock failed. A possible reason is that the mutex wasn't locked");
}
// recursive_mutex
@@ -50,7 +51,7 @@ recursive_mutex::recursive_mutex() {
recursive_mutex::~recursive_mutex() {
int e = __libcpp_recursive_mutex_destroy(&__m_);
(void)e;
- _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to ~recursive_mutex() failed");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(e == 0, "call to ~recursive_mutex() failed");
}
void recursive_mutex::lock() {
@@ -62,7 +63,8 @@ void recursive_mutex::lock() {
void recursive_mutex::unlock() noexcept {
int e = __libcpp_recursive_mutex_unlock(&__m_);
(void)e;
- _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to recursive_mutex::unlock() failed");
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(
+ e == 0, "call to recursive_mutex::unlock() failed. A possible reason is that the mutex wasn't locked");
}
bool recursive_mutex::try_lock() noexcept { return __libcpp_recursive_mutex_trylock(&__m_); }
diff --git a/contrib/llvm-project/libcxx/src/new.cpp b/contrib/llvm-project/libcxx/src/new.cpp
index 033bba5c1fc9..0869d90661dd 100644
--- a/contrib/llvm-project/libcxx/src/new.cpp
+++ b/contrib/llvm-project/libcxx/src/new.cpp
@@ -6,7 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "include/overridable_function.h"
#include <__memory/aligned_alloc.h>
+#include <cstddef>
#include <cstdlib>
#include <new>
@@ -15,12 +17,16 @@
// The code below is copied as-is into libc++abi's libcxxabi/src/stdlib_new_delete.cpp
// file. The version in this file is the canonical one.
+inline void __throw_bad_alloc_shim() { std::__throw_bad_alloc(); }
+
+# define _LIBCPP_ASSERT_SHIM(expr, str) _LIBCPP_ASSERT(expr, str)
+
// ------------------ BEGIN COPY ------------------
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overridden by programs
// that define non-weak copies of the functions.
-static void* operator_new_impl(std::size_t size) noexcept {
+static void* operator_new_impl(std::size_t size) {
if (size == 0)
size = 1;
void* p;
@@ -36,41 +42,63 @@ static void* operator_new_impl(std::size_t size) noexcept {
return p;
}
-_LIBCPP_WEAK void* operator new(std::size_t size) _THROW_BAD_ALLOC {
+_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new(std::size_t size) _THROW_BAD_ALLOC {
void* p = operator_new_impl(size);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
if (p == nullptr)
- throw std::bad_alloc();
-# endif
+ __throw_bad_alloc_shim();
return p;
}
_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
+# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+ _LIBCPP_ASSERT_SHIM(
+ !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new)),
+ "libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, "
+ "but `operator new(size_t, nothrow_t)` has not been overridden. This is problematic because "
+ "`operator new(size_t, nothrow_t)` must call `operator new(size_t)`, which will terminate in case "
+ "it fails to allocate, making it impossible for `operator new(size_t, nothrow_t)` to fulfill its "
+ "contract (since it should return nullptr upon failure). Please make sure you override "
+ "`operator new(size_t, nothrow_t)` as well.");
+# endif
+
+ return operator_new_impl(size);
+# else
void* p = nullptr;
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
p = ::operator new(size);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
}
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
return p;
+# endif
}
-_LIBCPP_WEAK void* operator new[](size_t size) _THROW_BAD_ALLOC { return ::operator new(size); }
+_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void* operator new[](size_t size) _THROW_BAD_ALLOC {
+ return ::operator new(size);
+}
_LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
+# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+ _LIBCPP_ASSERT_SHIM(
+ !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new[])),
+ "libc++ was configured with exceptions disabled and `operator new[](size_t)` has been overridden, "
+ "but `operator new[](size_t, nothrow_t)` has not been overridden. This is problematic because "
+ "`operator new[](size_t, nothrow_t)` must call `operator new[](size_t)`, which will terminate in case "
+ "it fails to allocate, making it impossible for `operator new[](size_t, nothrow_t)` to fulfill its "
+ "contract (since it should return nullptr upon failure). Please make sure you override "
+ "`operator new[](size_t, nothrow_t)` as well.");
+# endif
+
+ return operator_new_impl(size);
+# else
void* p = nullptr;
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
p = ::operator new[](size);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
}
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
return p;
+# endif
}
_LIBCPP_WEAK void operator delete(void* ptr) noexcept { std::free(ptr); }
@@ -87,7 +115,7 @@ _LIBCPP_WEAK void operator delete[](void* ptr, size_t) noexcept { ::operator del
# if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
-static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) noexcept {
+static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignment) {
if (size == 0)
size = 1;
if (static_cast<size_t>(alignment) < sizeof(void*))
@@ -107,43 +135,66 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm
return p;
}
-_LIBCPP_WEAK void* operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
+_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void*
+operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
void* p = operator_new_aligned_impl(size, alignment);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
if (p == nullptr)
- throw std::bad_alloc();
-# endif
+ __throw_bad_alloc_shim();
return p;
}
_LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
+# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+ _LIBCPP_ASSERT_SHIM(
+ !std::__is_function_overridden(static_cast<void* (*)(std::size_t, std::align_val_t)>(&operator new)),
+ "libc++ was configured with exceptions disabled and `operator new(size_t, align_val_t)` has been overridden, "
+ "but `operator new(size_t, align_val_t, nothrow_t)` has not been overridden. This is problematic because "
+ "`operator new(size_t, align_val_t, nothrow_t)` must call `operator new(size_t, align_val_t)`, which will "
+ "terminate in case it fails to allocate, making it impossible for `operator new(size_t, align_val_t, nothrow_t)` "
+ "to fulfill its contract (since it should return nullptr upon failure). Please make sure you override "
+ "`operator new(size_t, align_val_t, nothrow_t)` as well.");
+# endif
+
+ return operator_new_aligned_impl(size, alignment);
+# else
void* p = nullptr;
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
p = ::operator new(size, alignment);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
}
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
return p;
+# endif
}
-_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
+_LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE _LIBCPP_WEAK void*
+operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC {
return ::operator new(size, alignment);
}
_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
+# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
+# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
+ _LIBCPP_ASSERT_SHIM(
+ !std::__is_function_overridden(static_cast<void* (*)(std::size_t, std::align_val_t)>(&operator new[])),
+ "libc++ was configured with exceptions disabled and `operator new[](size_t, align_val_t)` has been overridden, "
+ "but `operator new[](size_t, align_val_t, nothrow_t)` has not been overridden. This is problematic because "
+ "`operator new[](size_t, align_val_t, nothrow_t)` must call `operator new[](size_t, align_val_t)`, which will "
+ "terminate in case it fails to allocate, making it impossible for `operator new[](size_t, align_val_t, "
+ "nothrow_t)` to fulfill its contract (since it should return nullptr upon failure). Please make sure you "
+ "override "
+ "`operator new[](size_t, align_val_t, nothrow_t)` as well.");
+# endif
+
+ return operator_new_aligned_impl(size, alignment);
+# else
void* p = nullptr;
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
p = ::operator new[](size, alignment);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (...) {
}
-# endif // _LIBCPP_HAS_NO_EXCEPTIONS
return p;
+# endif
}
_LIBCPP_WEAK void operator delete(void* ptr, std::align_val_t) noexcept { std::__libcpp_aligned_free(ptr); }
diff --git a/contrib/llvm-project/libcxx/src/ostream.cpp b/contrib/llvm-project/libcxx/src/ostream.cpp
index bba8e6550710..443dce9a390b 100644
--- a/contrib/llvm-project/libcxx/src/ostream.cpp
+++ b/contrib/llvm-project/libcxx/src/ostream.cpp
@@ -17,7 +17,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_AVAILABILITY_PRINT _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) {
+_LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) {
// dynamic_cast requires RTTI, this only affects users whose vendor builds
// the dylib with RTTI disabled. It does not affect users who build with RTTI
// disabled but use a dylib where the RTTI is enabled.
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
index c07de5838b14..bdb17b9996b7 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp
@@ -28,6 +28,14 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
return *this;
}
+exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept {
+ exception_ptr ptr;
+ ptr.__ptr_ = __e;
+ __cxa_increment_exception_refcount(ptr.__ptr_);
+
+ return ptr;
+}
+
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
nested_exception::~nested_exception() noexcept {}
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
index 8e0e63cd4d49..6dad248f9e1f 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp
@@ -23,6 +23,7 @@ namespace __exception_ptr {
struct exception_ptr {
void* __ptr_;
+ explicit exception_ptr(void*) noexcept;
exception_ptr(const exception_ptr&) noexcept;
exception_ptr& operator=(const exception_ptr&) noexcept;
~exception_ptr() noexcept;
@@ -45,6 +46,13 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
return *this;
}
+exception_ptr exception_ptr::__from_native_exception_pointer(void* __e) noexcept {
+ exception_ptr ptr{};
+ new (reinterpret_cast<void*>(&ptr)) __exception_ptr::exception_ptr(__e);
+
+ return ptr;
+}
+
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
_LIBCPP_NORETURN void nested_exception::rethrow_nested() const {
diff --git a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
index de0605d7774b..e12b0caf419d 100644
--- a/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
+++ b/contrib/llvm-project/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp
@@ -30,6 +30,12 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) noexcept {
::abort();
}
+exception_ptr exception_ptr::__from_native_exception_pointer(void *__e) noexcept {
+#warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+}
+
nested_exception::nested_exception() noexcept : __ptr_(current_exception()) {}
#if !defined(__GLIBCXX__)
diff --git a/contrib/llvm-project/libcxx/vendor/llvm/default_assertion_handler.in b/contrib/llvm-project/libcxx/vendor/llvm/default_assertion_handler.in
new file mode 100644
index 000000000000..8bc0553c078b
--- /dev/null
+++ b/contrib/llvm-project/libcxx/vendor/llvm/default_assertion_handler.in
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ASSERTION_HANDLER
+#define _LIBCPP___ASSERTION_HANDLER
+
+#include <__config>
+#include <__verbose_abort>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
+
+# define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
+
+#else
+
+// TODO(hardening): use `__builtin_verbose_trap(message)` once that becomes available.
+# define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __builtin_trap())
+
+#endif // _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
+
+#endif // _LIBCPP___ASSERTION_HANDLER