[libcxx-commits] [libcxx] [libc++] Refactor vector's ASan annotations to only ever delete and add the annotations (PR #152967)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 11 01:08:29 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h -- libcxx/include/__vector/vector.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h
index b9b8c654b..8d39a5047 100644
--- a/libcxx/include/__vector/vector.h
+++ b/libcxx/include/__vector/vector.h
@@ -830,7 +830,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) {
__annotate_delete();
- auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
+ auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
auto __new_begin = __v.__begin_ - (__end_ - __begin_);
std::__uninitialized_allocator_relocate(
this->__alloc_, std::__to_address(__begin_), std::__to_address(__end_), std::__to_address(__new_begin));
@@ -850,7 +850,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 typename vector<_Tp, _Allocator>::pointer
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) {
__annotate_delete();
- auto __guard = std::__make_scope_guard(__annotate_new_size(size()));
+ auto __guard = std::__make_scope_guard(__annotate_new_size(size()));
pointer __ret = __v.__begin_;
// Relocate [__p, __end_) first to avoid having a hole in [__begin_, __end_)
@@ -935,7 +935,7 @@ template <class _InputIterator, class _Sentinel>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
vector<_Tp, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel __last, size_type __n) {
auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
- __end_ = std::__uninitialized_allocator_copy(this->__alloc_, std::move(__first), std::move(__last), __end_);
+ __end_ = std::__uninitialized_allocator_copy(this->__alloc_, std::move(__first), std::move(__last), __end_);
}
// Default constructs __n objects starting at __end_
@@ -1174,7 +1174,7 @@ template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) {
__annotate_delete();
- auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
+ auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
pointer __old_last = this->__end_;
difference_type __n = __old_last - __to;
``````````
</details>
https://github.com/llvm/llvm-project/pull/152967
More information about the libcxx-commits
mailing list