aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx/include/__hash_table
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__hash_table')
-rw-r--r--contrib/llvm-project/libcxx/include/__hash_table86
1 files changed, 36 insertions, 50 deletions
diff --git a/contrib/llvm-project/libcxx/include/__hash_table b/contrib/llvm-project/libcxx/include/__hash_table
index 126e1884a664..adc732cffb01 100644
--- a/contrib/llvm-project/libcxx/include/__hash_table
+++ b/contrib/llvm-project/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
@@ -310,9 +308,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator=(const __hash_iterator& __i)
{
- if (this != &__i)
+ if (this != _VSTD::addressof(__i))
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
__node_ = __i.__node_;
}
return *this;
@@ -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
@@ -410,7 +406,7 @@ public:
: __node_(__x.__node_)
{
#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__iterator_copy(this, &__x);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__x));
#endif
}
@@ -419,7 +415,7 @@ public:
__hash_const_iterator(const __hash_const_iterator& __i)
: __node_(__i.__node_)
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
}
_LIBCPP_INLINE_VISIBILITY
@@ -431,9 +427,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator=(const __hash_const_iterator& __i)
{
- if (this != &__i)
+ if (this != _VSTD::addressof(__i))
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
__node_ = __i.__node_;
}
return *this;
@@ -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
@@ -529,7 +523,7 @@ public:
__bucket_(__i.__bucket_),
__bucket_count_(__i.__bucket_count_)
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
}
_LIBCPP_INLINE_VISIBILITY
@@ -541,9 +535,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator& operator=(const __hash_local_iterator& __i)
{
- if (this != &__i)
+ if (this != _VSTD::addressof(__i))
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
__node_ = __i.__node_;
__bucket_ = __i.__bucket_;
__bucket_count_ = __i.__bucket_count_;
@@ -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
@@ -663,7 +655,7 @@ public:
__bucket_count_(__x.__bucket_count_)
{
#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->__iterator_copy(this, &__x);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__x));
#endif
}
@@ -674,7 +666,7 @@ public:
__bucket_(__i.__bucket_),
__bucket_count_(__i.__bucket_count_)
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
}
_LIBCPP_INLINE_VISIBILITY
@@ -686,9 +678,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator& operator=(const __hash_const_local_iterator& __i)
{
- if (this != &__i)
+ if (this != _VSTD::addressof(__i))
{
- __get_db()->__iterator_copy(this, &__i);
+ __get_db()->__iterator_copy(this, _VSTD::addressof(__i));
__node_ = __i.__node_;
__bucket_ = __i.__bucket_;
__bucket_count_ = __i.__bucket_count_;
@@ -1623,7 +1615,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__u.size() = 0;
}
#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, &__u);
+ __get_db()->swap(this, _VSTD::addressof(__u));
#endif
}
@@ -2029,11 +2021,9 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__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(_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_;
@@ -2158,11 +2148,9 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__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(_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();
@@ -2484,12 +2472,12 @@ 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_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 +2492,12 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__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(_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;
@@ -2741,7 +2727,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
__u.__p1_.first().__ptr();
#if _LIBCPP_DEBUG_LEVEL == 2
- __get_db()->swap(this, &__u);
+ __get_db()->swap(this, _VSTD::addressof(__u));
#endif
}