[libcxx-commits] [libcxx] 96100f1 - [libcxx] NFC. Correct wordings of _LIBCPP_ASSERT debug messages

Kristina Bessonova via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 12 04:51:11 PDT 2021


Author: Kristina Bessonova
Date: 2021-05-12T13:49:57+02:00
New Revision: 96100f15082679b2c75c7744b8eb4fc87fcf71f5

URL: https://github.com/llvm/llvm-project/commit/96100f15082679b2c75c7744b8eb4fc87fcf71f5
DIFF: https://github.com/llvm/llvm-project/commit/96100f15082679b2c75c7744b8eb4fc87fcf71f5.diff

LOG: [libcxx] NFC. Correct wordings of _LIBCPP_ASSERT debug messages

Differential Revision: https://reviews.llvm.org/D102195

Added: 
    

Modified: 
    libcxx/include/__hash_table
    libcxx/include/deque
    libcxx/include/iterator
    libcxx/include/list
    libcxx/include/optional
    libcxx/include/vector

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 357237631c8f..c885ee0190a7 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -336,7 +336,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     __hash_iterator& operator++() {
         _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
-                       "Attempted to increment non-incrementable unordered container iterator");
+                       "Attempted to increment a non-incrementable unordered container iterator");
         __node_ = __node_->__next_;
         return *this;
     }
@@ -456,7 +456,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     __hash_const_iterator& operator++() {
         _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
-                             "Attempted to increment non-incrementable unordered container const_iterator");
+                             "Attempted to increment a non-incrementable unordered container const_iterator");
         __node_ = __node_->__next_;
         return *this;
     }
@@ -569,7 +569,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     __hash_local_iterator& operator++() {
         _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
-                       "Attempted to increment non-incrementable unordered container local_iterator");
+                       "Attempted to increment a non-incrementable unordered container local_iterator");
         __node_ = __node_->__next_;
         if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
             __node_ = nullptr;
@@ -714,7 +714,7 @@ public:
     _LIBCPP_INLINE_VISIBILITY
     __hash_const_local_iterator& operator++() {
         _LIBCPP_DEBUG_ASSERT(__get_const_db()->__dereferenceable(this),
-                       "Attempted to increment non-incrementable unordered container const_local_iterator");
+                       "Attempted to increment a non-incrementable unordered container const_local_iterator");
         __node_ = __node_->__next_;
         if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
             __node_ = nullptr;

diff  --git a/libcxx/include/deque b/libcxx/include/deque
index 83575c33f390..571c061bd58f 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -2721,7 +2721,7 @@ template <class _Tp, class _Allocator>
 void
 deque<_Tp, _Allocator>::pop_back()
 {
-    _LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");
+    _LIBCPP_ASSERT(!empty(), "deque::pop_back called on an empty deque");
     allocator_type& __a = __base::__alloc();
     size_type __p = __base::size() + __base::__start_ - 1;
     __alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() +

diff  --git a/libcxx/include/iterator b/libcxx/include/iterator
index 687c641417c6..6bc98ecb6774 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -1362,7 +1362,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
-                       "Attempted to increment non-incrementable iterator");
+                       "Attempted to increment a non-incrementable iterator");
 #endif
         ++__i;
         return *this;
@@ -1374,7 +1374,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
-                       "Attempted to decrement non-decrementable iterator");
+                       "Attempted to decrement a non-decrementable iterator");
 #endif
         --__i;
         return *this;
@@ -1387,7 +1387,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
-                   "Attempted to add/subtract iterator outside of valid range");
+                   "Attempted to add/subtract an iterator outside its valid range");
 #endif
         __i += __n;
         return *this;
@@ -1400,7 +1400,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
-                   "Attempted to subscript iterator outside of valid range");
+                   "Attempted to subscript an iterator outside its valid range");
 #endif
         return __i[__n];
     }

diff  --git a/libcxx/include/list b/libcxx/include/list
index db1b3674b7b1..7be38c63f11a 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -377,7 +377,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
-                       "Attempted to increment non-incrementable list::iterator");
+                       "Attempted to increment a non-incrementable list::iterator");
 #endif
         __ptr_ = __ptr_->__next_;
         return *this;
@@ -390,7 +390,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
-                       "Attempted to decrement non-decrementable list::iterator");
+                       "Attempted to decrement a non-decrementable list::iterator");
 #endif
         __ptr_ = __ptr_->__prev_;
         return *this;
@@ -504,7 +504,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
-                       "Attempted to increment non-incrementable list::const_iterator");
+                       "Attempted to increment a non-incrementable list::const_iterator");
 #endif
         __ptr_ = __ptr_->__next_;
         return *this;
@@ -517,7 +517,7 @@ public:
     {
 #if _LIBCPP_DEBUG_LEVEL == 2
         _LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
-                       "Attempted to decrement non-decrementable list::const_iterator");
+                       "Attempted to decrement a non-decrementable list::const_iterator");
 #endif
         __ptr_ = __ptr_->__prev_;
         return *this;
@@ -1772,7 +1772,7 @@ template <class _Tp, class _Alloc>
 void
 list<_Tp, _Alloc>::pop_back()
 {
-    _LIBCPP_ASSERT(!empty(), "list::pop_back() called with empty list");
+    _LIBCPP_ASSERT(!empty(), "list::pop_back() called on an empty list");
     __node_allocator& __na = base::__node_alloc();
     __link_pointer __n = base::__end_.__prev_;
     base::__unlink_nodes(__n, __n);
@@ -2049,14 +2049,14 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
 {
 #if _LIBCPP_DEBUG_LEVEL == 2
     _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
-        "list::splice(iterator, list, iterator) called with first iterator not"
-        " referring to this list");
+        "list::splice(iterator, list, iterator) called with the first iterator"
+        " not referring to this list");
     _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__i) == &__c,
-        "list::splice(iterator, list, iterator) called with second iterator not"
-        " referring to list argument");
+        "list::splice(iterator, list, iterator) called with the second iterator"
+        " not referring to list argument");
     _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(&__i),
-        "list::splice(iterator, list, iterator) called with second iterator not"
-        " dereferenceable");
+        "list::splice(iterator, list, iterator) called with the second iterator"
+        " not dereferenceable");
 #endif
     if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
     {

diff  --git a/libcxx/include/optional b/libcxx/include/optional
index 0c2fc8d9912c..e4f3938e752e 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -878,7 +878,7 @@ public:
     add_pointer_t<value_type const>
     operator->() const
     {
-        _LIBCPP_ASSERT(this->has_value(), "optional operator-> called for disengaged value");
+        _LIBCPP_ASSERT(this->has_value(), "optional operator-> called on a disengaged value");
 #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
         return _VSTD::addressof(this->__get());
 #else
@@ -891,7 +891,7 @@ public:
     add_pointer_t<value_type>
     operator->()
     {
-        _LIBCPP_ASSERT(this->has_value(), "optional operator-> called for disengaged value");
+        _LIBCPP_ASSERT(this->has_value(), "optional operator-> called on a disengaged value");
 #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
         return _VSTD::addressof(this->__get());
 #else
@@ -904,7 +904,7 @@ public:
     const value_type&
     operator*() const&
     {
-        _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
+        _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value");
         return this->__get();
     }
 
@@ -913,7 +913,7 @@ public:
     value_type&
     operator*() &
     {
-        _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
+        _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value");
         return this->__get();
     }
 
@@ -922,7 +922,7 @@ public:
     value_type&&
     operator*() &&
     {
-        _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
+        _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value");
         return _VSTD::move(this->__get());
     }
 
@@ -931,7 +931,7 @@ public:
     const value_type&&
     operator*() const&&
     {
-        _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value");
+        _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value");
         return _VSTD::move(this->__get());
     }
 

diff  --git a/libcxx/include/vector b/libcxx/include/vector
index 7ab97fadcee5..6ee377b6fb3f 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -674,22 +674,22 @@ public:
 
     _LIBCPP_INLINE_VISIBILITY reference       front() _NOEXCEPT
     {
-        _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
+        _LIBCPP_ASSERT(!empty(), "front() called on an empty vector");
         return *this->__begin_;
     }
     _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT
     {
-        _LIBCPP_ASSERT(!empty(), "front() called for empty vector");
+        _LIBCPP_ASSERT(!empty(), "front() called on an empty vector");
         return *this->__begin_;
     }
     _LIBCPP_INLINE_VISIBILITY reference       back() _NOEXCEPT
     {
-        _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
+        _LIBCPP_ASSERT(!empty(), "back() called on an empty vector");
         return *(this->__end_ - 1);
     }
     _LIBCPP_INLINE_VISIBILITY const_reference back()  const _NOEXCEPT
     {
-        _LIBCPP_ASSERT(!empty(), "back() called for empty vector");
+        _LIBCPP_ASSERT(!empty(), "back() called on an empty vector");
         return *(this->__end_ - 1);
     }
 
@@ -1698,7 +1698,7 @@ inline
 void
 vector<_Tp, _Allocator>::pop_back()
 {
-    _LIBCPP_ASSERT(!empty(), "vector::pop_back called for empty vector");
+    _LIBCPP_ASSERT(!empty(), "vector::pop_back called on an empty vector");
     this->__destruct_at_end(this->__end_ - 1);
 }
 


        


More information about the libcxx-commits mailing list