[libc++] Make the Debug mode a configuration-time only option

The debug mode has been broken pretty much ever since it was shipped
because it was possible to enable the debug mode in user code without
actually enabling it in the dylib, leading to ODR violations that
caused various kinds of failures.

This commit makes the debug mode a knob that is configured when
building the library and which can't be changed afterwards. This is
less flexible for users, however it will actually work as intended
and it will allow us, in the future, to add various kinds of checks
that do not assume the same ABI as the normal library. Furthermore,
this will make the debug mode more robust, which means that vendors
might be more tempted to support it properly, which hasn't been the
case with the current debug mode.

This patch shouldn't break any user code, except folks who are building
against a library that doesn't have the debug mode enabled and who try
to enable the debug mode in their code. Such users will get a compile-time
error explaining that this configuration isn't supported anymore.

In the future, we should further increase the granularity of the debug
mode checks so that we can cherry-pick which checks to enable, like we
do for unspecified behavior randomization.

Differential Revision: https://reviews.llvm.org/D122941
This commit is contained in:
Louis Dionne 2022-04-01 16:38:30 -04:00
parent 89c4b29e8d
commit f3966eaf86
122 changed files with 319 additions and 409 deletions

View File

@ -68,11 +68,11 @@ option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of the main libc++ lib
${ENABLE_FILESYSTEM_DEFAULT})
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library. This requires the PSTL to be available." OFF)
option(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT
"Whether to include support for libc++'s debugging mode in the library.
By default, this is turned on. If you turn it off and try to enable the
debug mode when compiling a program against libc++, it will fail to link
since the required support isn't provided in the library." ON)
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
@ -210,6 +210,13 @@ 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)
cmake_dependent_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." ON
"LIBCXX_ABI_VERSION EQUAL 1" OFF) # Always OFF in ABI version != 1
# ABI Library options ---------------------------------------------------------
if (LIBCXX_TARGETING_MSVC)
set(LIBCXX_DEFAULT_ABI_LIBRARY "vcruntime")
@ -854,6 +861,7 @@ 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()

View File

@ -9,7 +9,7 @@ set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
set(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT ON CACHE BOOL "")
set(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT OFF CACHE BOOL "")
set(LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS ON CACHE BOOL "")
set(LIBCXX_ENABLE_INCOMPLETE_FEATURES OFF CACHE BOOL "")

View File

@ -1,2 +0,0 @@
set(LIBCXX_TEST_PARAMS "debug_level=1" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")

View File

@ -0,0 +1 @@
set(LIBCXX_ENABLE_DEBUG_MODE ON CACHE BOOL "")

View File

@ -1 +0,0 @@
set(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT OFF CACHE BOOL "")

View File

@ -12,35 +12,33 @@ 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 using the ``_LIBCPP_DEBUG`` macro.
they can be enabled by vendors when building the library by using ``LIBCXX_ENABLE_DEBUG_MODE``.
Note that using the debug mode discussed in this document requires that the library
has been compiled with support for the debug mode (see ``LIBCXX_ENABLE_DEBUG_MODE_SUPPORT``).
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.
Also note that while the debug mode has no effect on libc++'s ABI, it does have broad ODR
implications. Users should compile their whole program at the same debugging level.
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 various levels of checking provided by the debug mode follow.
The debug mode provides various checks to aid application debugging.
No debugging checks (``_LIBCPP_DEBUG`` not defined)
---------------------------------------------------
When ``_LIBCPP_DEBUG`` is not defined, there are no debugging checks performed by
the library. This is the default.
Comparator consistency checks (``_LIBCPP_DEBUG == 1``)
------------------------------------------------------
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 debugging checks (``_LIBCPP_DEBUG == 1``)
--------------------------------------------------
Defining ``_LIBCPP_DEBUG`` to ``1`` enables "iterator debugging", which provides
additional assertions about the validity of iterators used by the program.
The following containers and classes support iterator debugging:
Iterator debugging checks
-------------------------
The library contains various assertions to check the validity of iterators used
by the program. The following containers and classes support iterator debugging:
- ``std::string``
- ``std::vector<T>`` (``T != bool``)
@ -53,34 +51,11 @@ The following containers and classes support iterator debugging:
The remaining containers do not currently support iterator debugging.
Patches welcome.
Randomizing Unspecified Behavior (``_LIBCPP_DEBUG == 1``)
---------------------------------------------------------
This also enables the randomization of unspecified behavior, for
example, for equal elements in ``std::sort`` or randomizing both parts of
the partition after ``std::nth_element`` call. This effort helps you to migrate
to potential future faster versions of these algorithms and deflake your tests
which depend on such behavior. To fix the seed, use
``_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY_SEED=seed`` definition.
Handling Assertion Failures
===========================
When a debug assertion fails the assertion handler is called via the
``std::__libcpp_debug_function`` function pointer. It is possible to override
this function pointer using a different handler function. Libc++ provides a
the default handler, ``std::__libcpp_abort_debug_handler``, which aborts the
program. The handler may not return. Libc++ can be changed to use a custom
assertion handler as follows.
.. code-block:: cpp
#define _LIBCPP_DEBUG 1
#include <string>
void my_handler(std::__libcpp_debug_info const&);
int main(int, char**) {
std::__libcpp_debug_function = &my_handler;
std::string::iterator bad_it;
std::string str("hello world");
str.insert(bad_it, '!'); // causes debug assertion
// control flow doesn't return
}
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``.

View File

@ -113,6 +113,13 @@ API Changes
- ``vector<bool>::const_reference``, ``vector<bool>::const_iterator::reference``
and ``bitset::const_reference`` are now aliases for `bool` in the unstable ABI.
- The ``_LIBCPP_DEBUG`` macro is not supported anymore. It will be honoured until
LLVM 16, and then it will be an error to define that macro. To enable basic
assertions (previously ``_LIBCPP_DEBUG=0``), please use ``_LIBCPP_ENABLE_ASSERTIONS=1``.
To enable the debug mode (previously ``_LIBCPP_DEBUG=1|2``), please ensure that
the library has been built with support for the debug mode, and it will be
enabled automatically (no need to define ``_LIBCPP_DEBUG``).
ABI Changes
-----------
@ -168,3 +175,7 @@ Build System Changes
configuration and isn't supported by one of the configurations in ``libcxx/test/configs``,
``libcxxabi/test/configs`` or ``libunwind/test/configs``, please move to one of those
configurations or define your own.
- The ``LIBCXX_ENABLE_DEBUG_MODE_SUPPORT`` CMake configuration is not supported anymore. If you
were disabling support for the debug mode with that flag, please use ``LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS=OFF``
instead.

View File

@ -158,13 +158,6 @@ default.
still be used to specify the path of the library to link to and run against,
respectively.
.. option:: debug_level=<level>
**Values**: 0, 1
Enable the use of debug mode. Level 0 enables assertions and level 1 enables
assertions and debugging of iterator misuse.
.. option:: use_sanitizer=<sanitizer name>
**Values**: Memory, MemoryWithOrigins, Address, Undefined

View File

@ -214,9 +214,6 @@ Libc++ provides a number of configuration macros which can be used to enable
or disable extended libc++ behavior, including enabling "debug mode" or
thread safety annotations.
**_LIBCPP_DEBUG**:
See :ref:`using-debug-mode` for more information.
**_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS**:
This macro is used to enable -Wthread-safety annotations on libc++'s
``std::mutex`` and ``std::lock_guard``. By default, these annotations are

View File

@ -68,7 +68,7 @@ template <class _Comp>
struct __comp_ref_type {
// Pass the comparator by lvalue reference. Or in debug mode, using a
// debugging wrapper that stores a reference.
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
typedef __debug_less<_Comp> type;
#else
typedef _Comp& type;

View File

@ -13,6 +13,7 @@
#include <__algorithm/comp_ref_type.h>
#include <__algorithm/sort.h>
#include <__config>
#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__utility/swap.h>

View File

@ -15,6 +15,7 @@
#include <__algorithm/sift_down.h>
#include <__algorithm/sort_heap.h>
#include <__config>
#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__utility/swap.h>

View File

@ -10,6 +10,7 @@
#define _LIBCPP___ALGORITHM_SHUFFLE_H
#include <__config>
#include <__debug>
#include <__iterator/iterator_traits.h>
#include <__random/uniform_int_distribution.h>
#include <__utility/swap.h>

View File

@ -16,6 +16,7 @@
#include <__algorithm/unwrap_iter.h>
#include <__bits>
#include <__config>
#include <__debug>
#include <__functional/operations.h>
#include <__utility/swap.h>
#include <climits>

View File

@ -43,7 +43,7 @@ struct __unwrap_iter_impl {
}
};
#if _LIBCPP_DEBUG_LEVEL < 2
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Iter>
struct __unwrap_iter_impl<_Iter, true> {
@ -53,7 +53,7 @@ struct __unwrap_iter_impl<_Iter, true> {
}
};
#endif // _LIBCPP_DEBUG_LEVEL < 2
#endif // !_LIBCPP_ENABLE_DEBUG_MODE
template<class _Iter, class _Impl = __unwrap_iter_impl<_Iter> >
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR

View File

@ -19,7 +19,15 @@
// This is for backwards compatibility with code that might have been enabling
// assertions through the Debug mode previously.
#if _LIBCPP_DEBUG_LEVEL >= 1
// TODO: In LLVM 16, make it an error to define _LIBCPP_DEBUG
#if defined(_LIBCPP_DEBUG)
# ifndef _LIBCPP_ENABLE_ASSERTIONS
# define _LIBCPP_ENABLE_ASSERTIONS 1
# endif
#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

View File

@ -792,55 +792,14 @@ typedef unsigned int char32_t;
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_CXX03_LANG
// _LIBCPP_DEBUG potential values:
// - undefined: No assertions. This is the default.
// - 0: Basic assertions
// - 1: Basic assertions + iterator validity checks + unspecified behavior randomization.
# if !defined(_LIBCPP_DEBUG)
# define _LIBCPP_DEBUG_LEVEL 0
# elif _LIBCPP_DEBUG == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG are 0 and 1
# endif
# if _LIBCPP_DEBUG_LEVEL >= 2 && !defined(_LIBCPP_CXX03_LANG)
# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
# endif
# if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
# if defined(_LIBCPP_CXX03_LANG)
# error Support for unspecified stability is only for C++11 and higher
# endif
# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
do { \
if (!__builtin_is_constant_evaluated()) \
_VSTD::shuffle(__first, __last, __libcpp_debug_randomizer()); \
} while (false)
# else
# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
do { \
} while (false)
# endif
// Libc++ allows disabling extern template instantiation declarations by
// means of users defining _LIBCPP_DISABLE_EXTERN_TEMPLATE.
//
// Furthermore, when the Debug mode is enabled, we disable extern declarations
// when building user code because we don't want to use the functions compiled
// in the library, which might not have had the debug mode enabled when built.
// However, some extern declarations need to be used, because code correctness
// depends on it (several instances in <locale>). Those special declarations
// are declared with _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled
// even when the debug mode is enabled.
// TODO: Remove _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is not needed
// since the Debug mode is a configuration-time property.
#if defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE)
# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) /* nothing */
#elif _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_BUILDING_LIBRARY)
# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__;
#else
# define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__;

View File

@ -33,6 +33,7 @@
#cmakedefine _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#cmakedefine _LIBCPP_HAS_NO_INCOMPLETE_RANGES
#cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT
#cmakedefine _LIBCPP_ENABLE_DEBUG_MODE
// __USE_MINGW_ANSI_STDIO gets redefined on MinGW
#ifdef __clang__

View File

@ -18,23 +18,44 @@
# pragma GCC system_header
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
# include <cstddef>
# include <cstdio>
# include <cstdlib>
// Catch invalid uses of the legacy _LIBCPP_DEBUG toggle.
#if defined(_LIBCPP_DEBUG) && _LIBCPP_DEBUG != 0 && !defined(_LIBCPP_ENABLE_DEBUG_MODE)
# error "Enabling the debug mode now requires having configured the library with support for the debug mode"
#endif
#if _LIBCPP_DEBUG_LEVEL == 0 || _LIBCPP_DEBUG_LEVEL == 1
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
#elif _LIBCPP_DEBUG_LEVEL == 2
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) && !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
# define _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#endif
// TODO: Define this as a function instead
#if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
# if defined(_LIBCPP_CXX03_LANG)
# error Support for unspecified stability is only for C++11 and higher
# endif
# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
do { \
if (!__builtin_is_constant_evaluated()) \
std::shuffle(__first, __last, __libcpp_debug_randomizer()); \
} while (false)
#else
# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last) \
do { \
} while (false)
#endif
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m)
#else
# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY)
#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
#include <cstddef>
#include <cstdio>
#include <cstdlib>
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS __c_node;
@ -203,12 +224,15 @@ private:
_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
#endif // defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_BUILDING_LIBRARY)
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_c(_Tp* __c) {
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_c(__c);
#else
@ -218,7 +242,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) {
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_i(__i);
#else
@ -228,7 +252,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase_c(_Tp* __c) {
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__erase_c(__c);
#else
@ -238,7 +262,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_erase
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(_Tp* __lhs, _Tp* __rhs) {
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->swap(__lhs, __rhs);
#else
@ -249,7 +273,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_swap(
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_invalidate_all(_Tp* __c) {
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__invalidate_all(__c);
#else

View File

@ -119,7 +119,7 @@ class _LIBCPP_TEMPLATE_VIS __direct_storage {};
template <class _OutIt, class _CharT>
concept __enable_direct_output = __formatter::__char_type<_CharT> &&
(same_as<_OutIt, _CharT*>
#if _LIBCPP_DEBUG_LEVEL < 2
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|| same_as<_OutIt, __wrap_iter<_CharT*>>
#endif
);

View File

@ -294,7 +294,7 @@ public:
_VSTD::__debug_db_insert_i(this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_iterator(const __hash_iterator& __i)
: __node_(__i.__node_)
@ -318,7 +318,7 @@ public:
}
return *this;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@ -365,7 +365,7 @@ private:
: __node_(__node)
{
(void)__c;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@ -404,12 +404,12 @@ public:
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
: __node_(__x.__node_)
{
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(const __hash_const_iterator& __i)
: __node_(__i.__node_)
@ -433,7 +433,7 @@ public:
}
return *this;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@ -479,7 +479,7 @@ private:
: __node_(__node)
{
(void)__c;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@ -511,7 +511,7 @@ public:
_VSTD::__debug_db_insert_i(this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator(const __hash_local_iterator& __i)
: __node_(__i.__node_),
@ -539,7 +539,7 @@ public:
}
return *this;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@ -591,7 +591,7 @@ private:
__bucket_count_(__bucket_count)
{
(void)__c;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
if (__node_ != nullptr)
@ -639,12 +639,12 @@ public:
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
{
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__iterator_copy(this, _VSTD::addressof(__x));
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(const __hash_const_local_iterator& __i)
: __node_(__i.__node_),
@ -672,7 +672,7 @@ public:
}
return *this;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {
@ -724,7 +724,7 @@ private:
__bucket_count_(__bucket_count)
{
(void)__c;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
if (__node_ != nullptr)
@ -1281,14 +1281,14 @@ public:
return const_local_iterator(nullptr, __n, bucket_count(), this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
#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_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
void __rehash(size_type __n);
@ -1510,7 +1510,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
while (__np != nullptr)
{
__next_pointer __next = __np->__next_;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@ -2480,7 +2480,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
{
@ -2663,7 +2663,7 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
__x.swap(__y);
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Hash, class _Equal, class _Alloc>
bool
@ -2693,7 +2693,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
return false;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_END_NAMESPACE_STD

View File

@ -50,12 +50,12 @@ public:
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT
: __i(__u.base())
{
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__iterator_copy(this, _VSTD::addressof(__u));
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
__wrap_iter(const __wrap_iter& __x)
: __i(__x.base())
@ -139,7 +139,7 @@ private:
explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i(__x)
{
(void)__p;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_ic(this, __p);
#endif

View File

@ -304,7 +304,7 @@ class _LIBCPP_TEMPLATE_VIS __list_iterator
: __ptr_(__p)
{
(void)__c;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@ -325,7 +325,7 @@ public:
_VSTD::__debug_db_insert_i(this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__list_iterator(const __list_iterator& __p)
@ -351,7 +351,7 @@ public:
return *this;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const
@ -413,7 +413,7 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator
: __ptr_(__p)
{
(void)__c;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__insert_ic(this, __c);
#endif
}
@ -436,12 +436,12 @@ public:
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
: __ptr_(__p.__ptr_)
{
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__get_db()->__iterator_copy(this, _VSTD::addressof(__p));
#endif
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(const __list_const_iterator& __p)
@ -467,7 +467,7 @@ public:
return *this;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
_LIBCPP_INLINE_VISIBILITY
reference operator*() const
{
@ -750,7 +750,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
else
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
#if _LIBCPP_DEBUG_LEVEL == 2
#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));
@ -1075,14 +1075,14 @@ public:
return __hold_pointer(__p, __node_destructor(__na, 1));
}
#if _LIBCPP_DEBUG_LEVEL == 2
#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_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
_LIBCPP_INLINE_VISIBILITY
@ -1624,7 +1624,7 @@ list<_Tp, _Alloc>::pop_front()
__link_pointer __n = base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@ -1653,7 +1653,7 @@ list<_Tp, _Alloc>::pop_back()
__link_pointer __n = base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@ -1686,7 +1686,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
__link_pointer __r = __n->__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
{
@ -1724,7 +1724,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
__link_pointer __n = __f.__ptr_;
++__f;
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
__c_node* __c = __get_db()->__find_c_and_lock(this);
for (__i_node** __p = __c->end_; __p != __c->beg_; )
{
@ -1862,7 +1862,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
__link_nodes(__p.__ptr_, __f, __l);
base::__sz() += __c.__sz();
__c.__sz() = 0;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (_VSTD::addressof(__c) != this) {
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@ -1903,7 +1903,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
__link_nodes(__p.__ptr_, __f, __f);
--__c.__sz();
++base::__sz();
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (_VSTD::addressof(__c) != this) {
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@ -1964,7 +1964,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
}
base::__unlink_nodes(__first, __last);
__link_nodes(__p.__ptr_, __first, __last);
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (_VSTD::addressof(__c) != this) {
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@ -2101,7 +2101,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
++__f1;
}
splice(__e1, __c);
#if _LIBCPP_DEBUG_LEVEL == 2
#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));
@ -2225,7 +2225,7 @@ list<_Tp, _Alloc>::__invariants() const
return size() == _VSTD::distance(begin(), end());
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Alloc>
bool
@ -2255,7 +2255,7 @@ list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
return false;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY

View File

@ -1461,7 +1461,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 = use_facet<numpunct<char_type> >(__iob.getloc());
typedef typename numpunct<char_type>::string_type string_type;
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
string_type __tmp(__v ? __np.truename() : __np.falsename());
string_type __nm = _VSTD::move(__tmp);
#else

View File

@ -197,7 +197,7 @@ concept __span_compatible_range =
is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>>(*)[], _ElementType(*)[]>;
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
#if defined(_LIBCPP_ENABLE_DEBUG_MODE) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
# define _LIBCPP_SPAN_USE_POINTER_ITERATOR
#endif

View File

@ -1450,14 +1450,14 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 void __clear_and_shrink() _NOEXCEPT;
#if _LIBCPP_DEBUG_LEVEL == 2
#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_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
template<class _Alloc>
@ -1840,7 +1840,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX17
void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
{
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
if (!__libcpp_is_constant_evaluated()) {
__c_node* __c = __get_db()->__find_c_and_lock(this);
if (__c)
@ -1862,7 +1862,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
}
#else
(void)__pos;
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
}
template <class _CharT, class _Traits, class _Allocator>
@ -4595,7 +4595,7 @@ inline _LIBCPP_HIDE_FROM_ABI
}
#endif
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template<class _CharT, class _Traits, class _Allocator>
bool
@ -4629,7 +4629,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
return data() <= __p && __p < data() + size();
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
#if _LIBCPP_STD_VER > 11
// Literal suffixes for basic_string [basic.string.literals]

View File

@ -1512,7 +1512,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
@ -1523,7 +1523,7 @@ public:
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
@ -2288,7 +2288,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));}
@ -2299,7 +2299,7 @@ public:
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(_VSTD::addressof(__i->__i_), __n);}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
};

View File

@ -843,7 +843,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(__i);}
@ -854,7 +854,7 @@ public:
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
};
@ -1481,7 +1481,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(__i);}
@ -1492,7 +1492,7 @@ public:
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
};

View File

@ -634,14 +634,14 @@ public:
bool __invariants() const;
#if _LIBCPP_DEBUG_LEVEL == 2
#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_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
private:
pointer __begin_ = nullptr;
@ -1898,7 +1898,7 @@ vector<_Tp, _Allocator>::__invariants() const
return true;
}
#if _LIBCPP_DEBUG_LEVEL == 2
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Allocator>
bool
@ -1930,13 +1930,13 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __
return this->__begin_ <= __p && __p < this->__end_;
}
#endif // _LIBCPP_DEBUG_LEVEL == 2
#endif // _LIBCPP_ENABLE_DEBUG_MODE
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
#if _LIBCPP_DEBUG_LEVEL == 2
#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;

View File

@ -55,6 +55,11 @@ if (CMAKE_CXX_COMPILER_TARGET)
else()
set(triple "${LLVM_DEFAULT_TARGET_TRIPLE}")
endif()
if (LIBCXX_ENABLE_DEBUG_MODE OR LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS)
set(has_debug_symbols ON)
else()
set(has_debug_symbols OFF)
endif()
cxx_abi_list_identifier(abi_list_identifier
"${triple}"
"${LIBCXX_CXX_ABI}"
@ -62,7 +67,7 @@ cxx_abi_list_identifier(abi_list_identifier
"${LIBCXX_ABI_UNSTABLE}"
"${LIBCXX_ENABLE_EXCEPTIONS}"
"${LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS}"
"${LIBCXX_ENABLE_DEBUG_MODE_SUPPORT}"
"${has_debug_symbols}"
"${LIBCXX_ENABLE_INCOMPLETE_FEATURES}"
)

View File

@ -64,7 +64,7 @@ set(LIBCXX_SOURCES
vector.cpp
)
if (LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
if (LIBCXX_ENABLE_DEBUG_MODE OR LIBCXX_ENABLE_BACKWARDS_COMPATIBILITY_DEBUG_MODE_SYMBOLS)
list(APPEND LIBCXX_SOURCES
debug.cpp
legacy_debug_handler.cpp

View File

@ -101,10 +101,6 @@ if (NOT LIBCXX_ENABLE_RTTI)
serialize_lit_param(enable_rtti False)
endif()
if (NOT LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
serialize_lit_param(enable_debug_tests False)
endif()
if (LIBCXX_ENABLE_ASSERTIONS)
serialize_lit_param(enable_assertions True)
endif()

View File

@ -7,7 +7,10 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: debug_level=1
// 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
// <algorithm>
@ -59,7 +62,9 @@ struct NotIncrementableIt {
return *this;
}
friend constexpr NotIncrementableIt operator+(const NotIncrementableIt& it, ptrdiff_t size) { return it.i + size; }
friend constexpr NotIncrementableIt operator+(const NotIncrementableIt& it, difference_type size) { return it.i + size; }
friend constexpr difference_type operator-(const NotIncrementableIt& x, const NotIncrementableIt& y) { return x.i - y.i; }
friend constexpr NotIncrementableIt operator-(const NotIncrementableIt& x, difference_type size) { return NotIncrementableIt(x.i - size); }
};
static_assert(std::__is_cpp17_contiguous_iterator<NotIncrementableIt<S>>::value);

View File

@ -64,7 +64,7 @@ int main(int, char**)
std::make_heap(v.begin(), v.end());
assert(stats.copied == 0);
assert(stats.moved == 153'486);
#ifndef _LIBCPP_DEBUG
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
assert(stats.compared == 188'285);
#endif

View File

@ -65,7 +65,7 @@ int main(int, char**)
std::sort_heap(v.begin(), v.end());
assert(stats.copied == 0);
assert(stats.moved == 1'764'997);
#ifndef _LIBCPP_DEBUG
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
assert(stats.compared == 1'534'701);
#endif

View File

@ -13,8 +13,7 @@
// Make sure __debug_less asserts when the comparator is not consistent.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <algorithm>
#include <iterator>

View File

@ -13,8 +13,7 @@
// __debug_less checks that a comparator actually provides a strict-weak ordering.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <algorithm>
#include <cassert>

View File

@ -10,8 +10,8 @@
// Test std::nth_element stability randomization
// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>

View File

@ -10,8 +10,8 @@
// Test std::partial_sort stability randomization
// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>

View File

@ -10,8 +10,8 @@
// Test std::sort stability randomization
// UNSUPPORTED: libcxx-no-debug-mode, c++03, windows
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
#include <algorithm>
#include <array>

View File

@ -11,8 +11,7 @@
// list(list&& c);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// template <class... Args> void emplace(const_iterator p, Args&&... args);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator position) with iterator from another container
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with various invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -12,8 +12,7 @@
// iterator insert(const_iterator position, Iter first, Iter last);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator position, value_type&& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator position, size_type n, const value_type& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator position, const value_type& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// void splice(const_iterator position, list& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// void splice(const_iterator position, list<T,Allocator>& x, iterator i);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// void splice(const_iterator position, list& x, iterator first, iterator last);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <list>

View File

@ -11,8 +11,7 @@
// Add to iterator out of bounds.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Compare iterators from different containers with <.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>

View File

@ -11,8 +11,7 @@
// Decrement iterator prior to begin.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>

View File

@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Index iterator out of bounds.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Subtract iterators from different containers.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <vector>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -13,8 +13,7 @@
// iterator insert(const_iterator p, P&& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>

View File

@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>

View File

@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>

View File

@ -15,8 +15,7 @@
// void swap(unordered_map& x, unordered_map& y);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -13,8 +13,7 @@
// iterator insert(const_iterator p, P&& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <string>
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <string>

View File

@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>
#include <cassert>

View File

@ -15,8 +15,7 @@
// void swap(unordered_multimap& x, unordered_multimap& y);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_map>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>

View File

@ -15,8 +15,7 @@
// void swap(unordered_multiset& x, unordered_multiset& y);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator position) with invalid iterators
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Call erase(const_iterator first, const_iterator last); with first iterator from another container
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// iterator insert(const_iterator p, const value_type& x);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Increment iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>

View File

@ -11,8 +11,7 @@
// Dereference non-dereferenceable iterator.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -11,8 +11,7 @@
// Increment local_iterator past end.
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>
#include <cassert>

View File

@ -15,8 +15,7 @@
// void swap(unordered_set& x, unordered_set& y);
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
#include <unordered_set>

View File

@ -9,8 +9,7 @@
// UNSUPPORTED: c++11, c++14
// UNSUPPORTED: no-threads
// UNSUPPORTED: libcxx-no-debug-mode, c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03
// test multithreaded container debugging

View File

@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging

View File

@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging

View File

@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging

View File

@ -7,8 +7,7 @@
//===----------------------------------------------------------------------===//
// REQUIRES: has-unix-headers
// UNSUPPORTED: libcxx-no-debug-mode, c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// UNSUPPORTED: !libcpp-has-debug-mode, c++03, c++11, c++14
// test container debugging

View File

@ -0,0 +1,17 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// This test ensures that assertions are enabled by default when the debug mode is enabled.
// REQUIRES: libcpp-has-debug-mode
#include <version>
#if !defined(_LIBCPP_ENABLE_ASSERTIONS) || _LIBCPP_ENABLE_ASSERTIONS == 0
# error "Assertions should be enabled automatically when the debug mode is enabled"
#endif

View File

@ -0,0 +1,21 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// This test ensures that we issue an error if we try to enable the debug mode with
// a library that was not built with support for the debug mode.
// REQUIRES: !libcpp-has-debug-mode
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
// This test fails when modules are enabled because we fail to build module 'std' instead of
// issuing the preprocessor error.
// UNSUPPORTED: modules-build
#include <__debug>
// expected-error@*:* {{Enabling the debug mode now requires having configured the library with support for the debug mode}}

View File

@ -10,7 +10,7 @@
// for members of <locale> even when the debug mode is enabled, which is
// necessary for correctness. See https://llvm.org/D94718 for details.
// UNSUPPORTED: libcxx-no-debug-mode
// UNSUPPORTED: !libcpp-has-debug-mode
// UNSUPPORTED: no-localization
// UNSUPPORTED: cant-build-shared-library
@ -23,8 +23,8 @@
// XFAIL: LIBCXX-AIX-FIXME
// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -shared -o %t.lib
// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -D_LIBCPP_DEBUG=1 -fvisibility=hidden -o %t.exe
// RUN: %{cxx} %{flags} %{compile_flags} %s %{link_flags} -fPIC -DTU1 -fvisibility=hidden -shared -o %t.lib
// RUN: cd %T && %{cxx} %{flags} %{compile_flags} %s ./%basename_t.tmp.lib %{link_flags} -DTU2 -fvisibility=hidden -o %t.exe
// RUN: %{exec} %t.exe
#include <cassert>

Some files were not shown because too many files have changed in this diff Show More