[libc++] Remove the legacy debug mode.
See https://discourse.llvm.org/t/rfc-removing-the-legacy-debug-mode-from-libc/71026 Reviewed By: #libc, Mordante, ldionne Differential Revision: https://reviews.llvm.org/D153672
This commit is contained in:
@@ -62,11 +62,6 @@ option(LIBCXX_ENABLE_FILESYSTEM
|
||||
available on the platform. This includes things like most parts of <filesystem> and
|
||||
others like <fstream>" ON)
|
||||
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
|
||||
option(LIBCXX_ENABLE_DEBUG_MODE
|
||||
"Whether to build libc++ with the debug mode enabled.
|
||||
By default, this is turned off. Turning it on results in a different ABI (additional
|
||||
symbols but also potentially different layouts of types), and one should not mix code
|
||||
built against a dylib that has debug mode and code built against a regular dylib." OFF)
|
||||
option(LIBCXX_ENABLE_RANDOM_DEVICE
|
||||
"Whether to include support for std::random_device in the library. Disabling
|
||||
this can be useful when building the library for platforms that don't have
|
||||
@@ -202,13 +197,6 @@ set(LIBCXX_ABI_DEFINES "" CACHE STRING "A semicolon separated list of ABI macros
|
||||
option(LIBCXX_EXTRA_SITE_DEFINES "Extra defines to add into __config_site")
|
||||
option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
|
||||
|
||||
option(LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS
|
||||
"Whether to include the old Debug mode symbols in the compiled library. This
|
||||
is provided for backwards compatibility since the compiled library used to
|
||||
always contain those symbols, regardless of whether the library was built
|
||||
with the debug mode enabled. This is OFF by default, please contact the libc++
|
||||
developers if you need to turn this on, as this will be removed in LLVM 16." OFF)
|
||||
|
||||
# ABI Library options ---------------------------------------------------------
|
||||
if (LIBCXX_TARGETING_MSVC)
|
||||
set(LIBCXX_DEFAULT_ABI_LIBRARY "vcruntime")
|
||||
@@ -791,7 +779,6 @@ config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
|
||||
config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
|
||||
config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
|
||||
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
config_define_if(LIBCXX_ENABLE_DEBUG_MODE _LIBCPP_ENABLE_DEBUG_MODE)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||
config_define(1 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT)
|
||||
else()
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
set(LIBCXX_ENABLE_DEBUG_MODE ON CACHE BOOL "")
|
||||
@@ -1,71 +0,0 @@
|
||||
==========
|
||||
Debug Mode
|
||||
==========
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
.. _using-debug-mode:
|
||||
|
||||
Using the debug mode
|
||||
====================
|
||||
|
||||
Libc++ provides a debug mode that enables special debugging checks meant to detect
|
||||
incorrect usage of the standard library. These checks are disabled by default, but
|
||||
they can be enabled by vendors when building the library by using ``LIBCXX_ENABLE_DEBUG_MODE``.
|
||||
|
||||
Since the debug mode has ABI implications, users should compile their whole program,
|
||||
including any dependent libraries, against a Standard library configured identically
|
||||
with respect to the debug mode. In other words, they should not mix code built against
|
||||
a Standard library with the debug mode enabled with code built against a Standard library
|
||||
where the debug mode is disabled.
|
||||
|
||||
Furthermore, users should not rely on a stable ABI being provided when the debug mode is
|
||||
enabled -- we reserve the right to change the ABI at any time. If you need a stable ABI
|
||||
and still want some level of hardening, you should look into enabling :ref:`assertions <assertions-mode>`
|
||||
instead.
|
||||
|
||||
The debug mode provides various checks to aid application debugging.
|
||||
|
||||
Comparator consistency checks
|
||||
-----------------------------
|
||||
Libc++ provides some checks for the consistency of comparators passed to algorithms. Specifically,
|
||||
many algorithms such as ``binary_search``, ``merge``, ``next_permutation``, and ``sort``, wrap the
|
||||
user-provided comparator to assert that `!comp(y, x)` whenever `comp(x, y)`. This can cause the
|
||||
user-provided comparator to be evaluated up to twice as many times as it would be without the
|
||||
debug mode, and causes the library to violate some of the Standard's complexity clauses.
|
||||
|
||||
Iterator bounds checking
|
||||
------------------------
|
||||
The library provides iterators that ensure they are within the bounds of their container when dereferenced.
|
||||
Arithmetic can be performed on these iterators to create out-of-bounds iterators, but they cannot be dereferenced
|
||||
when out-of-bounds. The following classes currently provide iterators that have bounds checking:
|
||||
|
||||
- ``std::string``
|
||||
- ``std::vector<T>`` (``T != bool``)
|
||||
- ``std::span``
|
||||
|
||||
.. TODO: Add support for iterator bounds checking in ``std::string_view`` and ``std::array``
|
||||
|
||||
Iterator ownership checking
|
||||
---------------------------
|
||||
The library provides iterator ownership checking, which allows catching cases where e.g.
|
||||
an iterator from container ``X`` is used as a position to insert into container ``Y``.
|
||||
The following classes support iterator ownership checking:
|
||||
|
||||
- ``std::string``
|
||||
- ``std::vector<T>`` (``T != bool``)
|
||||
- ``std::list``
|
||||
- ``std::unordered_map``
|
||||
- ``std::unordered_multimap``
|
||||
- ``std::unordered_set``
|
||||
- ``std::unordered_multiset``
|
||||
|
||||
Randomizing unspecified behavior
|
||||
--------------------------------
|
||||
The library supports the randomization of unspecified behavior. For example, randomizing
|
||||
the relative order of equal elements in ``std::sort`` or randomizing both parts of the
|
||||
partition after calling ``std::nth_element``. This effort helps migrating to potential
|
||||
future faster versions of these algorithms that might not have the exact same behavior.
|
||||
In particular, it makes it easier to deflake tests that depend on unspecified behavior.
|
||||
A seed can be used to make such failures reproducible: use ``_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED=seed``.
|
||||
@@ -74,6 +74,13 @@ Improvements and New Features
|
||||
Deprecations and Removals
|
||||
-------------------------
|
||||
|
||||
- The legacy debug mode has been removed in this release. Defining the macro
|
||||
`_LIBCPP_ENABLE_DEBUG_MODE` is now a no-op, and the `LIBCXX_ENABLE_DEBUG_MODE`
|
||||
CMake variable has been removed. The legacy debug mode will be replaced by
|
||||
finer-grained hardened modes. For additional context, refer to the `Discourse
|
||||
post
|
||||
<https://discourse.llvm.org/t/rfc-removing-the-legacy-debug-mode-from-libc/71026>`_.
|
||||
|
||||
- The ``<experimental/coroutine>`` header has been removed in this release. The ``<coroutine>`` header
|
||||
has been shipping since LLVM 14, so the Coroutines TS implementation is being removed per our policy
|
||||
for removing TSes.
|
||||
|
||||
@@ -180,7 +180,6 @@ Design Documents
|
||||
DesignDocs/ABIVersioning
|
||||
DesignDocs/AtomicDesign
|
||||
DesignDocs/CapturingConfigInfo
|
||||
DesignDocs/DebugMode
|
||||
DesignDocs/ExperimentalFeatures
|
||||
DesignDocs/ExtendedCXX03Support
|
||||
DesignDocs/FeatureTestMacros
|
||||
|
||||
@@ -326,7 +326,6 @@ set(files
|
||||
__coroutine/coroutine_traits.h
|
||||
__coroutine/noop_coroutine_handle.h
|
||||
__coroutine/trivial_awaitables.h
|
||||
__debug
|
||||
__debug_utils/randomize_range.h
|
||||
__debug_utils/strict_weak_ordering_check.h
|
||||
__exception/exception.h
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#ifndef _LIBCPP___ALGORITHM_COMP_REF_TYPE_H
|
||||
#define _LIBCPP___ALGORITHM_COMP_REF_TYPE_H
|
||||
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__utility/declval.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@@ -51,7 +51,7 @@ struct __debug_less
|
||||
decltype((void)std::declval<_Compare&>()(
|
||||
std::declval<_LHS &>(), std::declval<_RHS &>()))
|
||||
__do_compare_assert(int, _LHS & __l, _RHS & __r) {
|
||||
_LIBCPP_DEBUG_ASSERT(!__comp_(__l, __r),
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(!__comp_(__l, __r),
|
||||
"Comparator does not induce a strict weak ordering");
|
||||
(void)__l;
|
||||
(void)__r;
|
||||
@@ -65,6 +65,7 @@ struct __debug_less
|
||||
|
||||
// Pass the comparator by lvalue reference. Or in debug mode, using a
|
||||
// debugging wrapper that stores a reference.
|
||||
// TODO(varconst): update to be used in the new debug mode (or delete entirely).
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
template <class _Comp>
|
||||
using __comp_ref_type = __debug_less<_Comp>;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/sort.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__debug_utils/randomize_range.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__utility/move.h>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <__algorithm/sift_down.h>
|
||||
#include <__algorithm/sort_heap.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__debug_utils/randomize_range.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__type_traits/is_copy_assignable.h>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__random/uniform_int_distribution.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <__bit/countl.h>
|
||||
#include <__bit/countr.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__debug_utils/randomize_range.h>
|
||||
#include <__debug_utils/strict_weak_ordering_check.h>
|
||||
#include <__functional/operations.h>
|
||||
@@ -30,6 +29,7 @@
|
||||
#include <__type_traits/conditional.h>
|
||||
#include <__type_traits/disjunction.h>
|
||||
#include <__type_traits/is_arithmetic.h>
|
||||
#include <__type_traits/is_constant_evaluated.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <climits>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <__compare/ordering.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/forward.h>
|
||||
|
||||
@@ -51,7 +50,7 @@ struct __debug_three_way_comp {
|
||||
__expected = _Order::greater;
|
||||
if (__o == _Order::greater)
|
||||
__expected = _Order::less;
|
||||
_LIBCPP_DEBUG_ASSERT(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
|
||||
_LIBCPP_ASSERT(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering");
|
||||
(void)__l;
|
||||
(void)__r;
|
||||
}
|
||||
@@ -59,6 +58,7 @@ struct __debug_three_way_comp {
|
||||
|
||||
// Pass the comparator by lvalue reference. Or in debug mode, using a
|
||||
// debugging wrapper that stores a reference.
|
||||
// TODO(varconst): update to be used in the new debug mode (or delete entirely).
|
||||
# ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
template <class _Comp>
|
||||
using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>;
|
||||
|
||||
@@ -26,7 +26,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
// TODO: Change the name of __unwrap_iter_impl to something more appropriate
|
||||
// The job of __unwrap_iter is to remove iterator wrappers (like reverse_iterator or __wrap_iter),
|
||||
// to reduce the number of template instantiations and to enable pointer-based optimizations e.g. in std::copy.
|
||||
// In debug mode, we don't do this.
|
||||
//
|
||||
// Some algorithms (e.g. std::copy, but not std::sort) need to convert an
|
||||
// "unwrapped" result back into the original iterator type. Doing that is the job of __rewrap_iter.
|
||||
@@ -38,7 +37,8 @@ struct __unwrap_iter_impl {
|
||||
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __unwrap(_Iter __i) _NOEXCEPT { return __i; }
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
// TODO(hardening): make sure that the following unwrapping doesn't unexpectedly turn hardened iterators into raw
|
||||
// pointers.
|
||||
|
||||
// It's a contiguous iterator, so we can use a raw pointer instead
|
||||
template <class _Iter>
|
||||
@@ -54,8 +54,6 @@ struct __unwrap_iter_impl<_Iter, true> {
|
||||
}
|
||||
};
|
||||
|
||||
#endif // !_LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template<class _Iter,
|
||||
class _Impl = __unwrap_iter_impl<_Iter>,
|
||||
__enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
|
||||
|
||||
@@ -17,13 +17,6 @@
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// Automatically enable assertions when the debug mode is enabled.
|
||||
#if defined(_LIBCPP_ENABLE_DEBUG_MODE)
|
||||
# ifndef _LIBCPP_ENABLE_ASSERTIONS
|
||||
# define _LIBCPP_ENABLE_ASSERTIONS 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ENABLE_ASSERTIONS
|
||||
# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
|
||||
#cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
#cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT
|
||||
#cmakedefine _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
// PSTL backends
|
||||
#cmakedefine _LIBCPP_PSTL_CPU_BACKEND_SERIAL
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
// -*- 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___DEBUG
|
||||
#define _LIBCPP___DEBUG
|
||||
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
#include <__type_traits/is_constant_evaluated.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
|
||||
# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK)
|
||||
# define _LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_ABI_BOUNDED_ITERATORS)
|
||||
# define _LIBCPP_ABI_BOUNDED_ITERATORS
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m)
|
||||
#else
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct _LIBCPP_EXPORTED_FROM_ABI __c_node;
|
||||
|
||||
struct _LIBCPP_EXPORTED_FROM_ABI __i_node
|
||||
{
|
||||
void* __i_;
|
||||
__i_node* __next_;
|
||||
__c_node* __c_;
|
||||
|
||||
__i_node(const __i_node&) = delete;
|
||||
__i_node& operator=(const __i_node&) = delete;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__i_node(void* __i, __i_node* __next, __c_node* __c)
|
||||
: __i_(__i), __next_(__next), __c_(__c) {}
|
||||
~__i_node();
|
||||
};
|
||||
|
||||
struct _LIBCPP_EXPORTED_FROM_ABI __c_node
|
||||
{
|
||||
void* __c_;
|
||||
__c_node* __next_;
|
||||
__i_node** beg_;
|
||||
__i_node** end_;
|
||||
__i_node** cap_;
|
||||
|
||||
__c_node(const __c_node&) = delete;
|
||||
__c_node& operator=(const __c_node&) = delete;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __c_node(void* __c, __c_node* __next)
|
||||
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
|
||||
virtual ~__c_node();
|
||||
|
||||
virtual bool __dereferenceable(const void*) const = 0;
|
||||
virtual bool __decrementable(const void*) const = 0;
|
||||
virtual bool __addable(const void*, ptrdiff_t) const = 0;
|
||||
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
|
||||
|
||||
void __add(__i_node* __i);
|
||||
_LIBCPP_HIDDEN void __remove(__i_node* __i);
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
struct _C_node
|
||||
: public __c_node
|
||||
{
|
||||
_LIBCPP_HIDE_FROM_ABI explicit _C_node(void* __c, __c_node* __n)
|
||||
: __c_node(__c, __n) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __dereferenceable(const void*) const override;
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __decrementable(const void*) const override;
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __addable(const void*, ptrdiff_t) const override;
|
||||
_LIBCPP_HIDE_FROM_ABI_VIRTUAL bool __subscriptable(const void*, ptrdiff_t) const override;
|
||||
};
|
||||
|
||||
template <class _Cont>
|
||||
inline bool
|
||||
_C_node<_Cont>::__dereferenceable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* __cp = static_cast<_Cont*>(__c_);
|
||||
return __cp->__dereferenceable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
inline bool
|
||||
_C_node<_Cont>::__decrementable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* __cp = static_cast<_Cont*>(__c_);
|
||||
return __cp->__decrementable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
inline bool
|
||||
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* __cp = static_cast<_Cont*>(__c_);
|
||||
return __cp->__addable(__j, __n);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
inline bool
|
||||
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* __cp = static_cast<_Cont*>(__c_);
|
||||
return __cp->__subscriptable(__j, __n);
|
||||
}
|
||||
|
||||
class _LIBCPP_EXPORTED_FROM_ABI __libcpp_db
|
||||
{
|
||||
__c_node** __cbeg_;
|
||||
__c_node** __cend_;
|
||||
size_t __csz_;
|
||||
__i_node** __ibeg_;
|
||||
__i_node** __iend_;
|
||||
size_t __isz_;
|
||||
|
||||
explicit __libcpp_db();
|
||||
public:
|
||||
__libcpp_db(const __libcpp_db&) = delete;
|
||||
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
||||
|
||||
~__libcpp_db();
|
||||
|
||||
class __db_c_iterator;
|
||||
class __db_c_const_iterator;
|
||||
class __db_i_iterator;
|
||||
class __db_i_const_iterator;
|
||||
|
||||
__db_c_const_iterator __c_end() const;
|
||||
__db_i_const_iterator __i_end() const;
|
||||
|
||||
typedef __c_node*(_InsertConstruct)(void*, void*, __c_node*);
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) {
|
||||
return ::new (__mem) _C_node<_Cont>(__c, __next);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __insert_c(_Cont* __c)
|
||||
{
|
||||
__insert_c(static_cast<void*>(__c), &__create_C_node<_Cont>);
|
||||
}
|
||||
|
||||
void __insert_i(void* __i);
|
||||
void __insert_c(void* __c, _InsertConstruct* __fn);
|
||||
void __erase_c(void* __c);
|
||||
|
||||
void __insert_ic(void* __i, const void* __c);
|
||||
void __iterator_copy(void* __i, const void* __i0);
|
||||
void __erase_i(void* __i);
|
||||
|
||||
void* __find_c_from_i(void* __i) const;
|
||||
void __invalidate_all(void* __c);
|
||||
__c_node* __find_c_and_lock(void* __c) const;
|
||||
__c_node* __find_c(void* __c) const;
|
||||
void unlock() const;
|
||||
|
||||
void swap(void* __c1, void* __c2);
|
||||
|
||||
|
||||
bool __dereferenceable(const void* __i) const;
|
||||
bool __decrementable(const void* __i) const;
|
||||
bool __addable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
|
||||
bool __less_than_comparable(const void* __i, const void* __j) const;
|
||||
private:
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __insert_iterator(void* __i);
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node* __find_iterator(const void* __i) const;
|
||||
|
||||
friend _LIBCPP_EXPORTED_FROM_ABI __libcpp_db* __get_db();
|
||||
};
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI __libcpp_db* __get_db();
|
||||
_LIBCPP_EXPORTED_FROM_ABI const __libcpp_db* __get_const_db();
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_insert_c(_Tp* __c) {
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__insert_c(__c);
|
||||
#else
|
||||
(void)(__c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_insert_i(_Tp* __i) {
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__insert_i(__i);
|
||||
#else
|
||||
(void)(__i);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_erase_c(_Tp* __c) {
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__erase_c(__c);
|
||||
#else
|
||||
(void)(__c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) {
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->swap(__lhs, __rhs);
|
||||
#else
|
||||
(void)(__lhs);
|
||||
(void)(__rhs);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 inline void __debug_db_invalidate_all(_Tp* __c) {
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__invalidate_all(__c);
|
||||
#else
|
||||
(void)(__c);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___DEBUG
|
||||
@@ -253,9 +253,9 @@ class _LIBCPP_TEMPLATE_VIS __direct_storage {};
|
||||
template <class _OutIt, class _CharT>
|
||||
concept __enable_direct_output = __fmt_char_type<_CharT> &&
|
||||
(same_as<_OutIt, _CharT*>
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
// TODO(hardening): the following check might not apply to hardened iterators and might need to be wrapped in an
|
||||
// `#ifdef`.
|
||||
|| same_as<_OutIt, __wrap_iter<_CharT*>>
|
||||
#endif
|
||||
);
|
||||
|
||||
/// Write policy for directly writing to the underlying output.
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <__concepts/convertible_to.h>
|
||||
#include <__concepts/same_as.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__format/buffer.h>
|
||||
#include <__format/format_arg.h>
|
||||
#include <__format/format_arg_store.h>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <__algorithm/copy.h>
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__format/concepts.h>
|
||||
#include <__format/format_error.h>
|
||||
#include <__format/format_parse_context.h>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <__concepts/arithmetic.h>
|
||||
#include <__concepts/same_as.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__format/format_arg.h>
|
||||
#include <__format/format_error.h>
|
||||
#include <__format/format_parse_context.h>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <__assert>
|
||||
#include <__bit/countl.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__functional/hash.h>
|
||||
#include <__functional/invoke.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
@@ -308,53 +307,20 @@ public:
|
||||
typedef typename _NodeTypes::__node_value_type_pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator(const __hash_iterator& __i)
|
||||
: __node_(__i.__node_)
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__hash_iterator()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator& operator=(const __hash_iterator& __i)
|
||||
{
|
||||
if (this != _VSTD::addressof(__i))
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
__node_ = __i.__node_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container iterator");
|
||||
return __node_->__upcast()->__value_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container iterator");
|
||||
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator& operator++() {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable unordered container iterator");
|
||||
__node_ = __node_->__next_;
|
||||
return *this;
|
||||
}
|
||||
@@ -378,14 +344,11 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
|
||||
explicit __hash_iterator(__next_pointer __node) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
{
|
||||
(void)__c;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__insert_ic(this, __c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class, class, class, class> friend class __hash_table;
|
||||
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator;
|
||||
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
|
||||
@@ -414,61 +377,25 @@ public:
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
|
||||
: __node_(__x.__node_)
|
||||
{
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __hash_const_iterator& __i)
|
||||
: __node_(__i.__node_)
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__hash_const_iterator()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator& operator=(const __hash_const_iterator& __i)
|
||||
{
|
||||
if (this != _VSTD::addressof(__i))
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
__node_ = __i.__node_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container const_iterator");
|
||||
return __node_->__upcast()->__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container const_iterator");
|
||||
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator& operator++() {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable unordered container const_iterator");
|
||||
__node_ = __node_->__next_;
|
||||
return *this;
|
||||
}
|
||||
@@ -492,14 +419,11 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
|
||||
explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
{
|
||||
(void)__c;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__insert_ic(this, __c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class, class, class, class> friend class __hash_table;
|
||||
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
|
||||
@@ -525,57 +449,20 @@ public:
|
||||
typedef typename _NodeTypes::__node_value_type_pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator(const __hash_local_iterator& __i)
|
||||
: __node_(__i.__node_),
|
||||
__bucket_(__i.__bucket_),
|
||||
__bucket_count_(__i.__bucket_count_)
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__hash_local_iterator()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator& operator=(const __hash_local_iterator& __i)
|
||||
{
|
||||
if (this != _VSTD::addressof(__i))
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
__node_ = __i.__node_;
|
||||
__bucket_ = __i.__bucket_;
|
||||
__bucket_count_ = __i.__bucket_count_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container local_iterator");
|
||||
return __node_->__upcast()->__value_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container local_iterator");
|
||||
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator& operator++() {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable unordered container local_iterator");
|
||||
__node_ = __node_->__next_;
|
||||
if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
|
||||
__node_ = nullptr;
|
||||
@@ -602,18 +489,15 @@ public:
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_local_iterator(__next_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count, const void* __c) _NOEXCEPT
|
||||
size_t __bucket_count) _NOEXCEPT
|
||||
: __node_(__node),
|
||||
__bucket_(__bucket),
|
||||
__bucket_count_(__bucket_count)
|
||||
{
|
||||
(void)__c;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__insert_ic(this, __c);
|
||||
#endif
|
||||
if (__node_ != nullptr)
|
||||
__node_ = __node_->__next_;
|
||||
}
|
||||
|
||||
template <class, class, class, class> friend class __hash_table;
|
||||
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator;
|
||||
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator;
|
||||
@@ -647,7 +531,6 @@ public:
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -656,59 +539,20 @@ public:
|
||||
__bucket_(__x.__bucket_),
|
||||
__bucket_count_(__x.__bucket_count_)
|
||||
{
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(const __hash_const_local_iterator& __i)
|
||||
: __node_(__i.__node_),
|
||||
__bucket_(__i.__bucket_),
|
||||
__bucket_count_(__i.__bucket_count_)
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__hash_const_local_iterator()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator& operator=(const __hash_const_local_iterator& __i)
|
||||
{
|
||||
if (this != _VSTD::addressof(__i))
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__i));
|
||||
__node_ = __i.__node_;
|
||||
__bucket_ = __i.__bucket_;
|
||||
__bucket_count_ = __i.__bucket_count_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
|
||||
return __node_->__upcast()->__value_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
|
||||
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator& operator++() {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable unordered container const_local_iterator");
|
||||
__node_ = __node_->__next_;
|
||||
if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
|
||||
__node_ = nullptr;
|
||||
@@ -735,18 +579,15 @@ public:
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket,
|
||||
size_t __bucket_count, const void* __c) _NOEXCEPT
|
||||
size_t __bucket_count) _NOEXCEPT
|
||||
: __node_(__node_ptr),
|
||||
__bucket_(__bucket),
|
||||
__bucket_count_(__bucket_count)
|
||||
{
|
||||
(void)__c;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__insert_ic(this, __c);
|
||||
#endif
|
||||
if (__node_ != nullptr)
|
||||
__node_ = __node_->__next_;
|
||||
}
|
||||
|
||||
template <class, class, class, class> friend class __hash_table;
|
||||
template <class> friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator;
|
||||
};
|
||||
@@ -1270,7 +1111,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(),
|
||||
"unordered container::begin(n) called with n >= bucket_count()");
|
||||
return local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
|
||||
return local_iterator(__bucket_list_[__n], __n, bucket_count());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1279,7 +1120,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(),
|
||||
"unordered container::end(n) called with n >= bucket_count()");
|
||||
return local_iterator(nullptr, __n, bucket_count(), this);
|
||||
return local_iterator(nullptr, __n, bucket_count());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1288,7 +1129,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(),
|
||||
"unordered container::cbegin(n) called with n >= bucket_count()");
|
||||
return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
|
||||
return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1297,18 +1138,9 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(),
|
||||
"unordered container::cend(n) called with n >= bucket_count()");
|
||||
return const_local_iterator(nullptr, __n, bucket_count(), this);
|
||||
return const_local_iterator(nullptr, __n, bucket_count());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool __dereferenceable(const const_iterator* __i) const;
|
||||
_LIBCPP_HIDE_FROM_ABI bool __decrementable(const const_iterator* __i) const;
|
||||
_LIBCPP_HIDE_FROM_ABI bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
_LIBCPP_HIDE_FROM_ABI bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
private:
|
||||
template <bool _UniqueKeys>
|
||||
_LIBCPP_HIDE_FROM_ABI void __rehash(size_type __n);
|
||||
@@ -1490,7 +1322,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
#endif
|
||||
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
std::__debug_db_erase_c(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1532,21 +1363,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
|
||||
while (__np != nullptr)
|
||||
{
|
||||
__next_pointer __next = __np->__next_;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
--__p;
|
||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||
if (__i->__node_ == __np)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#endif
|
||||
__node_pointer __real_np = __np->__upcast();
|
||||
__node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__value_));
|
||||
__node_traits::deallocate(__na, __real_np, 1);
|
||||
@@ -1593,7 +1409,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
}
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1743,7 +1558,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
|
||||
{
|
||||
return iterator(__p1_.first().__next_, this);
|
||||
return iterator(__p1_.first().__next_);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1751,7 +1566,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
|
||||
{
|
||||
return iterator(nullptr, this);
|
||||
return iterator(nullptr);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1759,7 +1574,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
|
||||
{
|
||||
return const_iterator(__p1_.first().__next_, this);
|
||||
return const_iterator(__p1_.first().__next_);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1767,7 +1582,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
|
||||
{
|
||||
return const_iterator(nullptr, this);
|
||||
return const_iterator(nullptr);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1872,7 +1687,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
__existing_node = __nd->__ptr();
|
||||
__inserted = true;
|
||||
}
|
||||
return pair<iterator, bool>(iterator(__existing_node, this), __inserted);
|
||||
return pair<iterator, bool>(iterator(__existing_node), __inserted);
|
||||
}
|
||||
|
||||
// Prepare the container for an insertion of the value __cp_val with the hash
|
||||
@@ -1966,7 +1781,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
__next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_);
|
||||
__node_insert_multi_perform(__cp, __pn);
|
||||
|
||||
return iterator(__cp->__ptr(), this);
|
||||
return iterator(__cp->__ptr());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1974,9 +1789,6 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
const_iterator __p, __node_pointer __cp)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
if (__p != end() && key_eq()(*__p, __cp->__value_))
|
||||
{
|
||||
__next_pointer __np = __p.__node_;
|
||||
@@ -1995,7 +1807,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
__cp->__next_ = __np;
|
||||
__pp->__next_ = static_cast<__next_pointer>(__cp);
|
||||
++size();
|
||||
return iterator(static_cast<__next_pointer>(__cp), this);
|
||||
return iterator(static_cast<__next_pointer>(__cp));
|
||||
}
|
||||
return __node_insert_multi(__cp);
|
||||
}
|
||||
@@ -2061,7 +1873,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
|
||||
__inserted = true;
|
||||
}
|
||||
__done:
|
||||
return pair<iterator, bool>(iterator(__nd, this), __inserted);
|
||||
return pair<iterator, bool>(iterator(__nd), __inserted);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -2093,9 +1905,6 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __node_insert_multi(__p, __h.get());
|
||||
__h.release();
|
||||
@@ -2265,7 +2074,6 @@ template <bool _UniqueKeys>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__do_rehash(size_type __nbc)
|
||||
{
|
||||
std::__debug_db_invalidate_all(this);
|
||||
__pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
|
||||
__bucket_list_.reset(__nbc > 0 ?
|
||||
__pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
|
||||
@@ -2337,7 +2145,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
|
||||
{
|
||||
if ((__nd->__hash() == __hash)
|
||||
&& key_eq()(__nd->__upcast()->__value_, __k))
|
||||
return iterator(__nd, this);
|
||||
return iterator(__nd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2364,7 +2172,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
|
||||
{
|
||||
if ((__nd->__hash() == __hash)
|
||||
&& key_eq()(__nd->__upcast()->__value_, __k))
|
||||
return const_iterator(__nd, this);
|
||||
return const_iterator(__nd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2412,12 +2220,9 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
|
||||
{
|
||||
__next_pointer __np = __p.__node_;
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered container erase(iterator) called with an iterator not"
|
||||
" referring to this container");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__p != end(),
|
||||
"unordered container erase(iterator) called with a non-dereferenceable iterator");
|
||||
iterator __r(__np, this);
|
||||
iterator __r(__np);
|
||||
++__r;
|
||||
remove(__p);
|
||||
return __r;
|
||||
@@ -2428,19 +2233,13 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
|
||||
const_iterator __last)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__first)) == this,
|
||||
"unordered container::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this container");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__last)) == this,
|
||||
"unordered container::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this container");
|
||||
for (const_iterator __p = __first; __first != __last; __p = __first)
|
||||
{
|
||||
++__first;
|
||||
erase(__p);
|
||||
}
|
||||
__next_pointer __np = __last.__node_;
|
||||
return iterator (__np, this);
|
||||
return iterator (__np);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -2507,21 +2306,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
__pn->__next_ = __cn->__next_;
|
||||
__cn->__next_ = nullptr;
|
||||
--size();
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
|
||||
{
|
||||
--__dp;
|
||||
iterator* __i = static_cast<iterator*>((*__dp)->__i_);
|
||||
if (__i->__node_ == __cn)
|
||||
{
|
||||
(*__dp)->__c_ = nullptr;
|
||||
if (--__c->end_ != __dp)
|
||||
_VSTD::memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#endif
|
||||
return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true));
|
||||
}
|
||||
|
||||
@@ -2658,7 +2442,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
if (__u.size() > 0)
|
||||
__u.__bucket_list_[std::__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
|
||||
__u.__p1_.first().__ptr();
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -2690,38 +2473,6 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
bool
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__dereferenceable(const const_iterator* __i) const
|
||||
{
|
||||
return __i->__node_ != nullptr;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
bool
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__decrementable(const const_iterator*) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
bool
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
bool
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#define _LIBCPP___ITERATOR_WRAP_ITER_H
|
||||
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__memory/addressof.h>
|
||||
#include <__memory/pointer_traits.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_convertible.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
@@ -44,60 +44,23 @@ public:
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter() _NOEXCEPT
|
||||
: __i_()
|
||||
{
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
template <class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__wrap_iter(const __wrap_iter<_Up>& __u,
|
||||
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT
|
||||
: __i_(__u.base())
|
||||
{
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__u));
|
||||
#endif
|
||||
}
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__wrap_iter(const __wrap_iter& __x)
|
||||
: __i_(__x.base())
|
||||
{
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__wrap_iter& operator=(const __wrap_iter& __x)
|
||||
{
|
||||
if (this != _VSTD::addressof(__x))
|
||||
{
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
|
||||
__i_ = __x.__i_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
~__wrap_iter()
|
||||
{
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
#endif
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable iterator");
|
||||
return *__i_;
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable iterator");
|
||||
return _VSTD::__to_address(__i_);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator++() _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable iterator");
|
||||
++__i_;
|
||||
return *this;
|
||||
}
|
||||
@@ -106,8 +69,6 @@ public:
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator--() _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this),
|
||||
"Attempted to decrement a non-decrementable iterator");
|
||||
--__i_;
|
||||
return *this;
|
||||
}
|
||||
@@ -117,8 +78,6 @@ public:
|
||||
{__wrap_iter __w(*this); __w += __n; return __w;}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__addable(this, __n),
|
||||
"Attempted to add/subtract an iterator outside its valid range");
|
||||
__i_ += __n;
|
||||
return *this;
|
||||
}
|
||||
@@ -128,8 +87,6 @@ public:
|
||||
{*this += -__n; return *this;}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__subscriptable(this, __n),
|
||||
"Attempted to subscript an iterator outside its valid range");
|
||||
return __i_[__n];
|
||||
}
|
||||
|
||||
@@ -137,13 +94,8 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i_(__x)
|
||||
explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x)
|
||||
{
|
||||
(void)__p;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__get_db()->__insert_ic(this, __p);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Up> friend class __wrap_iter;
|
||||
@@ -170,8 +122,6 @@ template <class _Iter1>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__less_than_comparable(_VSTD::addressof(__x), _VSTD::addressof(__y)),
|
||||
"Attempted to compare incomparable iterators");
|
||||
return __x.base() < __y.base();
|
||||
}
|
||||
|
||||
@@ -179,8 +129,6 @@ template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
|
||||
"Attempted to compare incomparable iterators");
|
||||
return __x.base() < __y.base();
|
||||
}
|
||||
|
||||
@@ -250,8 +198,6 @@ typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
#endif // C++03
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__less_than_comparable(_VSTD::addressof(__x), _VSTD::addressof(__y)),
|
||||
"Attempted to subtract incompatible iterators");
|
||||
return __x.base() - __y.base();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#define _LIBCPP___RANGES_FILTER_VIEW_H
|
||||
|
||||
#include <__algorithm/ranges_find_if.h>
|
||||
#include <__assert>
|
||||
#include <__concepts/constructible.h>
|
||||
#include <__concepts/copyable.h>
|
||||
#include <__concepts/derived_from.h>
|
||||
#include <__concepts/equality_comparable.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__functional/bind_back.h>
|
||||
#include <__functional/invoke.h>
|
||||
#include <__functional/reference_wrapper.h>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <__algorithm/min.h>
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__functional/invoke.h>
|
||||
#include <__iterator/distance.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
@@ -377,7 +376,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__root != nullptr, "Root node should not be null");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__z != nullptr, "The node to remove should not be null");
|
||||
_LIBCPP_DEBUG_ASSERT(std::__tree_invariant(__root), "The tree invariants should hold");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(std::__tree_invariant(__root), "The tree invariants should hold");
|
||||
// __z will be removed from the tree. Client still needs to destruct/deallocate it
|
||||
// __y is either __z, or if __z has two children, __tree_next(__z).
|
||||
// __y will have at most one child.
|
||||
|
||||
@@ -1738,7 +1738,6 @@ template <class BidirectionalIterator, class Compare>
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <cstddef>
|
||||
#include <version>
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ namespace std {
|
||||
#include <__charconv/to_chars_result.h>
|
||||
#include <__charconv/traits.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__system_error/errc.h>
|
||||
#include <cmath> // for log2f
|
||||
#include <cstdint>
|
||||
|
||||
@@ -516,7 +516,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__compare/compare_three_way.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__functional/binary_function.h>
|
||||
#include <__functional/binary_negate.h>
|
||||
#include <__functional/bind.h>
|
||||
|
||||
@@ -676,7 +676,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__iterator/access.h>
|
||||
#include <__iterator/advance.h>
|
||||
#include <__iterator/back_insert_iterator.h>
|
||||
|
||||
@@ -191,7 +191,6 @@ template <class T, class Allocator, class Predicate>
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__format/enable_insertable.h>
|
||||
#include <__iterator/distance.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
@@ -331,13 +330,9 @@ class _LIBCPP_TEMPLATE_VIS __list_iterator
|
||||
__link_pointer __ptr_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
|
||||
explicit __list_iterator(__link_pointer __p) _NOEXCEPT
|
||||
: __ptr_(__p)
|
||||
{
|
||||
(void)__c;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__insert_ic(this, __c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class, class> friend class list;
|
||||
@@ -353,57 +348,22 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator() _NOEXCEPT : __ptr_(nullptr)
|
||||
{
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator(const __list_iterator& __p)
|
||||
: __ptr_(__p.__ptr_)
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__list_iterator()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator& operator=(const __list_iterator& __p)
|
||||
{
|
||||
if (this != _VSTD::addressof(__p))
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
|
||||
__ptr_ = __p.__ptr_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::iterator");
|
||||
return __ptr_->__as_node()->__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::iterator");
|
||||
return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator& operator++()
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable list::iterator");
|
||||
__ptr_ = __ptr_->__next_;
|
||||
return *this;
|
||||
}
|
||||
@@ -413,8 +373,6 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator& operator--()
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this),
|
||||
"Attempted to decrement a non-decrementable list::iterator");
|
||||
__ptr_ = __ptr_->__prev_;
|
||||
return *this;
|
||||
}
|
||||
@@ -440,13 +398,9 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator
|
||||
__link_pointer __ptr_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
|
||||
explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT
|
||||
: __ptr_(__p)
|
||||
{
|
||||
(void)__c;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__insert_ic(this, __c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class, class> friend class list;
|
||||
@@ -461,64 +415,27 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
|
||||
{
|
||||
_VSTD::__debug_db_insert_i(this);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
|
||||
: __ptr_(__p.__ptr_)
|
||||
{
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator(const __list_const_iterator& __p)
|
||||
: __ptr_(__p.__ptr_)
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__list_const_iterator()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator& operator=(const __list_const_iterator& __p)
|
||||
{
|
||||
if (this != _VSTD::addressof(__p))
|
||||
{
|
||||
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
|
||||
__ptr_ = __p.__ptr_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::const_iterator");
|
||||
return __ptr_->__as_node()->__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::const_iterator");
|
||||
return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator& operator++()
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment a non-incrementable list::const_iterator");
|
||||
__ptr_ = __ptr_->__next_;
|
||||
return *this;
|
||||
}
|
||||
@@ -528,8 +445,6 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator& operator--()
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__decrementable(this),
|
||||
"Attempted to decrement a non-decrementable list::const_iterator");
|
||||
__ptr_ = __ptr_->__prev_;
|
||||
return *this;
|
||||
}
|
||||
@@ -625,22 +540,22 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT
|
||||
{
|
||||
return iterator(__end_.__next_, this);
|
||||
return iterator(__end_.__next_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT
|
||||
{
|
||||
return const_iterator(__end_.__next_, this);
|
||||
return const_iterator(__end_.__next_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT
|
||||
{
|
||||
return iterator(__end_as_link(), this);
|
||||
return iterator(__end_as_link());
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT
|
||||
{
|
||||
return const_iterator(__end_as_link(), this);
|
||||
return const_iterator(__end_as_link());
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void swap(__list_imp& __c)
|
||||
@@ -729,7 +644,6 @@ inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
|
||||
template <class _Tp, class _Alloc>
|
||||
__list_imp<_Tp, _Alloc>::~__list_imp() {
|
||||
clear();
|
||||
std::__debug_db_erase_c(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -750,7 +664,6 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
}
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,42 +693,6 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
__c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
|
||||
else
|
||||
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
|
||||
_VSTD::swap(__cn1->beg_, __cn2->beg_);
|
||||
_VSTD::swap(__cn1->end_, __cn2->end_);
|
||||
_VSTD::swap(__cn1->cap_, __cn2->cap_);
|
||||
for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;)
|
||||
{
|
||||
--__p;
|
||||
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
||||
if (__i->__ptr_ == __c.__end_as_link())
|
||||
{
|
||||
__cn2->__add(*__p);
|
||||
if (--__cn1->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
else
|
||||
(*__p)->__c_ = __cn1;
|
||||
}
|
||||
for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
|
||||
{
|
||||
--__p;
|
||||
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
||||
if (__i->__ptr_ == __end_as_link())
|
||||
{
|
||||
__cn1->__add(*__p);
|
||||
if (--__cn2->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
else
|
||||
(*__p)->__c_ = __cn2;
|
||||
}
|
||||
__db->unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
|
||||
@@ -860,12 +737,10 @@ public:
|
||||
list()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit list(const allocator_type& __a) : base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
@@ -875,7 +750,6 @@ public:
|
||||
template <class = __enable_if_t<__is_allocator<_Alloc>::value> >
|
||||
_LIBCPP_HIDE_FROM_ABI list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (; __n > 0; --__n)
|
||||
push_back(__x);
|
||||
}
|
||||
@@ -1111,15 +985,6 @@ public:
|
||||
return __hold_pointer(__p, __node_destructor(__na, 1));
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l);
|
||||
@@ -1204,7 +1069,6 @@ list<_Tp, _Alloc>::__iterator(size_type __n)
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (; __n > 0; --__n)
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
emplace_back();
|
||||
@@ -1217,7 +1081,6 @@ list<_Tp, _Alloc>::list(size_type __n)
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (; __n > 0; --__n)
|
||||
emplace_back();
|
||||
}
|
||||
@@ -1226,7 +1089,6 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (; __n > 0; --__n)
|
||||
push_back(__x);
|
||||
}
|
||||
@@ -1236,7 +1098,6 @@ template <class _InpIter>
|
||||
list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
|
||||
__enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (; __f != __l; ++__f)
|
||||
__emplace_back(*__f);
|
||||
}
|
||||
@@ -1247,7 +1108,6 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
|
||||
__enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
|
||||
: base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (; __f != __l; ++__f)
|
||||
__emplace_back(*__f);
|
||||
}
|
||||
@@ -1256,7 +1116,6 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(const list& __c)
|
||||
: base(__node_alloc_traits::select_on_container_copy_construction(
|
||||
__c.__node_alloc())) {
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
|
||||
push_back(*__i);
|
||||
}
|
||||
@@ -1265,7 +1124,6 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t<allocator_type>& __a)
|
||||
: base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
|
||||
push_back(*__i);
|
||||
}
|
||||
@@ -1276,7 +1134,6 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
: base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
|
||||
__e = __il.end(); __i != __e; ++__i)
|
||||
push_back(*__i);
|
||||
@@ -1285,7 +1142,6 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type&
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
|
||||
__e = __il.end(); __i != __e; ++__i)
|
||||
push_back(*__i);
|
||||
@@ -1295,7 +1151,6 @@ template <class _Tp, class _Alloc>
|
||||
inline list<_Tp, _Alloc>::list(list&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
|
||||
: base(_VSTD::move(__c.__node_alloc())) {
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
splice(end(), __c);
|
||||
}
|
||||
|
||||
@@ -1304,7 +1159,6 @@ inline
|
||||
list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_type>& __a)
|
||||
: base(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
if (__a == __c.get_allocator())
|
||||
splice(end(), __c);
|
||||
else
|
||||
@@ -1379,7 +1233,6 @@ list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
|
||||
insert(__e, __f, __l);
|
||||
else
|
||||
erase(__i, __e);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1394,7 +1247,6 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
|
||||
insert(__e, __n, __x);
|
||||
else
|
||||
erase(__i, __e);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1409,23 +1261,19 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::insert(iterator, x) called with an iterator not referring to this list");
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link());
|
||||
++base::__sz();
|
||||
return iterator(__hold.release()->__as_link(), this);
|
||||
return iterator(__hold.release()->__as_link());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::insert(iterator, n, x) called with an iterator not referring to this list");
|
||||
iterator __r(__p.__ptr_, this);
|
||||
iterator __r(__p.__ptr_);
|
||||
if (__n > 0)
|
||||
{
|
||||
size_type __ds = 0;
|
||||
@@ -1433,7 +1281,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
__r = iterator(__hold->__as_link(), this);
|
||||
__r = iterator(__hold->__as_link());
|
||||
__hold.release();
|
||||
iterator __e = __r;
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
@@ -1459,7 +1307,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
__e = iterator(__prev, this);
|
||||
__e = iterator(__prev);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@@ -1476,9 +1324,7 @@ typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
__enable_if_t<__has_input_iterator_category<_InpIter>::value>*)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::insert(iterator, range) called with an iterator not referring to this list");
|
||||
iterator __r(__p.__ptr_, this);
|
||||
iterator __r(__p.__ptr_);
|
||||
if (__f != __l)
|
||||
{
|
||||
size_type __ds = 0;
|
||||
@@ -1486,7 +1332,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||
++__ds;
|
||||
__r = iterator(__hold.get()->__as_link(), this);
|
||||
__r = iterator(__hold.get()->__as_link());
|
||||
__hold.release();
|
||||
iterator __e = __r;
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
@@ -1512,7 +1358,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
__e = iterator(__prev, this);
|
||||
__e = iterator(__prev);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@@ -1622,8 +1468,6 @@ template <class... _Args>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::emplace(iterator, args...) called with an iterator not referring to this list");
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
@@ -1631,15 +1475,13 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
__link_nodes(__p.__ptr_, __nl, __nl);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
return iterator(__nl, this);
|
||||
return iterator(__nl);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::insert(iterator, x) called with an iterator not referring to this list");
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
@@ -1647,7 +1489,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
__link_nodes(__p.__ptr_, __nl, __nl);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
return iterator(__nl, this);
|
||||
return iterator(__nl);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
@@ -1661,21 +1503,6 @@ list<_Tp, _Alloc>::pop_front()
|
||||
__link_pointer __n = base::__end_.__next_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
--__p;
|
||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||
if (__i->__ptr_ == __n)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#endif
|
||||
__node_pointer __np = __n->__as_node();
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
@@ -1690,21 +1517,6 @@ list<_Tp, _Alloc>::pop_back()
|
||||
__link_pointer __n = base::__end_.__prev_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
--__p;
|
||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||
if (__i->__ptr_ == __n)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#endif
|
||||
__node_pointer __np = __n->__as_node();
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
@@ -1714,8 +1526,6 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::erase(iterator) called with an iterator not referring to this list");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__p != end(),
|
||||
"list::erase(iterator) called with a non-dereferenceable iterator");
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
@@ -1723,35 +1533,16 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
__link_pointer __r = __n->__next_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
|
||||
{
|
||||
--__ip;
|
||||
iterator* __i = static_cast<iterator*>((*__ip)->__i_);
|
||||
if (__i->__ptr_ == __n)
|
||||
{
|
||||
(*__ip)->__c_ = nullptr;
|
||||
if (--__c->end_ != __ip)
|
||||
_VSTD::memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#endif
|
||||
__node_pointer __np = __n->__as_node();
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
return iterator(__r, this);
|
||||
return iterator(__r);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__f)) == this,
|
||||
"list::erase(iterator, iterator) called with an iterator not referring to this list");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == this,
|
||||
"list::erase(iterator, iterator) called with an iterator not referring to this list");
|
||||
if (__f != __l)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
@@ -1761,27 +1552,12 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
__link_pointer __n = __f.__ptr_;
|
||||
++__f;
|
||||
--base::__sz();
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
--__p;
|
||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||
if (__i->__ptr_ == __n)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#endif
|
||||
__node_pointer __np = __n->__as_node();
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
}
|
||||
}
|
||||
return iterator(__l.__ptr_, this);
|
||||
return iterator(__l.__ptr_);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1798,7 +1574,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
||||
++__ds;
|
||||
iterator __r = iterator(__hold.release()->__as_link(), this);
|
||||
iterator __r = iterator(__hold.release()->__as_link());
|
||||
iterator __e = __r;
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
try
|
||||
@@ -1823,7 +1599,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
__e = iterator(__prev, this);
|
||||
__e = iterator(__prev);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@@ -1848,7 +1624,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
__link_pointer __nl = __hold.release()->__as_link();
|
||||
iterator __r = iterator(__nl, this);
|
||||
iterator __r = iterator(__nl);
|
||||
iterator __e = __r;
|
||||
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
try
|
||||
@@ -1873,7 +1649,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
__e = iterator(__prev, this);
|
||||
__e = iterator(__prev);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@@ -1889,8 +1665,6 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
||||
{
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(this != _VSTD::addressof(__c),
|
||||
"list::splice(iterator, list) called with this == &list");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::splice(iterator, list) called with an iterator not referring to this list");
|
||||
if (!__c.empty())
|
||||
{
|
||||
__link_pointer __f = __c.__end_.__next_;
|
||||
@@ -1899,26 +1673,6 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
||||
__link_nodes(__p.__ptr_, __f, __l);
|
||||
base::__sz() += __c.__sz();
|
||||
__c.__sz() = 0;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (_VSTD::addressof(__c) != this) {
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
|
||||
for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
|
||||
{
|
||||
--__ip;
|
||||
iterator* __i = static_cast<iterator*>((*__ip)->__i_);
|
||||
if (__i->__ptr_ != __c.__end_as_link())
|
||||
{
|
||||
__cn1->__add(*__ip);
|
||||
(*__ip)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __ip)
|
||||
_VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1926,13 +1680,6 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::splice(iterator, list, iterator) called with the first iterator not referring to this list");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__i)) == _VSTD::addressof(__c),
|
||||
"list::splice(iterator, list, iterator) called with the second iterator not referring to the list argument");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(_VSTD::addressof(__i)),
|
||||
"list::splice(iterator, list, iterator) called with the second iterator not dereferenceable");
|
||||
|
||||
if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
|
||||
{
|
||||
__link_pointer __f = __i.__ptr_;
|
||||
@@ -1940,26 +1687,6 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
__link_nodes(__p.__ptr_, __f, __f);
|
||||
--__c.__sz();
|
||||
++base::__sz();
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (_VSTD::addressof(__c) != this) {
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
|
||||
for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
|
||||
{
|
||||
--__ip;
|
||||
iterator* __j = static_cast<iterator*>((*__ip)->__i_);
|
||||
if (__j->__ptr_ == __f)
|
||||
{
|
||||
__cn1->__add(*__ip);
|
||||
(*__ip)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __ip)
|
||||
_VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1978,16 +1705,6 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"list::splice(iterator, list, iterator, iterator) called with first iterator not referring to this list");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__f)) == _VSTD::addressof(__c),
|
||||
"list::splice(iterator, list, iterator, iterator) called with second iterator not referring to the list argument");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__l)) == _VSTD::addressof(__c),
|
||||
"list::splice(iterator, list, iterator, iterator) called with third iterator not referring to the list argument");
|
||||
_LIBCPP_DEBUG_ASSERT(this != std::addressof(__c) || !std::__iterator_in_range(__f, __l, __p),
|
||||
"list::splice(iterator, list, iterator, iterator)"
|
||||
" called with the first iterator within the range of the second and third iterators");
|
||||
|
||||
if (__f != __l)
|
||||
{
|
||||
__link_pointer __first = __f.__ptr_;
|
||||
@@ -2001,30 +1718,6 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
||||
}
|
||||
base::__unlink_nodes(__first, __last);
|
||||
__link_nodes(__p.__ptr_, __first, __last);
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (_VSTD::addressof(__c) != this) {
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
|
||||
for (__i_node** __ip = __cn2->end_; __ip != __cn2->beg_;)
|
||||
{
|
||||
--__ip;
|
||||
iterator* __j = static_cast<iterator*>((*__ip)->__i_);
|
||||
for (__link_pointer __k = __f.__ptr_;
|
||||
__k != __l.__ptr_; __k = __k->__next_)
|
||||
{
|
||||
if (__j->__ptr_ == __k)
|
||||
{
|
||||
__cn1->__add(*__ip);
|
||||
(*__ip)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __ip)
|
||||
_VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2138,24 +1831,6 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
++__f1;
|
||||
}
|
||||
splice(__e1, __c);
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(_VSTD::addressof(__c));
|
||||
for (__i_node** __p = __cn2->end_; __p != __cn2->beg_;)
|
||||
{
|
||||
--__p;
|
||||
iterator* __i = static_cast<iterator*>((*__p)->__i_);
|
||||
if (__i->__ptr_ != __c.__end_as_link())
|
||||
{
|
||||
__cn1->__add(*__p);
|
||||
(*__p)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __p)
|
||||
_VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2262,38 +1937,6 @@ list<_Tp, _Alloc>::__invariants() const
|
||||
return size() == _VSTD::distance(begin(), end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
bool
|
||||
list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
|
||||
{
|
||||
return __i->__ptr_ != this->__end_as_link();
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
bool
|
||||
list<_Tp, _Alloc>::__decrementable(const const_iterator* __i) const
|
||||
{
|
||||
return !empty() && __i->__ptr_ != base::__end_.__next_;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
bool
|
||||
list<_Tp, _Alloc>::__addable(const const_iterator*, ptrdiff_t) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
bool
|
||||
list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
|
||||
@@ -195,7 +195,6 @@ template <class charT> class messages_byname;
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__iterator/access.h>
|
||||
#include <__iterator/back_insert_iterator.h>
|
||||
#include <__iterator/istreambuf_iterator.h>
|
||||
@@ -1465,12 +1464,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
return do_put(__s, __iob, __fl, (unsigned long)__v);
|
||||
const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc());
|
||||
typedef typename numpunct<char_type>::string_type string_type;
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
string_type __tmp(__v ? __np.truename() : __np.falsename());
|
||||
string_type __nm = _VSTD::move(__tmp);
|
||||
#else
|
||||
string_type __nm = __v ? __np.truename() : __np.falsename();
|
||||
#endif
|
||||
for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s)
|
||||
*__s = *__i;
|
||||
return __s;
|
||||
|
||||
@@ -1804,7 +1804,6 @@ module std [system] {
|
||||
module __assert { header "__assert" export * }
|
||||
module __availability { private header "__availability" export * }
|
||||
module __bit_reference { private header "__bit_reference" export * }
|
||||
module __debug { header "__debug" export * }
|
||||
module __hash_table { header "__hash_table" export * }
|
||||
module __locale {
|
||||
@requires_LIBCXX_ENABLE_LOCALIZATION@
|
||||
|
||||
@@ -129,7 +129,6 @@ template<class R>
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__fwd/span.h>
|
||||
#include <__iterator/bounded_iter.h>
|
||||
#include <__iterator/concepts.h>
|
||||
@@ -365,14 +364,14 @@ public:
|
||||
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
|
||||
return std::__make_bounded_iter(data(), data(), data() + size());
|
||||
#else
|
||||
return iterator(this, data());
|
||||
return iterator(data());
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept {
|
||||
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
|
||||
return std::__make_bounded_iter(data() + size(), data(), data() + size());
|
||||
#else
|
||||
return iterator(this, data() + size());
|
||||
return iterator(data() + size());
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
|
||||
@@ -533,14 +532,14 @@ public:
|
||||
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
|
||||
return std::__make_bounded_iter(data(), data(), data() + size());
|
||||
#else
|
||||
return iterator(this, data());
|
||||
return iterator(data());
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept {
|
||||
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
|
||||
return std::__make_bounded_iter(data() + size(), data(), data() + size());
|
||||
#else
|
||||
return iterator(this, data() + size());
|
||||
return iterator(data() + size());
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }
|
||||
|
||||
@@ -540,7 +540,6 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len );
|
||||
#include <__algorithm/remove_if.h>
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__format/enable_insertable.h>
|
||||
#include <__functional/hash.h>
|
||||
#include <__functional/unary_function.h>
|
||||
@@ -828,15 +827,14 @@ private:
|
||||
__set_long_pointer(__allocation);
|
||||
__set_long_size(__size);
|
||||
}
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator __make_iterator(pointer __p) {
|
||||
return iterator(this, __p);
|
||||
return iterator(__p);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator __make_const_iterator(const_pointer __p) const {
|
||||
return const_iterator(this, __p);
|
||||
return const_iterator(__p);
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -845,7 +843,6 @@ public:
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
std::__debug_db_insert_c(this);
|
||||
__default_init();
|
||||
}
|
||||
|
||||
@@ -856,7 +853,6 @@ public:
|
||||
_NOEXCEPT
|
||||
#endif
|
||||
: __r_(__default_init_tag(), __a) {
|
||||
std::__debug_db_insert_c(this);
|
||||
__default_init();
|
||||
}
|
||||
|
||||
@@ -866,7 +862,6 @@ public:
|
||||
__r_.first() = __str.__r_.first();
|
||||
else
|
||||
__init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a)
|
||||
@@ -875,7 +870,6 @@ public:
|
||||
__r_.first() = __str.__r_.first();
|
||||
else
|
||||
__init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@@ -887,9 +881,6 @@ public:
|
||||
# endif
|
||||
: __r_(std::move(__str.__r_)) {
|
||||
__str.__default_init();
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__is_long())
|
||||
std::__debug_db_swap(this, &__str);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str, const allocator_type& __a)
|
||||
@@ -902,9 +893,6 @@ public:
|
||||
__r_.first() = __str.__r_.first();
|
||||
__str.__default_init();
|
||||
}
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__is_long())
|
||||
std::__debug_db_swap(this, &__str);
|
||||
}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
@@ -913,7 +901,6 @@ public:
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "basic_string(const char*) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0>
|
||||
@@ -921,7 +908,6 @@ public:
|
||||
: __r_(__default_init_tag(), __a) {
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER >= 23
|
||||
@@ -932,7 +918,6 @@ public:
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
|
||||
__init(__s, __n);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
@@ -941,13 +926,11 @@ public:
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr,
|
||||
"basic_string(const char*, n, allocator) detected nullptr");
|
||||
__init(__s, __n);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c)
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
__init(__n, __c);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER >= 23
|
||||
@@ -973,10 +956,6 @@ public:
|
||||
// Perform a copy because the allocators are not compatible.
|
||||
__init(__str.data() + __pos, __len);
|
||||
}
|
||||
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__is_long())
|
||||
std::__debug_db_swap(this, &__str);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -984,7 +963,6 @@ public:
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a)
|
||||
: __r_(__default_init_tag(), __a) {
|
||||
__init(__n, __c);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
@@ -994,7 +972,6 @@ public:
|
||||
if (__pos > __str_sz)
|
||||
__throw_out_of_range();
|
||||
__init(__str.data() + __pos, std::min(__n, __str_sz - __pos));
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
@@ -1004,7 +981,6 @@ public:
|
||||
if (__pos > __str_sz)
|
||||
__throw_out_of_range();
|
||||
__init(__str.data() + __pos, __str_sz - __pos);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Tp,
|
||||
@@ -1017,7 +993,6 @@ public:
|
||||
__self_view __sv0 = __t;
|
||||
__self_view __sv = __sv0.substr(__pos, __n);
|
||||
__init(__sv.data(), __sv.size());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Tp,
|
||||
@@ -1028,7 +1003,6 @@ public:
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
__self_view __sv = __t;
|
||||
__init(__sv.data(), __sv.size());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Tp,
|
||||
@@ -1040,14 +1014,12 @@ public:
|
||||
: __r_(__default_init_tag(), __a) {
|
||||
__self_view __sv = __t;
|
||||
__init(__sv.data(), __sv.size());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last)
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
__init(__first, __last);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0>
|
||||
@@ -1055,25 +1027,21 @@ public:
|
||||
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a)
|
||||
: __r_(__default_init_tag(), __a) {
|
||||
__init(__first, __last);
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il)
|
||||
: __r_(__default_init_tag(), __default_init_tag()) {
|
||||
__init(__il.begin(), __il.end());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(initializer_list<_CharT> __il, const _Allocator& __a)
|
||||
: __r_(__default_init_tag(), __a) {
|
||||
__init(__il.begin(), __il.end());
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() {
|
||||
std::__debug_db_erase_c(this);
|
||||
if (__is_long())
|
||||
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
|
||||
}
|
||||
@@ -1367,8 +1335,6 @@ public:
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
|
||||
insert(const_iterator __pos, size_type __n, value_type __c) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, n, value) called with an iterator not referring to this string");
|
||||
difference_type __p = __pos - begin();
|
||||
insert(static_cast<size_type>(__p), __n, __c);
|
||||
return begin() + __p;
|
||||
@@ -1653,15 +1619,6 @@ public:
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __clear_and_shrink() _NOEXCEPT;
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
private:
|
||||
template<class _Alloc>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
@@ -1949,13 +1906,10 @@ private:
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
basic_string& __null_terminate_at(value_type* __p, size_type __newsz) {
|
||||
__set_size(__newsz);
|
||||
__invalidate_iterators_past(__newsz);
|
||||
traits_type::assign(__p[__newsz], value_type());
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __invalidate_iterators_past(size_type);
|
||||
|
||||
template <
|
||||
class _Tp,
|
||||
__enable_if_t<__is_less_than_comparable<const __remove_cvref_t<_Tp>*, const value_type*>::value, int> = 0>
|
||||
@@ -2037,36 +1991,6 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
|
||||
-> basic_string<_CharT, _Traits, _Allocator>;
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
|
||||
{
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
if (!__libcpp_is_constant_evaluated()) {
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
if (__c)
|
||||
{
|
||||
const_pointer __new_last = __get_pointer() + __pos;
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
--__p;
|
||||
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
||||
if (__i->base() > __new_last)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
std::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)__pos;
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s,
|
||||
@@ -2261,7 +2185,6 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
||||
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
|
||||
pointer __p = __allocation.ptr;
|
||||
__begin_lifetime(__p, __allocation.count);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
if (__n_copy != 0)
|
||||
traits_type::copy(std::__to_address(__p),
|
||||
std::__to_address(__old_p), __n_copy);
|
||||
@@ -2296,7 +2219,6 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
||||
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
|
||||
pointer __p = __allocation.ptr;
|
||||
__begin_lifetime(__p, __allocation.count);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
if (__n_copy != 0)
|
||||
traits_type::copy(std::__to_address(__p),
|
||||
std::__to_address(__old_p), __n_copy);
|
||||
@@ -2325,7 +2247,6 @@ basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(
|
||||
__is_short ? __set_short_size(__n) : __set_long_size(__n);
|
||||
traits_type::copy(std::__to_address(__p), __s, __n);
|
||||
traits_type::assign(__p[__n], value_type());
|
||||
__invalidate_iterators_past(__n);
|
||||
} else {
|
||||
size_type __sz = __is_short ? __get_short_size() : __get_long_size();
|
||||
__grow_by_and_replace(__cap - 1, __n - __cap + 1, __sz, 0, __sz, __n, __s);
|
||||
@@ -2395,7 +2316,6 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
|
||||
}
|
||||
traits_type::assign(*__p, __c);
|
||||
traits_type::assign(*++__p, value_type());
|
||||
__invalidate_iterators_past(1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -2497,7 +2417,6 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _For
|
||||
traits_type::assign(*__p, *__first);
|
||||
traits_type::assign(*__p, value_type());
|
||||
__set_size(__n);
|
||||
__invalidate_iterators_past(__n);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2796,9 +2715,6 @@ template<class _InputIterator, __enable_if_t<__has_exactly_input_iterator_catego
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, range) called with an iterator not"
|
||||
" referring to this string");
|
||||
const basic_string __temp(__first, __last, __alloc());
|
||||
return insert(__pos, __temp.data(), __temp.data() + __temp.size());
|
||||
}
|
||||
@@ -2808,9 +2724,6 @@ template<class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, range) called with an iterator not referring to this string");
|
||||
|
||||
size_type __ip = static_cast<size_type>(__pos - begin());
|
||||
size_type __n = static_cast<size_type>(std::distance(__first, __last));
|
||||
if (__n == 0)
|
||||
@@ -2867,10 +2780,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, character) called with an iterator not"
|
||||
" referring to this string");
|
||||
|
||||
size_type __ip = static_cast<size_type>(__pos - begin());
|
||||
size_type __sz = size();
|
||||
size_type __cap = capacity();
|
||||
@@ -3063,10 +2972,6 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::erase(iterator) called with an iterator not"
|
||||
" referring to this string");
|
||||
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__pos != end(), "string::erase(iterator) called with a non-dereferenceable iterator");
|
||||
iterator __b = begin();
|
||||
size_type __r = static_cast<size_type>(__pos - __b);
|
||||
@@ -3079,10 +2984,6 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
|
||||
"string::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this string");
|
||||
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "string::erase(first, last) called with invalid range");
|
||||
iterator __b = begin();
|
||||
size_type __r = static_cast<size_type>(__first - __b);
|
||||
@@ -3104,7 +3005,6 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
|
||||
{
|
||||
std::__debug_db_invalidate_all(this);
|
||||
if (__is_long())
|
||||
{
|
||||
traits_type::assign(*__get_long_pointer(), value_type());
|
||||
@@ -3233,7 +3133,6 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
|
||||
}
|
||||
else
|
||||
__set_short_size(__sz);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3280,12 +3179,6 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
if (!__is_long())
|
||||
std::__debug_db_invalidate_all(this);
|
||||
if (!__str.__is_long())
|
||||
std::__debug_db_invalidate_all(&__str);
|
||||
std::__debug_db_swap(this, &__str);
|
||||
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(
|
||||
__alloc_traits::propagate_on_container_swap::value ||
|
||||
__alloc_traits::is_always_equal::value ||
|
||||
@@ -4311,42 +4204,6 @@ inline _LIBCPP_HIDE_FROM_ABI
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bool
|
||||
basic_string<_CharT, _Traits, _Allocator>::__dereferenceable(const const_iterator* __i) const
|
||||
{
|
||||
return data() <= std::__to_address(__i->base()) &&
|
||||
std::__to_address(__i->base()) < data() + size();
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bool
|
||||
basic_string<_CharT, _Traits, _Allocator>::__decrementable(const const_iterator* __i) const
|
||||
{
|
||||
return data() < std::__to_address(__i->base()) &&
|
||||
std::__to_address(__i->base()) <= data() + size();
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bool
|
||||
basic_string<_CharT, _Traits, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{
|
||||
const value_type* __p = std::__to_address(__i->base()) + __n;
|
||||
return data() <= __p && __p <= data() + size();
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bool
|
||||
basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{
|
||||
const value_type* __p = std::__to_address(__i->base()) + __n;
|
||||
return data() <= __p && __p < data() + size();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
// Literal suffixes for basic_string [basic.string.literals]
|
||||
inline namespace literals
|
||||
|
||||
@@ -518,7 +518,6 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__functional/is_transparent.h>
|
||||
#include <__functional/operations.h>
|
||||
#include <__hash_table>
|
||||
@@ -1095,7 +1094,6 @@ public:
|
||||
unordered_map()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
explicit _LIBCPP_HIDE_FROM_ABI unordered_map(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -1211,11 +1209,7 @@ public:
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __x) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered_map::insert(const_iterator, const value_type&) called with an iterator not "
|
||||
"referring to this unordered_map");
|
||||
((void)__p);
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, const value_type& __x) {
|
||||
return insert(__x).first;
|
||||
}
|
||||
|
||||
@@ -1232,11 +1226,7 @@ public:
|
||||
pair<iterator, bool> insert(value_type&& __x)
|
||||
{return __table_.__insert_unique(_VSTD::move(__x));}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __x) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
((void)__p);
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator, value_type&& __x) {
|
||||
return __table_.__insert_unique(_VSTD::move(__x)).first;
|
||||
}
|
||||
|
||||
@@ -1249,12 +1239,8 @@ public:
|
||||
template <class _Pp,
|
||||
class = __enable_if_t<is_constructible<value_type, _Pp>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, _Pp&& __x)
|
||||
iterator insert(const_iterator, _Pp&& __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered_map::insert(const_iterator, value_type&&) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
((void)__p);
|
||||
return insert(_VSTD::forward<_Pp>(__x)).first;
|
||||
}
|
||||
|
||||
@@ -1266,11 +1252,7 @@ public:
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this,
|
||||
"unordered_map::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
((void)__p);
|
||||
iterator emplace_hint(const_iterator, _Args&&... __args) {
|
||||
return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
|
||||
}
|
||||
|
||||
@@ -1297,23 +1279,15 @@ public:
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
|
||||
iterator try_emplace(const_iterator, const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this,
|
||||
"unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
((void)__h);
|
||||
return try_emplace(__k, _VSTD::forward<_Args>(__args)...).first;
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
|
||||
iterator try_emplace(const_iterator, key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__h)) == this,
|
||||
"unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
((void)__h);
|
||||
return try_emplace(_VSTD::move(__k), _VSTD::forward<_Args>(__args)...).first;
|
||||
}
|
||||
|
||||
@@ -1345,7 +1319,6 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator, const key_type& __k, _Vp&& __v)
|
||||
{
|
||||
// FIXME: Add debug mode checking for the iterator input
|
||||
return insert_or_assign(__k, _VSTD::forward<_Vp>(__v)).first;
|
||||
}
|
||||
|
||||
@@ -1353,7 +1326,6 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator, key_type&& __k, _Vp&& __v)
|
||||
{
|
||||
// FIXME: Add debug mode checking for the iterator input
|
||||
return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first;
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
@@ -1535,19 +1507,6 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.__reserve_unique(__n);}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __decrementable(const const_iterator* __i) const
|
||||
{return __table_.__decrementable(_VSTD::addressof(__i->__i_));}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __addable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
private:
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
@@ -1631,7 +1590,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
}
|
||||
|
||||
@@ -1641,7 +1599,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
}
|
||||
|
||||
@@ -1651,7 +1608,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const allocator_type& __a)
|
||||
: __table_(typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -1659,7 +1615,6 @@ template <class _InputIterator>
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
@@ -1670,7 +1625,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -1682,7 +1636,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -1692,7 +1645,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const unordered_map& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -1702,7 +1654,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const unordered_map& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -1716,8 +1667,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -1725,7 +1674,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
unordered_map&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
@@ -1734,15 +1682,12 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
__u.__table_.remove((__i++).__i_)->__value_.__move());
|
||||
}
|
||||
}
|
||||
else
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
@@ -1752,7 +1697,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
@@ -1763,7 +1707,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
@@ -1990,7 +1933,6 @@ private:
|
||||
unordered_multimap()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
explicit _LIBCPP_HIDE_FROM_ABI unordered_multimap(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -2318,21 +2260,6 @@ private:
|
||||
void rehash(size_type __n) {__table_.__rehash_multi(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.__reserve_multi(__n);}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __decrementable(const const_iterator* __i) const
|
||||
{return __table_.__decrementable(_VSTD::addressof(__i->__i_));}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __addable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
@@ -2411,7 +2338,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
}
|
||||
|
||||
@@ -2421,7 +2347,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
}
|
||||
|
||||
@@ -2430,7 +2355,6 @@ template <class _InputIterator>
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
@@ -2441,7 +2365,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -2453,7 +2376,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -2464,7 +2386,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const allocator_type& __a)
|
||||
: __table_(typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -2472,7 +2393,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const unordered_multimap& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -2482,7 +2402,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const unordered_multimap& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -2496,8 +2415,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -2505,7 +2422,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
unordered_multimap&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
@@ -2515,15 +2431,12 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
__u.__table_.remove((__i++).__i_)->__value_.__move());
|
||||
}
|
||||
}
|
||||
else
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
@@ -2533,7 +2446,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
@@ -2544,7 +2456,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
@@ -463,7 +463,6 @@ template <class Value, class Hash, class Pred, class Alloc>
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__functional/is_transparent.h>
|
||||
#include <__functional/operations.h>
|
||||
#include <__hash_table>
|
||||
@@ -550,7 +549,6 @@ public:
|
||||
unordered_set()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
explicit _LIBCPP_HIDE_FROM_ABI unordered_set(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -662,11 +660,7 @@ public:
|
||||
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this,
|
||||
"unordered_set::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered_set");
|
||||
(void)__p;
|
||||
iterator emplace_hint(const_iterator, _Args&&... __args) {
|
||||
return __table_.__emplace_unique(std::forward<_Args>(__args)...).first;
|
||||
}
|
||||
|
||||
@@ -674,11 +668,7 @@ public:
|
||||
pair<iterator, bool> insert(value_type&& __x)
|
||||
{return __table_.__insert_unique(_VSTD::move(__x));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, value_type&& __x) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this,
|
||||
"unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
|
||||
" referring to this unordered_set");
|
||||
(void)__p;
|
||||
iterator insert(const_iterator, value_type&& __x) {
|
||||
return insert(std::move(__x)).first;
|
||||
}
|
||||
|
||||
@@ -691,11 +681,7 @@ public:
|
||||
{return __table_.__insert_unique(__x);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __x) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__p)) == this,
|
||||
"unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
|
||||
" referring to this unordered_set");
|
||||
(void)__p;
|
||||
iterator insert(const_iterator, const value_type& __x) {
|
||||
return insert(__x).first;
|
||||
}
|
||||
template <class _InputIterator>
|
||||
@@ -864,20 +850,6 @@ public:
|
||||
void rehash(size_type __n) {__table_.__rehash_unique(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.__reserve_unique(__n);}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(__i);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __decrementable(const const_iterator* __i) const
|
||||
{return __table_.__decrementable(__i);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __addable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(__i, __n);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(__i, __n);}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
@@ -944,7 +916,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
}
|
||||
|
||||
@@ -953,7 +924,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
}
|
||||
|
||||
@@ -962,7 +932,6 @@ template <class _InputIterator>
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
@@ -973,7 +942,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -985,7 +953,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -996,7 +963,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const allocator_type& __a)
|
||||
: __table_(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -1004,7 +970,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const unordered_set& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -1014,7 +979,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const unordered_set& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -1028,8 +992,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -1037,22 +999,18 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
unordered_set&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
|
||||
}
|
||||
else
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
@@ -1062,7 +1020,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
@@ -1073,7 +1030,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_unique(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
@@ -1209,7 +1165,6 @@ public:
|
||||
unordered_multiset()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
explicit _LIBCPP_HIDE_FROM_ABI unordered_multiset(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -1506,20 +1461,6 @@ public:
|
||||
void rehash(size_type __n) {__table_.__rehash_multi(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.__reserve_multi(__n);}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(__i);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __decrementable(const const_iterator* __i) const
|
||||
{return __table_.__decrementable(__i);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __addable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(__i, __n);}
|
||||
_LIBCPP_HIDE_FROM_ABI bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(__i, __n);}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
@@ -1584,7 +1525,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
}
|
||||
|
||||
@@ -1594,7 +1534,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
}
|
||||
|
||||
@@ -1603,7 +1542,6 @@ template <class _InputIterator>
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__first, __last);
|
||||
}
|
||||
|
||||
@@ -1614,7 +1552,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -1626,7 +1563,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__first, __last);
|
||||
}
|
||||
@@ -1637,7 +1573,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const allocator_type& __a)
|
||||
: __table_(__a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -1645,7 +1580,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const unordered_multiset& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -1655,7 +1589,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const unordered_multiset& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__u.bucket_count());
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
@@ -1669,8 +1602,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -1678,22 +1609,18 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
unordered_multiset&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
|
||||
}
|
||||
else
|
||||
std::__debug_db_swap(this, std::addressof(__u));
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
@@ -1703,7 +1630,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
@@ -1714,7 +1640,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
_VSTD::__debug_db_insert_c(this);
|
||||
__table_.__rehash_multi(__n);
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
@@ -316,7 +316,6 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
|
||||
#include <__bit_reference>
|
||||
#include <__concepts/same_as.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__format/enable_insertable.h>
|
||||
#include <__format/formatter.h>
|
||||
#include <__format/formatter_bool.h>
|
||||
@@ -412,7 +411,6 @@ public:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
{
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
@@ -422,7 +420,6 @@ public:
|
||||
#endif
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
std::__debug_db_insert_c(this);
|
||||
}
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
@@ -435,7 +432,6 @@ public:
|
||||
vector(size_type __n, const value_type& __x, const allocator_type& __a)
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__n > 0)
|
||||
{
|
||||
__vallocate(__n);
|
||||
@@ -489,8 +485,6 @@ private:
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __destroy_vector(vector& __vec) : __vec_(__vec) {}
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
|
||||
std::__debug_db_erase_c(std::addressof(__vec_));
|
||||
|
||||
if (__vec_.__begin_ != nullptr) {
|
||||
__vec_.__clear();
|
||||
__vec_.__annotate_delete();
|
||||
@@ -728,7 +722,6 @@ public:
|
||||
size_type __old_size = size();
|
||||
__clear();
|
||||
__annotate_shrink(__old_size);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void resize(size_type __sz);
|
||||
@@ -744,23 +737,12 @@ public:
|
||||
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
private:
|
||||
pointer __begin_ = nullptr;
|
||||
pointer __end_ = nullptr;
|
||||
__compressed_pair<pointer, allocator_type> __end_cap_ =
|
||||
__compressed_pair<pointer, allocator_type>(nullptr, __default_init_tag());
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void __invalidate_iterators_past(pointer __new_last);
|
||||
|
||||
// Allocate space for __n objects
|
||||
// throws length_error if __n > max_size()
|
||||
// throws (probably bad_alloc) if memory run out
|
||||
@@ -788,7 +770,6 @@ private:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
void __init_with_size(_InputIterator __first, _Sentinel __last, size_type __n) {
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
|
||||
if (__n > 0) {
|
||||
__vallocate(__n);
|
||||
@@ -802,7 +783,6 @@ private:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
void __init_with_sentinel(_InputIterator __first, _Sentinel __last) {
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
|
||||
for (; __first != __last; ++__first)
|
||||
emplace_back(*__first);
|
||||
@@ -833,9 +813,9 @@ private:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
iterator __make_iter(pointer __p) _NOEXCEPT { return iterator(this, __p); }
|
||||
iterator __make_iter(pointer __p) _NOEXCEPT { return iterator(__p); }
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { return const_iterator(this, __p); }
|
||||
const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { return const_iterator(__p); }
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_range(pointer __from_s, pointer __from_e, pointer __to);
|
||||
@@ -846,8 +826,6 @@ private:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
__invalidate_iterators_past(__new_last);
|
||||
size_type __old_size = size();
|
||||
__base_destruct_at_end(__new_last);
|
||||
__annotate_shrink(__old_size);
|
||||
@@ -1059,7 +1037,6 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
|
||||
std::swap(this->__end_cap(), __v.__end_cap());
|
||||
__v.__first_ = __v.__begin_;
|
||||
__annotate_new(size());
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1079,7 +1056,6 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
|
||||
std::swap(this->__end_cap(), __v.__end_cap());
|
||||
__v.__first_ = __v.__begin_;
|
||||
__annotate_new(size());
|
||||
std::__debug_db_invalidate_all(this);
|
||||
return __r;
|
||||
}
|
||||
|
||||
@@ -1211,7 +1187,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
vector<_Tp, _Allocator>::vector(size_type __n)
|
||||
{
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__n > 0)
|
||||
{
|
||||
__vallocate(__n);
|
||||
@@ -1227,7 +1202,6 @@ vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__n > 0)
|
||||
{
|
||||
__vallocate(__n);
|
||||
@@ -1242,7 +1216,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
|
||||
{
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__n > 0)
|
||||
{
|
||||
__vallocate(__n);
|
||||
@@ -1322,8 +1295,6 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
|
||||
#endif
|
||||
: __end_cap_(nullptr, std::move(__x.__alloc()))
|
||||
{
|
||||
std::__debug_db_insert_c(this);
|
||||
std::__debug_db_swap(this, std::addressof(__x));
|
||||
this->__begin_ = __x.__begin_;
|
||||
this->__end_ = __x.__end_;
|
||||
this->__end_cap() = __x.__end_cap();
|
||||
@@ -1336,14 +1307,12 @@ inline _LIBCPP_HIDE_FROM_ABI
|
||||
vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__a == __x.__alloc())
|
||||
{
|
||||
this->__begin_ = __x.__begin_;
|
||||
this->__end_ = __x.__end_;
|
||||
this->__end_cap() = __x.__end_cap();
|
||||
__x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
|
||||
std::__debug_db_swap(this, std::addressof(__x));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1362,7 +1331,6 @@ inline _LIBCPP_HIDE_FROM_ABI
|
||||
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
|
||||
{
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__il.size() > 0)
|
||||
{
|
||||
__vallocate(__il.size());
|
||||
@@ -1378,7 +1346,6 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
|
||||
: __end_cap_(nullptr, __a)
|
||||
{
|
||||
auto __guard = std::__make_exception_guard(__destroy_vector(*this));
|
||||
std::__debug_db_insert_c(this);
|
||||
if (__il.size() > 0)
|
||||
{
|
||||
__vallocate(__il.size());
|
||||
@@ -1428,7 +1395,6 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
|
||||
this->__end_ = __c.__end_;
|
||||
this->__end_cap() = __c.__end_cap();
|
||||
__c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
|
||||
std::__debug_db_swap(this, std::addressof(__c));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1499,7 +1465,6 @@ void vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sent
|
||||
__vallocate(__recommend(__new_size));
|
||||
__construct_at_end(__first, __last, __new_size);
|
||||
}
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1522,7 +1487,6 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
|
||||
__vallocate(__recommend(static_cast<size_type>(__n)));
|
||||
__construct_at_end(__n, __u);
|
||||
}
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -1733,15 +1697,11 @@ inline _LIBCPP_HIDE_FROM_ABI
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::erase(const_iterator __position)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::erase(iterator) called with an iterator not referring to this vector");
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__position != end(),
|
||||
"vector::erase(iterator) called with a non-dereferenceable iterator");
|
||||
difference_type __ps = __position - cbegin();
|
||||
pointer __p = this->__begin_ + __ps;
|
||||
this->__destruct_at_end(std::move(__p + 1, this->__end_, __p));
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
this->__invalidate_iterators_past(__p - 1);
|
||||
return __make_iter(__p);
|
||||
}
|
||||
|
||||
@@ -1750,17 +1710,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__first)) == this,
|
||||
"vector::erase(iterator, iterator) called with an iterator not referring to this vector");
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__last)) == this,
|
||||
"vector::erase(iterator, iterator) called with an iterator not referring to this vector");
|
||||
|
||||
_LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "vector::erase(first, last) called with invalid range");
|
||||
pointer __p = this->__begin_ + (__first - begin());
|
||||
if (__first != __last) {
|
||||
this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p));
|
||||
if (!__libcpp_is_constant_evaluated())
|
||||
this->__invalidate_iterators_past(__p - 1);
|
||||
}
|
||||
return __make_iter(__p);
|
||||
}
|
||||
@@ -1790,8 +1743,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::insert(iterator, x) called with an iterator not referring to this vector");
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
// We can't compare unrelated pointers inside constant expressions
|
||||
if (!__libcpp_is_constant_evaluated() && this->__end_ < this->__end_cap())
|
||||
@@ -1824,8 +1775,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::insert(iterator, x) called with an iterator not referring to this vector");
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
@@ -1855,8 +1804,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::emplace(iterator, x) called with an iterator not referring to this vector");
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
@@ -1886,8 +1833,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
|
||||
{
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::insert(iterator, n, x) called with an iterator not referring to this vector");
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (__n > 0)
|
||||
{
|
||||
@@ -1936,9 +1881,6 @@ template <class _InputIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _InputIterator __first, _Sentinel __last) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::insert called with an iterator not referring to this vector");
|
||||
|
||||
difference_type __off = __position - begin();
|
||||
pointer __p = this->__begin_ + __off;
|
||||
allocator_type& __a = this->__alloc();
|
||||
@@ -1991,9 +1933,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::__insert_with_size(const_iterator __position, _Iterator __first, _Sentinel __last,
|
||||
difference_type __n) {
|
||||
_LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this,
|
||||
"vector::insert called with an iterator not referring to this vector");
|
||||
|
||||
auto __insertion_size = __n;
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (__n > 0)
|
||||
@@ -2073,7 +2012,6 @@ vector<_Tp, _Allocator>::swap(vector& __x)
|
||||
std::swap(this->__end_cap(), __x.__end_cap());
|
||||
std::__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
|
||||
std::__debug_db_swap(this, std::addressof(__x));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -2098,61 +2036,6 @@ vector<_Tp, _Allocator>::__invariants() const
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
vector<_Tp, _Allocator>::__dereferenceable(const const_iterator* __i) const
|
||||
{
|
||||
return this->__begin_ <= __i->base() && __i->base() < this->__end_;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
vector<_Tp, _Allocator>::__decrementable(const const_iterator* __i) const
|
||||
{
|
||||
return this->__begin_ < __i->base() && __i->base() <= this->__end_;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
vector<_Tp, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{
|
||||
const_pointer __p = __i->base() + __n;
|
||||
return this->__begin_ <= __p && __p <= this->__end_;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{
|
||||
const_pointer __p = __i->base() + __n;
|
||||
return this->__begin_ <= __p && __p < this->__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI
|
||||
void
|
||||
vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; ) {
|
||||
--__p;
|
||||
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
|
||||
if (__i->base() > __new_last) {
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
std::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
#else
|
||||
((void)__new_last);
|
||||
#endif
|
||||
}
|
||||
|
||||
// vector<bool>
|
||||
|
||||
template <class _Allocator> class vector<bool, _Allocator>;
|
||||
@@ -2241,7 +2124,6 @@ private:
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void operator()() {
|
||||
if (__vec_.__begin_ != nullptr)
|
||||
__storage_traits::deallocate(__vec_.__alloc(), __vec_.__begin_, __vec_.__cap());
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -2536,7 +2418,6 @@ private:
|
||||
} catch (...) {
|
||||
if (__begin_ != nullptr)
|
||||
__storage_traits::deallocate(__alloc(), __begin_, __cap());
|
||||
std::__debug_db_invalidate_all(this);
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
@@ -2661,7 +2542,6 @@ vector<bool, _Allocator>::__vdeallocate() _NOEXCEPT
|
||||
if (this->__begin_ != nullptr)
|
||||
{
|
||||
__storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
|
||||
std::__debug_db_invalidate_all(this);
|
||||
this->__begin_ = nullptr;
|
||||
this->__size_ = this->__cap() = 0;
|
||||
}
|
||||
@@ -3038,7 +2918,6 @@ vector<bool, _Allocator>::assign(size_type __n, const value_type& __x)
|
||||
}
|
||||
std::fill_n(begin(), __n, __x);
|
||||
}
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
|
||||
template <class _Allocator>
|
||||
@@ -3105,7 +2984,6 @@ vector<bool, _Allocator>::reserve(size_type __n)
|
||||
__v.__vallocate(__n);
|
||||
__v.__construct_at_end(this->begin(), this->end(), this->size());
|
||||
swap(__v);
|
||||
std::__debug_db_invalidate_all(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,13 +68,6 @@ set(LIBCXX_SOURCES
|
||||
verbose_abort.cpp
|
||||
)
|
||||
|
||||
if (LIBCXX_ENABLE_DEBUG_MODE OR LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS)
|
||||
list(APPEND LIBCXX_SOURCES
|
||||
debug.cpp
|
||||
legacy_debug_handler.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_RANDOM_DEVICE)
|
||||
list(APPEND LIBCXX_SOURCES
|
||||
random.cpp
|
||||
|
||||
@@ -1,559 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__hash_table>
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
# include <mutex>
|
||||
# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
|
||||
# pragma comment(lib, "pthread")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI
|
||||
__libcpp_db*
|
||||
__get_db()
|
||||
{
|
||||
static _LIBCPP_NO_DESTROY __libcpp_db db;
|
||||
return &db;
|
||||
}
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI
|
||||
const __libcpp_db*
|
||||
__get_const_db()
|
||||
{
|
||||
return __get_db();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
typedef mutex mutex_type;
|
||||
typedef lock_guard<mutex_type> WLock;
|
||||
typedef lock_guard<mutex_type> RLock;
|
||||
|
||||
mutex_type&
|
||||
mut()
|
||||
{
|
||||
static _LIBCPP_NO_DESTROY mutex_type m;
|
||||
return m;
|
||||
}
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
__i_node::~__i_node()
|
||||
{
|
||||
if (__next_)
|
||||
{
|
||||
__next_->~__i_node();
|
||||
free(__next_);
|
||||
}
|
||||
}
|
||||
|
||||
__c_node::~__c_node()
|
||||
{
|
||||
free(beg_);
|
||||
if (__next_)
|
||||
{
|
||||
__next_->~__c_node();
|
||||
free(__next_);
|
||||
}
|
||||
}
|
||||
|
||||
__libcpp_db::__libcpp_db()
|
||||
: __cbeg_(nullptr),
|
||||
__cend_(nullptr),
|
||||
__csz_(0),
|
||||
__ibeg_(nullptr),
|
||||
__iend_(nullptr),
|
||||
__isz_(0)
|
||||
{
|
||||
}
|
||||
|
||||
__libcpp_db::~__libcpp_db()
|
||||
{
|
||||
if (__cbeg_)
|
||||
{
|
||||
for (__c_node** p = __cbeg_; p != __cend_; ++p)
|
||||
{
|
||||
if (*p != nullptr)
|
||||
{
|
||||
(*p)->~__c_node();
|
||||
free(*p);
|
||||
}
|
||||
}
|
||||
free(__cbeg_);
|
||||
}
|
||||
if (__ibeg_)
|
||||
{
|
||||
for (__i_node** p = __ibeg_; p != __iend_; ++p)
|
||||
{
|
||||
if (*p != nullptr)
|
||||
{
|
||||
(*p)->~__i_node();
|
||||
free(*p);
|
||||
}
|
||||
}
|
||||
free(__ibeg_);
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
__libcpp_db::__find_c_from_i(void* __i) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
_LIBCPP_ASSERT(i != nullptr, "iterator not found in debug database.");
|
||||
return i->__c_ != nullptr ? i->__c_->__c_ : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__insert_ic(void* __i, const void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__cbeg_ == __cend_)
|
||||
return;
|
||||
size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* c = __cbeg_[hc];
|
||||
if (c == nullptr)
|
||||
return;
|
||||
while (c->__c_ != __c)
|
||||
{
|
||||
c = c->__next_;
|
||||
if (c == nullptr)
|
||||
return;
|
||||
}
|
||||
__i_node* i = __insert_iterator(__i);
|
||||
c->__add(i);
|
||||
i->__c_ = c;
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__insert_c(void* __c, __libcpp_db::_InsertConstruct *__fn)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__csz_ + 1 > static_cast<size_t>(__cend_ - __cbeg_))
|
||||
{
|
||||
size_t nc = __next_prime(2*static_cast<size_t>(__cend_ - __cbeg_) + 1);
|
||||
__c_node** cbeg = static_cast<__c_node**>(calloc(nc, sizeof(__c_node*)));
|
||||
if (cbeg == nullptr)
|
||||
__throw_bad_alloc();
|
||||
|
||||
for (__c_node** p = __cbeg_; p != __cend_; ++p)
|
||||
{
|
||||
__c_node* q = *p;
|
||||
while (q != nullptr)
|
||||
{
|
||||
size_t h = hash<void*>()(q->__c_) % nc;
|
||||
__c_node* r = q->__next_;
|
||||
q->__next_ = cbeg[h];
|
||||
cbeg[h] = q;
|
||||
q = r;
|
||||
}
|
||||
}
|
||||
free(__cbeg_);
|
||||
__cbeg_ = cbeg;
|
||||
__cend_ = __cbeg_ + nc;
|
||||
}
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p = __cbeg_[hc];
|
||||
void *buf = malloc(sizeof(__c_node));
|
||||
if (buf == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__cbeg_[hc] = __fn(buf, __c, p);
|
||||
|
||||
++__csz_;
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__erase_i(void* __i)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__ibeg_ != __iend_)
|
||||
{
|
||||
size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
|
||||
__i_node* p = __ibeg_[hi];
|
||||
if (p != nullptr)
|
||||
{
|
||||
__i_node* q = nullptr;
|
||||
while (p->__i_ != __i)
|
||||
{
|
||||
q = p;
|
||||
p = p->__next_;
|
||||
if (p == nullptr)
|
||||
return;
|
||||
}
|
||||
if (q == nullptr)
|
||||
__ibeg_[hi] = p->__next_;
|
||||
else
|
||||
q->__next_ = p->__next_;
|
||||
__c_node* c = p->__c_;
|
||||
--__isz_;
|
||||
if (c != nullptr)
|
||||
c->__remove(p);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__invalidate_all(void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__cend_ != __cbeg_)
|
||||
{
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p = __cbeg_[hc];
|
||||
if (p == nullptr)
|
||||
return;
|
||||
while (p->__c_ != __c)
|
||||
{
|
||||
p = p->__next_;
|
||||
if (p == nullptr)
|
||||
return;
|
||||
}
|
||||
while (p->end_ != p->beg_)
|
||||
{
|
||||
--p->end_;
|
||||
(*p->end_)->__c_ = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__c_node*
|
||||
__libcpp_db::__find_c_and_lock(void* __c) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().lock();
|
||||
#endif
|
||||
if (__cend_ == __cbeg_)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p = __cbeg_[hc];
|
||||
if (p == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
while (p->__c_ != __c)
|
||||
{
|
||||
p = p->__next_;
|
||||
if (p == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
__c_node*
|
||||
__libcpp_db::__find_c(void* __c) const
|
||||
{
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p = __cbeg_[hc];
|
||||
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c A");
|
||||
while (p->__c_ != __c)
|
||||
{
|
||||
p = p->__next_;
|
||||
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c B");
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::unlock() const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__erase_c(void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__cend_ != __cbeg_)
|
||||
{
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p = __cbeg_[hc];
|
||||
if (p == nullptr)
|
||||
return;
|
||||
__c_node* q = nullptr;
|
||||
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
|
||||
while (p->__c_ != __c)
|
||||
{
|
||||
q = p;
|
||||
p = p->__next_;
|
||||
if (p == nullptr)
|
||||
return;
|
||||
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c B");
|
||||
}
|
||||
if (q == nullptr)
|
||||
__cbeg_[hc] = p->__next_;
|
||||
else
|
||||
q->__next_ = p->__next_;
|
||||
while (p->end_ != p->beg_)
|
||||
{
|
||||
--p->end_;
|
||||
(*p->end_)->__c_ = nullptr;
|
||||
}
|
||||
free(p->beg_);
|
||||
free(p);
|
||||
--__csz_;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__iterator_copy(void* __i, const void* __i0)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
__i_node* i0 = __find_iterator(__i0);
|
||||
__c_node* c0 = i0 != nullptr ? i0->__c_ : nullptr;
|
||||
if (i == nullptr && i0 != nullptr)
|
||||
i = __insert_iterator(__i);
|
||||
__c_node* c = i != nullptr ? i->__c_ : nullptr;
|
||||
if (c != c0)
|
||||
{
|
||||
if (c != nullptr)
|
||||
c->__remove(i);
|
||||
if (i != nullptr)
|
||||
{
|
||||
i->__c_ = nullptr;
|
||||
if (c0 != nullptr)
|
||||
{
|
||||
i->__c_ = c0;
|
||||
i->__c_->__add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
__libcpp_db::__dereferenceable(const void* __i) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__dereferenceable(__i);
|
||||
}
|
||||
|
||||
bool
|
||||
__libcpp_db::__decrementable(const void* __i) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__decrementable(__i);
|
||||
}
|
||||
|
||||
bool
|
||||
__libcpp_db::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__addable(__i, __n);
|
||||
}
|
||||
|
||||
bool
|
||||
__libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__subscriptable(__i, __n);
|
||||
}
|
||||
|
||||
bool
|
||||
__libcpp_db::__less_than_comparable(const void* __i, const void* __j) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
__i_node* j = __find_iterator(__j);
|
||||
__c_node* ci = i != nullptr ? i->__c_ : nullptr;
|
||||
__c_node* cj = j != nullptr ? j->__c_ : nullptr;
|
||||
return ci == cj;
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::swap(void* c1, void* c2)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
size_t hc = hash<void*>()(c1) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p1 = __cbeg_[hc];
|
||||
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
|
||||
while (p1->__c_ != c1)
|
||||
{
|
||||
p1 = p1->__next_;
|
||||
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B");
|
||||
}
|
||||
hc = hash<void*>()(c2) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p2 = __cbeg_[hc];
|
||||
_LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C");
|
||||
while (p2->__c_ != c2)
|
||||
{
|
||||
p2 = p2->__next_;
|
||||
_LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap D");
|
||||
}
|
||||
std::swap(p1->beg_, p2->beg_);
|
||||
std::swap(p1->end_, p2->end_);
|
||||
std::swap(p1->cap_, p2->cap_);
|
||||
for (__i_node** p = p1->beg_; p != p1->end_; ++p)
|
||||
(*p)->__c_ = p1;
|
||||
for (__i_node** p = p2->beg_; p != p2->end_; ++p)
|
||||
(*p)->__c_ = p2;
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__insert_i(void* __i)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
__insert_iterator(__i);
|
||||
}
|
||||
|
||||
void
|
||||
__c_node::__add(__i_node* i)
|
||||
{
|
||||
if (end_ == cap_)
|
||||
{
|
||||
size_t nc = 2*static_cast<size_t>(cap_ - beg_);
|
||||
if (nc == 0)
|
||||
nc = 1;
|
||||
__i_node** beg =
|
||||
static_cast<__i_node**>(malloc(nc * sizeof(__i_node*)));
|
||||
if (beg == nullptr)
|
||||
__throw_bad_alloc();
|
||||
|
||||
if (nc > 1)
|
||||
memcpy(beg, beg_, nc/2*sizeof(__i_node*));
|
||||
free(beg_);
|
||||
beg_ = beg;
|
||||
end_ = beg_ + nc/2;
|
||||
cap_ = beg_ + nc;
|
||||
}
|
||||
*end_++ = i;
|
||||
}
|
||||
|
||||
// private api
|
||||
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node*
|
||||
__libcpp_db::__insert_iterator(void* __i)
|
||||
{
|
||||
if (__isz_ + 1 > static_cast<size_t>(__iend_ - __ibeg_))
|
||||
{
|
||||
size_t nc = __next_prime(2*static_cast<size_t>(__iend_ - __ibeg_) + 1);
|
||||
__i_node** ibeg = static_cast<__i_node**>(calloc(nc, sizeof(__i_node*)));
|
||||
if (ibeg == nullptr)
|
||||
__throw_bad_alloc();
|
||||
|
||||
for (__i_node** p = __ibeg_; p != __iend_; ++p)
|
||||
{
|
||||
__i_node* q = *p;
|
||||
while (q != nullptr)
|
||||
{
|
||||
size_t h = hash<void*>()(q->__i_) % nc;
|
||||
__i_node* r = q->__next_;
|
||||
q->__next_ = ibeg[h];
|
||||
ibeg[h] = q;
|
||||
q = r;
|
||||
}
|
||||
}
|
||||
free(__ibeg_);
|
||||
__ibeg_ = ibeg;
|
||||
__iend_ = __ibeg_ + nc;
|
||||
}
|
||||
size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
|
||||
__i_node* p = __ibeg_[hi];
|
||||
__i_node* r = __ibeg_[hi] =
|
||||
static_cast<__i_node*>(malloc(sizeof(__i_node)));
|
||||
if (r == nullptr)
|
||||
__throw_bad_alloc();
|
||||
|
||||
::new(r) __i_node(__i, p, nullptr);
|
||||
++__isz_;
|
||||
return r;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDDEN
|
||||
__i_node*
|
||||
__libcpp_db::__find_iterator(const void* __i) const
|
||||
{
|
||||
__i_node* r = nullptr;
|
||||
if (__ibeg_ != __iend_)
|
||||
{
|
||||
size_t h = hash<const void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
|
||||
for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_)
|
||||
{
|
||||
if (nd->__i_ == __i)
|
||||
{
|
||||
r = nd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDDEN
|
||||
void
|
||||
__c_node::__remove(__i_node* p)
|
||||
{
|
||||
__i_node** r = find(beg_, end_, p);
|
||||
_LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove");
|
||||
if (--end_ != r)
|
||||
memmove(r, r+1, static_cast<size_t>(end_ - r)*sizeof(__i_node*));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <__charconv/chars_format.h>
|
||||
#include <__charconv/to_chars_result.h>
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <__system_error/errc.h>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||
// When the debug mode is enabled, we don't unwrap iterators in `std::copy` and similar algorithms so we never get the
|
||||
// optimization.
|
||||
// UNSUPPORTED: libcpp-has-debug-mode
|
||||
// In the modules build, adding another overload of `memmove` doesn't work.
|
||||
// UNSUPPORTED: modules-build
|
||||
// GCC complains about "ambiguating" `__builtin_memmove`.
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||
// When the debug mode is enabled, we don't unwrap iterators in `std::copy` and similar algorithms so we don't get this
|
||||
// optimization.
|
||||
// UNSUPPORTED: libcpp-has-debug-mode
|
||||
// In the modules build, adding another overload of `memmove` doesn't work.
|
||||
// UNSUPPORTED: modules-build
|
||||
// GCC complains about "ambiguating" `__builtin_memmove`.
|
||||
|
||||
@@ -64,9 +64,7 @@ int main(int, char**)
|
||||
std::make_heap(v.begin(), v.end());
|
||||
assert(stats.copied == 0);
|
||||
assert(stats.moved == 153'486);
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
assert(stats.compared == 188'285);
|
||||
#endif
|
||||
|
||||
assert(std::is_heap(v.begin(), v.end()));
|
||||
|
||||
|
||||
@@ -30,11 +30,6 @@
|
||||
// Sometimes std::sort does not go out of bounds as well, for example, right now if transitivity
|
||||
// of equivalence is not met, std::sort can only produce incorrect result but would not fail.
|
||||
|
||||
// When the debug mode is enabled, this test fails because we actually catch on the fly that the comparator
|
||||
// is not a strict-weak ordering before we catch that we'd dereference out-of-bounds inside std::sort,
|
||||
// which leads to different errors than the ones tested below.
|
||||
// XFAIL: libcpp-has-debug-mode
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// When the debug mode is enabled, we don't unwrap iterators in std::copy
|
||||
// so we don't get this optimization.
|
||||
// UNSUPPORTED: libcpp-has-debug-mode
|
||||
|
||||
// check that std::__unwrap_iter() returns the correct type
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -68,9 +68,7 @@ int main(int, char**) {
|
||||
std::sort_heap(first, last);
|
||||
LIBCPP_ASSERT(stats.copied == 0);
|
||||
LIBCPP_ASSERT(stats.moved <= 2 * n + n * logn);
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
LIBCPP_ASSERT(stats.compared <= n * logn);
|
||||
#endif
|
||||
LIBCPP_ASSERT(std::is_sorted(first, last));
|
||||
LIBCPP_ASSERT(stats.compared <= 2 * n * logn + debug_comparisons);
|
||||
}
|
||||
|
||||
@@ -262,9 +262,7 @@ void test_complexity() {
|
||||
std::ranges::sort_heap(first, last, &MyInt::Comp);
|
||||
LIBCPP_ASSERT(stats.copied == 0);
|
||||
LIBCPP_ASSERT(stats.moved <= 2 * n + n * logn);
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
LIBCPP_ASSERT(stats.compared <= n * logn);
|
||||
#endif
|
||||
LIBCPP_ASSERT(std::is_sorted(first, last, &MyInt::Comp));
|
||||
LIBCPP_ASSERT(stats.compared <= 2 * n * logn + debug_comparisons);
|
||||
}
|
||||
|
||||
@@ -79,9 +79,7 @@ test_one(unsigned N, unsigned M)
|
||||
assert(ia[0] == static_cast<int>(N)-1);
|
||||
assert(ia[N-1] == 0);
|
||||
assert(std::is_sorted(ia, ia+N, std::greater<value_type>()));
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
assert(pred.count() <= (N-1));
|
||||
#endif
|
||||
}
|
||||
delete [] ia;
|
||||
}
|
||||
|
||||
@@ -156,11 +156,7 @@ constexpr void test_comparator_invocation_count() {
|
||||
// The comparator is invoked only `min(left.size(), right.size())` times
|
||||
test_lexicographical_compare<const int*, const int*>(
|
||||
std::array{0, 1, 2}, std::array{0, 1, 2, 3}, compare_last_digit_counting, std::strong_ordering::less);
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
assert(compare_invocation_count <= 6);
|
||||
#else
|
||||
assert(compare_invocation_count <= 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check that it works with proxy iterators
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
// map& operator=(const map& m);
|
||||
|
||||
// XFAIL: libcpp-has-debug-mode
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++03
|
||||
// XFAIL: libcpp-has-debug-mode
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#error The library must be built with the debug mode enabled in order to use this header
|
||||
#endif
|
||||
|
||||
#include <__debug>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -486,24 +486,6 @@ steps:
|
||||
limit: 2
|
||||
timeout_in_minutes: 120
|
||||
|
||||
- label: "Debug mode"
|
||||
command: "libcxx/utils/ci/run-buildbot generic-debug-mode"
|
||||
artifact_paths:
|
||||
- "**/test-results.xml"
|
||||
- "**/*.abilist"
|
||||
env:
|
||||
CC: "clang-${LLVM_HEAD_VERSION}"
|
||||
CXX: "clang++-${LLVM_HEAD_VERSION}"
|
||||
ENABLE_CLANG_TIDY: "On"
|
||||
agents:
|
||||
queue: "libcxx-builders"
|
||||
os: "linux"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: -1 # Agent was lost
|
||||
limit: 2
|
||||
timeout_in_minutes: 120
|
||||
|
||||
- label: "With LLVM's libunwind"
|
||||
command: "libcxx/utils/ci/run-buildbot generic-with_llvm_unwinder"
|
||||
artifact_paths:
|
||||
|
||||
@@ -387,12 +387,6 @@ generic-assertions)
|
||||
check-runtimes
|
||||
check-abi-list
|
||||
;;
|
||||
generic-debug-mode)
|
||||
clean
|
||||
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
|
||||
check-runtimes
|
||||
# We don't check the ABI lists because the debug mode ABI is not stable
|
||||
;;
|
||||
generic-with_llvm_unwinder)
|
||||
clean
|
||||
generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON
|
||||
|
||||
@@ -156,7 +156,6 @@ libcxx/include/__coroutine/trivial_awaitables.h
|
||||
libcxx/include/cstddef
|
||||
libcxx/include/ctype.h
|
||||
libcxx/include/cuchar
|
||||
libcxx/include/__debug
|
||||
libcxx/include/__debug_utils/randomize_range.h
|
||||
libcxx/include/deque
|
||||
libcxx/include/errno.h
|
||||
@@ -521,7 +520,6 @@ libcxx/src/charconv.cpp
|
||||
libcxx/src/chrono.cpp
|
||||
libcxx/src/condition_variable.cpp
|
||||
libcxx/src/condition_variable_destructor.cpp
|
||||
libcxx/src/debug.cpp
|
||||
libcxx/src/exception.cpp
|
||||
libcxx/src/experimental/memory_resource.cpp
|
||||
libcxx/src/filesystem/directory_entry.cpp
|
||||
|
||||
@@ -53,8 +53,6 @@ def generate_map(include):
|
||||
continue
|
||||
elif i == "__config":
|
||||
continue
|
||||
elif i == "__debug":
|
||||
continue
|
||||
elif i == "__errc":
|
||||
continue
|
||||
elif i == "__hash_table":
|
||||
|
||||
@@ -307,7 +307,6 @@ macros = {
|
||||
"_LIBCPP_HAS_NO_LOCALIZATION": "no-localization",
|
||||
"_LIBCPP_HAS_NO_WIDE_CHARACTERS": "no-wide-characters",
|
||||
"_LIBCPP_HAS_NO_UNICODE": "libcpp-has-no-unicode",
|
||||
"_LIBCPP_ENABLE_DEBUG_MODE": "libcpp-has-debug-mode",
|
||||
}
|
||||
for macro, feature in macros.items():
|
||||
DEFAULT_FEATURES.append(
|
||||
|
||||
@@ -63,7 +63,6 @@ private_headers_still_public_in_modules = [
|
||||
"__assert",
|
||||
"__config",
|
||||
"__config_site.in",
|
||||
"__debug",
|
||||
"__hash_table",
|
||||
"__threading_support",
|
||||
"__tree",
|
||||
|
||||
Reference in New Issue
Block a user