[libc++] Introduce __debug_db_insert_i()

Introduce `__debug_db_insert_i()`

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D117410
This commit is contained in:
Nikolas Klauser 2022-01-17 19:25:21 +01:00
parent 0e03c62b4c
commit caf5548c7c
4 changed files with 17 additions and 22 deletions

View File

@ -279,6 +279,16 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_inser
#endif
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 inline void __debug_db_insert_i(_Tp* __i) {
#if _LIBCPP_DEBUG_LEVEL == 2
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_i(__i);
#else
(void)(__i);
#endif
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_DEBUG_H

View File

@ -288,9 +288,7 @@ public:
typedef typename _NodeTypes::__node_value_type_pointer pointer;
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
@ -400,9 +398,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
_LIBCPP_INLINE_VISIBILITY
@ -517,9 +513,7 @@ public:
typedef typename _NodeTypes::__node_value_type_pointer pointer;
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
@ -651,9 +645,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
_LIBCPP_INLINE_VISIBILITY

View File

@ -43,10 +43,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 __wrap_iter() _NOEXCEPT
: __i()
{
#if _LIBCPP_DEBUG_LEVEL == 2
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
template <class _Up> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
__wrap_iter(const __wrap_iter<_Up>& __u,

View File

@ -319,9 +319,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__list_iterator() _NOEXCEPT : __ptr_(nullptr)
{
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
#if _LIBCPP_DEBUG_LEVEL == 2
@ -431,9 +429,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
{
#if _LIBCPP_DEBUG_LEVEL == 2
__get_db()->__insert_i(this);
#endif
_VSTD::__debug_db_insert_i(this);
}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT