[libcxx-commits] [libcxx] caf5548 - [libc++] Introduce __debug_db_insert_i()
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 17 11:32:52 PST 2022
Author: Nikolas Klauser
Date: 2022-01-17T20:31:21+01:00
New Revision: caf5548c7cc68c701bb040d84b6f21f9aef4ae01
URL: https://github.com/llvm/llvm-project/commit/caf5548c7cc68c701bb040d84b6f21f9aef4ae01
DIFF: https://github.com/llvm/llvm-project/commit/caf5548c7cc68c701bb040d84b6f21f9aef4ae01.diff
LOG: [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
Added:
Modified:
libcxx/include/__debug
libcxx/include/__hash_table
libcxx/include/__iterator/wrap_iter.h
libcxx/include/list
Removed:
################################################################################
diff --git a/libcxx/include/__debug b/libcxx/include/__debug
index 29c51b2f2f4b7..a1e21a703224a 100644
--- a/libcxx/include/__debug
+++ b/libcxx/include/__debug
@@ -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
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index ba5027992512b..6b682ab27c6c3 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -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
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 1408c673bc610..d9dbee5888969 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -43,10 +43,7 @@ class __wrap_iter
_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,
diff --git a/libcxx/include/list b/libcxx/include/list
index 004b445831c8f..258fe2cee727f 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -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
More information about the libcxx-commits
mailing list