summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-12-28 05:53:01 +0000
committerEric Fiselier <eric@efcs.ca>2016-12-28 05:53:01 +0000
commit780b51df1de3edc87c988964de00971d646c8c19 (patch)
tree260a6c7f42857715ace00f03b01b36c212733977 /libcxx/include
parent14bd0bf00811bd1a151c6559a14b53cd0c039b68 (diff)
downloadbcm5719-llvm-780b51df1de3edc87c988964de00971d646c8c19.tar.gz
bcm5719-llvm-780b51df1de3edc87c988964de00971d646c8c19.zip
Add tests for unordered container tests and std::string
llvm-svn: 290655
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/__hash_table24
-rw-r--r--libcxx/include/string12
-rw-r--r--libcxx/include/unordered_map2
3 files changed, 23 insertions, 15 deletions
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 2653afb8d00..9a0d441b37b 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -1181,7 +1181,7 @@ public:
void swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
+ _NOEXCEPT_DEBUG_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
@@ -1189,7 +1189,7 @@ public:
|| __is_nothrow_swappable<__node_allocator>::value)
);
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+ _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
#endif
_LIBCPP_INLINE_VISIBILITY
@@ -2408,15 +2408,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
--size();
#if _LIBCPP_DEBUG_LEVEL >= 2
__c_node* __c = __get_db()->__find_c_and_lock(this);
- for (__i_node** __p = __c->end_; __p != __c->beg_; )
+ for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
{
- --__p;
- iterator* __i = static_cast<iterator*>((*__p)->__i_);
+ --__dp;
+ iterator* __i = static_cast<iterator*>((*__dp)->__i_);
if (__i->__node_ == __cn)
{
- (*__p)->__c_ = nullptr;
- if (--__c->end_ != __p)
- memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
+ (*__dp)->__c_ = nullptr;
+ if (--__c->end_ != __dp)
+ memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*));
}
}
__get_db()->unlock();
@@ -2524,7 +2524,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(
+ _NOEXCEPT_DEBUG_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
@@ -2532,9 +2532,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|| __is_nothrow_swappable<__node_allocator>::value)
)
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+ _NOEXCEPT_DEBUG_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
#endif
{
+ _LIBCPP_ASSERT(__node_traits::propagate_on_container_swap::value ||
+ this->__node_alloc() == __u.__node_alloc(),
+ "list::swap: Either propagate_on_container_swap must be true"
+ " or the allocators must compare equal");
{
__node_pointer_pointer __npp = __bucket_list_.release();
__bucket_list_.reset(__u.__bucket_list_.release());
diff --git a/libcxx/include/string b/libcxx/include/string
index 2e5ffc1b6d0..98f538c38a0 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1105,9 +1105,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
void swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT;
+ _NOEXCEPT_DEBUG;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
+ _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
#endif
@@ -2996,9 +2996,9 @@ inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
+ _NOEXCEPT_DEBUG
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
+ _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value)
#endif
{
@@ -3009,6 +3009,10 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
__get_db()->__invalidate_all(&__str);
__get_db()->swap(this, &__str);
#endif
+ _LIBCPP_ASSERT(
+ __alloc_traits::propagate_on_container_swap::value ||
+ __alloc_traits::is_always_equal::value ||
+ __alloc() == __str.__alloc(), "swapping non-equal allocators");
_VSTD::swap(__r_.first(), __str.__r_.first());
__swap_allocator(__alloc(), __str.__alloc());
}
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 50be81e461f..dc8db808519 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1099,7 +1099,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_map& __u)
_NOEXCEPT_(__is_nothrow_swappable<__table>::value)
- {__table_.swap(__u.__table_);}
+ { __table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const
OpenPOWER on IntegriCloud