aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include
diff options
context:
space:
mode:
authorhalyavin <halyavin@yandex-team.com>2022-08-05 13:16:26 +0300
committerhalyavin <halyavin@yandex-team.com>2022-08-05 13:16:26 +0300
commit68d8479d07e0b689ba126cf2c159ae7f11afb9cf (patch)
tree92289178ebded927b8369e4eb1c931be730c6333 /contrib/libs/cxxsupp/libcxx/include
parentf346528af256244b692e713a8b6891957ae58dc6 (diff)
downloadydb-68d8479d07e0b689ba126cf2c159ae7f11afb9cf.tar.gz
Mark clear and reset methods as reinitializing the object.
This means, that moved-from object can be safely used after the call of such method. This attribute is used by clang-tidy which checks that moved-from objects are not used unless a reinitialization method is called first.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__config6
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/deque3
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/map4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/set4
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/vector4
5 files changed, 14 insertions, 7 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__config b/contrib/libs/cxxsupp/libcxx/include/__config
index 1984c01ed73..3f383a82d01 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__config
+++ b/contrib/libs/cxxsupp/libcxx/include/__config
@@ -1325,6 +1325,12 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_FALLTHROUGH() ((void)0)
#endif
+#if defined(_LIBCPP_COMPILER_CLANG_BASED)
+# define _LIBCPP_REINITIALIZES_OBJECT [[clang::reinitializes]]
+#else
+# define _LIBCPP_REINITIALIZES_OBJECT
+#endif
+
#if __has_attribute(__nodebug__) && !defined(__CUDACC__)
#define _LIBCPP_NODEBUG __attribute__((__nodebug__))
#else
diff --git a/contrib/libs/cxxsupp/libcxx/include/deque b/contrib/libs/cxxsupp/libcxx/include/deque
index 50a8b381534..a4ab230742f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/deque
+++ b/contrib/libs/cxxsupp/libcxx/include/deque
@@ -1467,7 +1467,7 @@ public:
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@@ -2948,6 +2948,7 @@ deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
+_LIBCPP_REINITIALIZES_OBJECT
inline
void
deque<_Tp, _Allocator>::clear() _NOEXCEPT
diff --git a/contrib/libs/cxxsupp/libcxx/include/map b/contrib/libs/cxxsupp/libcxx/include/map
index aaf4b616209..d6a5ad1fa4b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/map
+++ b/contrib/libs/cxxsupp/libcxx/include/map
@@ -1370,7 +1370,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f.__i_, __l.__i_);}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();}
#if _LIBCPP_STD_VER > 14
@@ -2112,7 +2112,7 @@ public:
}
#endif
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
diff --git a/contrib/libs/cxxsupp/libcxx/include/set b/contrib/libs/cxxsupp/libcxx/include/set
index 04b6f52c084..99a061a0387 100644
--- a/contrib/libs/cxxsupp/libcxx/include/set
+++ b/contrib/libs/cxxsupp/libcxx/include/set
@@ -745,7 +745,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();}
#if _LIBCPP_STD_VER > 14
@@ -1276,7 +1276,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();}
#if _LIBCPP_STD_VER > 14
diff --git a/contrib/libs/cxxsupp/libcxx/include/vector b/contrib/libs/cxxsupp/libcxx/include/vector
index 916eaa75b63..1a2a271058b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/vector
+++ b/contrib/libs/cxxsupp/libcxx/include/vector
@@ -637,7 +637,7 @@ public:
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{
size_type __old_size = size();
@@ -2352,7 +2352,7 @@ public:
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_REINITIALIZES_OBJECT _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__size_ = 0;}
void swap(vector&)