[libcxx-commits] [libcxx] [ASan][libc++] std::basic_string annotations (PR #72677)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 17 09:01:43 PST 2023
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 764c3afd43128f7ccddb070953c330b340ebe811 3ffdc6b5e2ae6a073ce65c0c0f4f7bb37e062f0b -- libcxx/test/std/strings/basic.string/string.capacity/reserve_size.asan.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.asan.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.asan.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/capacity.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/default.pass.cpp libcxx/test/std/strings/basic.string/string.cons/initializer_list.pass.cpp libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp libcxx/test/std/strings/basic.string/string.cons/string_view.pass.cpp libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/initializer_list.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
index 7c33f7b5dc..7fa5cd43b8 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/clear.pass.cpp
@@ -21,7 +21,7 @@ template <class S>
TEST_CONSTEXPR_CXX20 void test(S s) {
s.clear();
assert(s.size() == 0);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
index 31b66c3fb3..4748890626 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -34,7 +34,7 @@ void test(typename S::size_type min_cap, typename S::size_type erased_index) {
assert(s == s0);
assert(s.capacity() <= old_cap);
assert(s.capacity() >= s.size());
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
index 5f9c3febc9..7cf4b7ca3b 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
@@ -20,14 +20,12 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, S expected) {
-
- if (n <= s.max_size())
- {
- s.resize(n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ if (n <= s.max_size()) {
+ s.resize(n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index 31f047c6b5..e871b58b8c 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -20,14 +20,12 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_type c, S expected) {
-
- if (n <= s.max_size())
- {
- s.resize(n, c);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ if (n <= s.max_size()) {
+ s.resize(n, c);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
index ac897f1165..57f6b49eaf 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp
@@ -26,7 +26,7 @@ TEST_CONSTEXPR_CXX20 void test(S s) {
assert(s == s0);
assert(s.capacity() <= old_cap);
assert(s.capacity() >= s.size());
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
@@ -43,7 +43,7 @@ TEST_CONSTEXPR_CXX20 void test_string() {
test(s);
s.assign(100, 'a');
- for(int i = 0; i < 90; ++i)
+ for (int i = 0; i < 90; ++i)
s.erase(1);
test(s);
}
diff --git a/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
index 5d595746f8..4d46e578ce 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
@@ -27,22 +27,20 @@
template <class S, class SV>
TEST_CONSTEXPR_CXX20 void test(SV sv, std::size_t pos, std::size_t n) {
-
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- typedef typename S::size_type Size;
- if (pos <= sv.size())
- {
- S s2(sv, static_cast<Size>(pos), static_cast<Size>(n));
- LIBCPP_ASSERT(s2.__invariants());
- assert(pos <= sv.size());
- std::size_t rlen = std::min(sv.size() - pos, n);
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
- }
+ typedef typename S::traits_type T;
+ typedef typename S::allocator_type A;
+ typedef typename S::size_type Size;
+ if (pos <= sv.size()) {
+ S s2(sv, static_cast<Size>(pos), static_cast<Size>(n));
+ LIBCPP_ASSERT(s2.__invariants());
+ assert(pos <= sv.size());
+ std::size_t rlen = std::min(sv.size() - pos, n);
+ assert(s2.size() == rlen);
+ assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0);
+ assert(s2.get_allocator() == A());
+ assert(s2.capacity() >= s2.size());
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
index 46a2d94369..91beac3776 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/alloc.pass.cpp
@@ -33,8 +33,8 @@ TEST_CONSTEXPR_CXX20 void test() {
assert(s.capacity() >= s.size());
assert(s.get_allocator() == typename S::allocator_type());
LIBCPP_ASSERT(is_string_asan_correct(s));
- }
- {
+ }
+ {
#if TEST_STD_VER > 14
static_assert((noexcept(S{typename S::allocator_type{}})), "");
#elif TEST_STD_VER >= 11
@@ -48,8 +48,8 @@ TEST_CONSTEXPR_CXX20 void test() {
assert(s.size() == 0);
assert(s.capacity() >= s.size());
assert(s.get_allocator() == typename S::allocator_type(5));
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
}
#if TEST_STD_VER >= 11
@@ -68,22 +68,24 @@ TEST_CONSTEXPR_CXX20 void test2() {
assert(s.size() == 0);
assert(s.capacity() >= s.size());
assert(s.get_allocator() == typename S::allocator_type());
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
- {
-#if TEST_STD_VER > 14
- static_assert((noexcept(S{typename S::allocator_type{}})), "" );
-#elif TEST_STD_VER >= 11
- static_assert((noexcept(S(typename S::allocator_type())) == std::is_nothrow_copy_constructible<typename S::allocator_type>::value), "" );
-#endif
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
+ {
+# if TEST_STD_VER > 14
+ static_assert((noexcept(S{typename S::allocator_type{}})), "");
+# elif TEST_STD_VER >= 11
+ static_assert((noexcept(S(typename S::allocator_type())) ==
+ std::is_nothrow_copy_constructible<typename S::allocator_type>::value),
+ "");
+# endif
S s(typename S::allocator_type{});
LIBCPP_ASSERT(s.__invariants());
assert(s.data());
assert(s.size() == 0);
assert(s.capacity() >= s.size());
assert(s.get_allocator() == typename S::allocator_type());
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
}
#endif
diff --git a/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
index c011f07840..caf5b65a7c 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/char_assignment.pass.cpp
@@ -25,7 +25,7 @@ TEST_CONSTEXPR_CXX20 void test(S s1, typename S::value_type s2) {
assert(s1.size() == 1);
assert(T::eq(s1[0], s2));
assert(s1.capacity() >= s1.size());
- LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
index 607adec058..f65f8e97c9 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy.pass.cpp
@@ -25,8 +25,8 @@ TEST_CONSTEXPR_CXX20 void test(S s1) {
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == s1.get_allocator());
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
index aa8c1408e8..ba4d4bac29 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp
@@ -84,8 +84,8 @@ TEST_CONSTEXPR_CXX20 void test(S s1, const typename S::allocator_type& a) {
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == a);
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
index cfc9f66b58..9f4213b3fd 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/copy_assignment.pass.cpp
@@ -24,8 +24,8 @@ TEST_CONSTEXPR_CXX20 void test(S s1, const S& s2) {
LIBCPP_ASSERT(s1.__invariants());
assert(s1 == s2);
assert(s1.capacity() >= s1.size());
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
index 0ef13412ad..af565cf18e 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/initializer_list_assignment.pass.cpp
@@ -49,7 +49,8 @@ TEST_CONSTEXPR_CXX20 bool test() {
{
typedef std::basic_string<char, std::char_traits<char>, safe_allocator<char>> S;
S s;
- s = {'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'};
+ s = {'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a',
+ 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'};
assert(s == "aaaaaaaaaaaaaaaaaaaaaaaa");
LIBCPP_ASSERT(is_string_asan_correct(s));
}
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
index c7db45a3c8..e14227d1a7 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
@@ -38,7 +38,7 @@ TEST_CONSTEXPR_CXX20 void test(It first, It last) {
}
assert(s2.get_allocator() == Alloc());
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc, class It>
@@ -56,7 +56,7 @@ TEST_CONSTEXPR_CXX20 void test(It first, It last, const Alloc& a) {
}
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
index d584ea651a..5d2d774b36 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move.pass.cpp
@@ -29,9 +29,9 @@ TEST_CONSTEXPR_CXX20 void test(S s0) {
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == s1.get_allocator());
- LIBCPP_ASSERT(is_string_asan_correct(s0));
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s0));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
index cf7daf5ccf..7210d67b5c 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_alloc.pass.cpp
@@ -29,9 +29,9 @@ TEST_CONSTEXPR_CXX20 void test(S s0, const typename S::allocator_type& a) {
assert(s2 == s1);
assert(s2.capacity() >= s2.size());
assert(s2.get_allocator() == a);
- LIBCPP_ASSERT(is_string_asan_correct(s0));
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s0));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
TEST_CONSTEXPR_CXX20 bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
index 1f46b96990..3e42dfcb23 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/move_assignment.pass.cpp
@@ -29,9 +29,9 @@ TEST_CONSTEXPR_CXX20 void test(S s1, S s2) {
LIBCPP_ASSERT(s2.__invariants());
assert(s1 == s0);
assert(s1.capacity() >= s1.size());
- LIBCPP_ASSERT(is_string_asan_correct(s0));
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s0));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
index 6f9eafaa25..9c3ad73bf5 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
@@ -32,7 +32,7 @@ TEST_CONSTEXPR_CXX20 void test(const charT* s) {
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == Alloc());
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc, class charT>
@@ -46,7 +46,7 @@ TEST_CONSTEXPR_CXX20 void test(const charT* s, const Alloc& a) {
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
index 742263d354..d463763223 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_assignment.pass.cpp
@@ -26,7 +26,7 @@ TEST_CONSTEXPR_CXX20 void test(S s1, const typename S::value_type* s2) {
assert(s1.size() == T::length(s2));
assert(T::compare(s1.data(), s2, s1.size()) == 0);
assert(s1.capacity() >= s1.size());
- LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
index bf662c05f9..9fb48b7898 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp
@@ -30,7 +30,7 @@ TEST_CONSTEXPR_CXX20 void test(const CharT* s, unsigned n) {
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == Alloc());
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc, class CharT>
@@ -43,7 +43,7 @@ TEST_CONSTEXPR_CXX20 void test(const CharT* s, unsigned n, const Alloc& a) {
assert(T::compare(s2.data(), s, n) == 0);
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
index 0e2f7ebbda..e7c90459f9 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
@@ -31,7 +31,7 @@ TEST_CONSTEXPR_CXX20 void test(unsigned n, charT c) {
assert(s2[i] == c);
assert(s2.get_allocator() == Alloc());
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc, class charT>
@@ -44,7 +44,7 @@ TEST_CONSTEXPR_CXX20 void test(unsigned n, charT c, const Alloc& a) {
assert(s2[i] == c);
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class Alloc, class Tp>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
index b66124b763..31d2c231e4 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_assignment.pass.cpp
@@ -25,7 +25,7 @@ TEST_CONSTEXPR_CXX20 void test(S s1, SV sv) {
assert(s1.size() == sv.size());
assert(T::compare(s1.data(), sv.data(), s1.size()) == 0);
assert(s1.capacity() >= s1.size());
- LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
index c78651c0df..414062cc72 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp
@@ -34,16 +34,15 @@ TEST_CONSTEXPR_CXX20 void test(S str, unsigned pos) {
typedef typename S::allocator_type A;
if (pos <= str.size()) {
-
- S s2(str, pos);
- LIBCPP_ASSERT(s2.__invariants());
- typename S::size_type rlen = str.size() - pos;
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
- }
+ S s2(str, pos);
+ LIBCPP_ASSERT(s2.__invariants());
+ typename S::size_type rlen = str.size() - pos;
+ assert(s2.size() == rlen);
+ assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
+ assert(s2.get_allocator() == A());
+ assert(s2.capacity() >= s2.size());
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
@@ -58,20 +57,18 @@ TEST_CONSTEXPR_CXX20 void test(S str, unsigned pos) {
template <class S>
TEST_CONSTEXPR_CXX20 void test(S str, unsigned pos, unsigned n) {
-
- typedef typename S::traits_type T;
- typedef typename S::allocator_type A;
- if (pos <= str.size())
- {
- S s2(str, pos, n);
- LIBCPP_ASSERT(s2.__invariants());
- typename S::size_type rlen = std::min<typename S::size_type>(str.size() - pos, n);
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == A());
- assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
- }
+ typedef typename S::traits_type T;
+ typedef typename S::allocator_type A;
+ if (pos <= str.size()) {
+ S s2(str, pos, n);
+ LIBCPP_ASSERT(s2.__invariants());
+ typename S::size_type rlen = std::min<typename S::size_type>(str.size() - pos, n);
+ assert(s2.size() == rlen);
+ assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
+ assert(s2.get_allocator() == A());
+ assert(s2.capacity() >= s2.size());
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
@@ -89,16 +86,15 @@ TEST_CONSTEXPR_CXX20 void test(S str, unsigned pos, unsigned n, const typename S
typedef typename S::traits_type T;
if (pos <= str.size()) {
-
- S s2(str, pos, n, a);
- LIBCPP_ASSERT(s2.__invariants());
- typename S::size_type rlen = std::min<typename S::size_type>(str.size() - pos, n);
- assert(s2.size() == rlen);
- assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
- assert(s2.get_allocator() == a);
- assert(s2.capacity() >= s2.size());
- LIBCPP_ASSERT(is_string_asan_correct(s2));
- }
+ S s2(str, pos, n, a);
+ LIBCPP_ASSERT(s2.__invariants());
+ typename S::size_type rlen = std::min<typename S::size_type>(str.size() - pos, n);
+ assert(s2.size() == rlen);
+ assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
+ assert(s2.get_allocator() == a);
+ assert(s2.capacity() >= s2.size());
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
index 115dbc003b..0f5d6510da 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
@@ -24,7 +24,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, It first, It last, S expected) {
s.append(first, last);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
#ifndef TEST_HAS_NO_EXCEPTIONS
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
index 97ca09adc5..31501371da 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expecte
s.append(str);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
index 7efbc4cdf4..d28c3ae413 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
@@ -24,7 +24,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, typename
s.append(str, n);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
index 233cafffa6..aaa73cdf2f 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp
@@ -62,7 +62,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::value_type c, S expected) {
s.push_back(c);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
index 8a01ec34a1..a068cf9a45 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_t
s.append(n, c);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
index 3cc5627e18..b105d092ee 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) {
s.append(str);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
index d4991dc2ca..9041053c56 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
@@ -22,14 +22,12 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) {
-
- if (pos <= str.size())
- {
- s.append(str, pos, n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ if (pos <= str.size()) {
+ s.append(str, pos, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
index 0f38571d52..e0630fd830 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
@@ -21,14 +21,12 @@
template <class S, class SV>
TEST_CONSTEXPR_CXX20 void test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected) {
-
- if (pos <= sv.size())
- {
- s.assign(sv, pos, n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ if (pos <= sv.size()) {
+ s.assign(sv, pos, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
index 22238bf52a..fb9be47c14 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
@@ -24,7 +24,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, It first, It last, S expected) {
s.assign(first, last);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
#ifndef TEST_HAS_NO_EXCEPTIONS
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
index 1f97c72e13..a26e5e947a 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expecte
s.assign(str);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
index 53435be2ef..445a1629ef 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
@@ -24,7 +24,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, typename
s.assign(str, n);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
index 1b3a4c41fb..9368839d58 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/size_char.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type n, typename S::value_t
s.assign(n, c);
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
index be9bdaa473..5846ca9d7d 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
@@ -22,14 +22,12 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) {
-
- if (pos <= str.size())
- {
- s.assign(str, pos, n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ if (pos <= str.size()) {
+ s.assign(str, pos, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
index ceb0d4d444..10719dab61 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
@@ -27,11 +27,11 @@ TEST_CONSTEXPR_CXX20 void test(S str, typename S::value_type* s, typename S::siz
typename S::size_type rlen = std::min(n, cs.size() - pos);
assert(r == rlen);
LIBCPP_ASSERT(is_string_asan_correct(str));
- LIBCPP_ASSERT(is_string_asan_correct(cs));
+ LIBCPP_ASSERT(is_string_asan_correct(cs));
- for (r = 0; r < rlen; ++r)
- assert(S::traits_type::eq(cs[pos+r], s[r]));
- }
+ for (r = 0; r < rlen; ++r)
+ assert(S::traits_type::eq(cs[pos + r], s[r]));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
index b79a8c3606..cb94bfe3ca 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp
@@ -25,7 +25,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, S expected)
assert(s[s.size()] == typename S::value_type());
assert(s == expected);
assert(i - s.begin() == pos);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
index 125be1bf26..b0b97ce6cd 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp
@@ -26,7 +26,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, typename S:
assert(s[s.size()] == typename S::value_type());
assert(s == expected);
assert(i - s.begin() == pos);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
index ba717ac8a7..7fc715f9d2 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, S expected) {
LIBCPP_ASSERT(s.__invariants());
assert(s[s.size()] == typename S::value_type());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
index 8d785ea783..20b181449c 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -21,17 +21,15 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, typename S::size_type n, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.erase(pos, n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s[s.size()] == typename S::value_type());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.erase(pos, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s[s.size()] == typename S::value_type());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
index 39fc648b95..f13e0ee37d 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_char.pass.cpp
@@ -21,16 +21,16 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S& s, typename S::const_iterator p, typename S::value_type c, S expected) {
LIBCPP_ASSERT(is_string_asan_correct(s));
- bool sufficient_cap = s.size() < s.capacity();
- typename S::difference_type pos = p - s.begin();
- typename S::iterator i = s.insert(p, c);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- assert(i - s.begin() == pos);
- assert(*i == c);
- if (sufficient_cap)
- assert(i == p);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ bool sufficient_cap = s.size() < s.capacity();
+ typename S::difference_type pos = p - s.begin();
+ typename S::iterator i = s.insert(p, c);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ assert(i - s.begin() == pos);
+ assert(*i == c);
+ if (sufficient_cap)
+ assert(i == p);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
index 96b8c1e3b7..ee3adaa06e 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
@@ -26,7 +26,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::difference_type pos, It first, I
LIBCPP_ASSERT(s.__invariants());
assert(i - s.begin() == pos);
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
#ifndef TEST_HAS_NO_EXCEPTIONS
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
index aeaf898e53..c38efbb270 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_size_char.pass.cpp
@@ -25,7 +25,7 @@ test(S s, typename S::difference_type pos, typename S::size_type n, typename S::
LIBCPP_ASSERT(s.__invariants());
assert(i - s.begin() == pos);
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
index ec436f223b..a6414c06fd 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
@@ -21,16 +21,14 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, const typename S::value_type* str, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.insert(pos, str);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.insert(pos, str);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
index 8071499190..b9873c2522 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
@@ -22,16 +22,14 @@
template <class S>
TEST_CONSTEXPR_CXX20 void
test(S s, typename S::size_type pos, const typename S::value_type* str, typename S::size_type n, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.insert(pos, str, n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.insert(pos, str, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
index 73b5e815d0..b977825349 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
@@ -22,16 +22,14 @@
template <class S>
TEST_CONSTEXPR_CXX20 void
test(S s, typename S::size_type pos, typename S::size_type n, typename S::value_type str, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.insert(pos, n, str);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.insert(pos, n, str);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
index 8a596d9fc9..f8c5946247 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
@@ -21,16 +21,14 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos, S str, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.insert(pos, str);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.insert(pos, str);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
index 0e97da338c..16fc05741d 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
@@ -24,16 +24,14 @@
template <class S>
TEST_CONSTEXPR_CXX20 void
test(S s, typename S::size_type pos1, S str, typename S::size_type pos2, typename S::size_type n, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos1 <= old_size && pos2 <= str.size())
- {
- s.insert(pos1, str, pos2, n);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size && pos2 <= str.size()) {
+ s.insert(pos1, str, pos2, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
index cdf0b3538f..3a76b3c0b9 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp
@@ -22,7 +22,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::value_type str, S expected) {
s += str;
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
index 4a77cc594c..8d2dbba013 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp
@@ -22,7 +22,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, const typename S::value_type* str, S expecte
s += str;
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
index 62a9cf606e..12060417f9 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp
@@ -23,7 +23,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, S str, S expected) {
s += str;
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
index 28a90b247c..eb0c62a665 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_string.pass.cpp
@@ -30,7 +30,7 @@ TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size
assert(s == expected);
typename S::size_type rlen = str.size();
assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
+ LIBCPP_ASSERT(is_string_asan_correct(s));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
index 58faf49e3b..345ee87670 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
@@ -44,15 +44,14 @@ test(S s,
const SizeT old_size = s.size();
S s0 = s;
if (pos1 <= old_size && pos2 <= sv.size()) {
-
- s.replace(pos1, n1, sv, pos2, n2);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- SizeT xlen = std::min<SizeT>(n1, old_size - pos1);
- SizeT rlen = std::min<SizeT>(n2, sv.size() - pos2);
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ s.replace(pos1, n1, sv, pos2, n2);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ SizeT xlen = std::min<SizeT>(n1, old_size - pos1);
+ SizeT rlen = std::min<SizeT>(n2, sv.size() - pos2);
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
index c425c4984e..aefe3ced97 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
@@ -23,19 +23,17 @@
template <class S>
TEST_CONSTEXPR_CXX20 void
test(S s, typename S::size_type pos, typename S::size_type n1, const typename S::value_type* str, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.replace(pos, n1, str);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- typename S::size_type xlen = std::min(n1, old_size - pos);
- typename S::size_type rlen = S::traits_type::length(str);
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.replace(pos, n1, str);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos);
+ typename S::size_type rlen = S::traits_type::length(str);
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
index b854fa9bd5..cb01c34e43 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
@@ -28,19 +28,17 @@ test(S s,
const typename S::value_type* str,
typename S::size_type n2,
S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.replace(pos, n1, str, n2);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- typename S::size_type xlen = std::min(n1, old_size - pos);
- typename S::size_type rlen = n2;
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.replace(pos, n1, str, n2);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos);
+ typename S::size_type rlen = n2;
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
index 067826cd3f..80fa1e76f2 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
@@ -28,19 +28,17 @@ test(S s,
typename S::size_type n2,
typename S::value_type c,
S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos <= old_size)
- {
- s.replace(pos, n1, n2, c);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- typename S::size_type xlen = std::min(n1, old_size - pos);
- typename S::size_type rlen = n2;
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos <= old_size) {
+ s.replace(pos, n1, n2, c);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos);
+ typename S::size_type rlen = n2;
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
index a56313ca09..86cab0dd7c 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
@@ -22,19 +22,17 @@
template <class S>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos1 <= old_size)
- {
- s.replace(pos1, n1, str);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- typename S::size_type xlen = std::min(n1, old_size - pos1);
- typename S::size_type rlen = str.size();
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size) {
+ s.replace(pos1, n1, str);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = str.size();
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
index 9722131551..de02a08958 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
@@ -33,19 +33,17 @@ test(S s,
typename S::size_type pos2,
typename S::size_type n2,
S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos1 <= old_size && pos2 <= str.size())
- {
- s.replace(pos1, n1, str, pos2, n2);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- typename S::size_type xlen = std::min(n1, old_size - pos1);
- typename S::size_type rlen = std::min(n2, str.size() - pos2);
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size && pos2 <= str.size()) {
+ s.replace(pos1, n1, str, pos2, n2);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = std::min(n2, str.size() - pos2);
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
index 316bb01db4..485db7304b 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp
@@ -22,19 +22,17 @@
template <class S, class SV>
TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected) {
-
- const typename S::size_type old_size = s.size();
- S s0 = s;
- if (pos1 <= old_size)
- {
- s.replace(pos1, n1, sv);
- LIBCPP_ASSERT(s.__invariants());
- assert(s == expected);
- typename S::size_type xlen = std::min(n1, old_size - pos1);
- typename S::size_type rlen = sv.size();
- assert(s.size() == old_size - xlen + rlen);
- LIBCPP_ASSERT(is_string_asan_correct(s));
- }
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size) {
+ s.replace(pos1, n1, sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = sv.size();
+ assert(s.size() == old_size - xlen + rlen);
+ LIBCPP_ASSERT(is_string_asan_correct(s));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
else if (!TEST_IS_CONSTANT_EVALUATED) {
try {
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.asan.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.asan.pass.cpp
index 3cabb3b797..0c6c26a5d1 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.asan.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.asan.pass.cpp
@@ -87,7 +87,7 @@ int main(int, char**) {
test<CharT>(u'x');
}
{
- using CharT = char32_t ;
+ using CharT = char32_t;
test<CharT>(U'x');
}
#endif
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
index dd5bc2eea5..9750fe7fa1 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_swap/swap.pass.cpp
@@ -28,8 +28,8 @@ TEST_CONSTEXPR_CXX20 void test(S s1, S s2) {
LIBCPP_ASSERT(s2.__invariants());
assert(s1 == s2_);
assert(s2 == s1_);
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class S>
diff --git a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
index 2d2c770b25..34f71f0abd 100644
--- a/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.nonmembers/string.special/swap.pass.cpp
@@ -30,8 +30,8 @@ TEST_CONSTEXPR_CXX20 void test(S s1, S s2) {
LIBCPP_ASSERT(s2.__invariants());
assert(s1 == s2_);
assert(s2 == s1_);
- LIBCPP_ASSERT(is_string_asan_correct(s1));
- LIBCPP_ASSERT(is_string_asan_correct(s2));
+ LIBCPP_ASSERT(is_string_asan_correct(s1));
+ LIBCPP_ASSERT(is_string_asan_correct(s2));
}
template <class S>
``````````
</details>
https://github.com/llvm/llvm-project/pull/72677
More information about the libcxx-commits
mailing list