[libcxx-commits] [PATCH] D116347: [libc++] Use _LIBCPP_DEBUG_ASSERT in __iterator/wrap_iter.h
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 3 15:23:16 PST 2022
philnik updated this revision to Diff 397154.
philnik added a comment.
Poke CI
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116347/new/
https://reviews.llvm.org/D116347
Files:
libcxx/include/__hash_table
Index: libcxx/include/__hash_table
===================================================================
--- libcxx/include/__hash_table
+++ libcxx/include/__hash_table
@@ -2029,11 +2029,9 @@
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
const_iterator __p, __node_pointer __cp)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
- "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
- " referring to this unordered container");
-#endif
+ _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__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_;
@@ -2158,11 +2156,9 @@
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
const_iterator __p, _Args&&... __args)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
- "unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
- " referring to this unordered container");
-#endif
+ _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__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();
@@ -2484,12 +2480,12 @@
__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(&__p) == this,
+ "unordered container erase(iterator) called with an iterator not"
+ " referring to this container");
+ _LIBCPP_DEBUG_ASSERT(__p != end(),
+ "unordered container erase(iterator) called with a non-dereferenceable iterator");
#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
- "unordered container erase(iterator) called with an iterator not"
- " referring to this container");
- _LIBCPP_ASSERT(__p != end(),
- "unordered container erase(iterator) called with a non-dereferenceable iterator");
iterator __r(__np, this);
#else
iterator __r(__np);
@@ -2504,14 +2500,12 @@
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
const_iterator __last)
{
-#if _LIBCPP_DEBUG_LEVEL == 2
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
- "unordered container::erase(iterator, iterator) called with an iterator not"
- " referring to this container");
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__last) == this,
- "unordered container::erase(iterator, iterator) called with an iterator not"
- " referring to this container");
-#endif
+ _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__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(&__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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116347.397154.patch
Type: text/x-patch
Size: 3849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220103/9231ee0c/attachment-0001.bin>
More information about the libcxx-commits
mailing list