diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -1238,7 +1238,7 @@ private: _LIBCPP_INLINE_VISIBILITY - __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT + explicit __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT : __seg_(__s), __ctz_(__ctz) {} friend typename _Cp::__self; diff --git a/libcxx/include/iterator b/libcxx/include/iterator --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -1737,14 +1737,14 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;} private: -#if _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(const void* __p, iterator_type __x) : __i(__x) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG explicit __wrap_iter(iterator_type __x, const void* __c) : __i(__x) { - __get_db()->__insert_ic(this, __p); - } +#if _LIBCPP_DEBUG_LEVEL == 2 + __get_db()->__insert_ic(this, __c); #else - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} + (void)__c; #endif + } template friend class __wrap_iter; template friend class basic_string; diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -293,19 +293,16 @@ __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); - } #else - _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} + (void)__c; #endif - - + } template friend class list; template friend class __list_imp; @@ -416,17 +413,16 @@ __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); - } #else - _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} + (void)__c; #endif + } template friend class list; template friend class __list_imp; @@ -614,38 +610,22 @@ _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__end_.__next_, this); -#else - return iterator(__end_.__next_); -#endif } _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__end_.__next_, this); -#else - return const_iterator(__end_.__next_); -#endif } _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__end_as_link(), this); -#else - return iterator(__end_as_link()); -#endif } _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__end_as_link(), this); -#else - return const_iterator(__end_as_link()); -#endif } void swap(__list_imp& __c) @@ -1459,11 +1439,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__hold.release()->__as_link(), this); -#else - return iterator(__hold.release()->__as_link()); -#endif } template @@ -1474,10 +1450,8 @@ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, "list::insert(iterator, n, x) called with an iterator not" " referring to this list"); - iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); #endif + iterator __r(__p.__ptr_, this); if (__n > 0) { size_type __ds = 0; @@ -1485,11 +1459,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 __r = iterator(__hold->__as_link(), this); -#else - __r = iterator(__hold->__as_link()); -#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1515,11 +1485,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1540,10 +1506,8 @@ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, "list::insert(iterator, range) called with an iterator not" " referring to this list"); - iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); #endif + iterator __r(__p.__ptr_, this); if (__f != __l) { size_type __ds = 0; @@ -1551,11 +1515,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 __r = iterator(__hold.get()->__as_link(), this); -#else - __r = iterator(__hold.get()->__as_link()); -#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1581,11 +1541,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1707,11 +1663,7 @@ __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nl, this); -#else - return iterator(__nl); -#endif } template @@ -1730,11 +1682,7 @@ __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nl, this); -#else - return iterator(__nl); -#endif } #endif // _LIBCPP_CXX03_LANG @@ -1831,11 +1779,7 @@ __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__r, this); -#else - return iterator(__r); -#endif } template @@ -1879,11 +1823,7 @@ __node_alloc_traits::deallocate(__na, __np, 1); } } -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__l.__ptr_, this); -#else - return iterator(__l.__ptr_); -#endif } template @@ -1900,11 +1840,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r = iterator(__hold.release()->__as_link(), this); -#else - iterator __r = iterator(__hold.release()->__as_link()); -#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1929,11 +1865,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1958,11 +1890,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; __link_pointer __nl = __hold.release()->__as_link(); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r = iterator(__nl, this); -#else - iterator __r = iterator(__nl); -#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1987,11 +1915,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -344,8 +344,8 @@ _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data(), this); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size(), this); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } @@ -357,7 +357,6 @@ private: pointer __data; - }; @@ -503,8 +502,8 @@ _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data(), this); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size(), this); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -920,33 +920,18 @@ _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);} basic_string& operator=(value_type __c); -#if _LIBCPP_DEBUG_LEVEL == 2 - _LIBCPP_INLINE_VISIBILITY - iterator begin() _NOEXCEPT - {return iterator(this, __get_pointer());} - _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const _NOEXCEPT - {return const_iterator(this, __get_pointer());} - _LIBCPP_INLINE_VISIBILITY - iterator end() _NOEXCEPT - {return iterator(this, __get_pointer() + size());} - _LIBCPP_INLINE_VISIBILITY - const_iterator end() const _NOEXCEPT - {return const_iterator(this, __get_pointer() + size());} -#else _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT - {return iterator(__get_pointer());} + {return iterator(__get_pointer(), this);} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT - {return const_iterator(__get_pointer());} + {return const_iterator(__get_pointer(), this);} _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT - {return iterator(__get_pointer() + size());} + {return iterator(__get_pointer() + size(), this);} _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT - {return const_iterator(__get_pointer() + size());} -#endif // _LIBCPP_DEBUG_LEVEL == 2 + {return const_iterator(__get_pointer() + size(), this);} _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} @@ -1780,11 +1765,7 @@ template inline void -basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type -#if _LIBCPP_DEBUG_LEVEL == 2 - __pos -#endif - ) +basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) { #if _LIBCPP_DEBUG_LEVEL == 2 __c_node* __c = __get_db()->__find_c_and_lock(this); @@ -1804,6 +1785,8 @@ } __get_db()->unlock(); } +#else + (void)__pos; #endif // _LIBCPP_DEBUG_LEVEL == 2 } diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -1491,11 +1491,7 @@ typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(this, __p); -#else - return iterator(__p); -#endif + return iterator(__p, this); } template @@ -1503,11 +1499,7 @@ typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 - return const_iterator(this, __p); -#else - return const_iterator(__p); -#endif + return const_iterator(__p, this); } template