[libcxx-commits] [libcxx] [libc++] Check iterator ownership in erase() for string and vector (PR #90919)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 9 12:25:58 PDT 2024


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 a1d73ace13a20ed122a66d3d59f0cbae58d0f669 22f1a9820f533b44357866001a660fa3bd2dc409 -- libcxx/test/libcxx/containers/sequences/deque/assert.erase.iter_iter.pass.cpp libcxx/test/libcxx/containers/sequences/vector/assert.erase.iter.pass.cpp libcxx/test/libcxx/containers/sequences/vector/assert.erase.iter_iter.pass.cpp libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase.iter.pass.cpp libcxx/include/string libcxx/include/vector libcxx/test/libcxx/containers/sequences/deque/assert.pass.cpp libcxx/test/libcxx/containers/sequences/deque/assert.erase.iter.pass.cpp libcxx/test/libcxx/strings/basic.string/string.modifiers/assert.erase.iter_iter.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/libcxx/containers/sequences/deque/assert.erase.iter.pass.cpp b/libcxx/test/libcxx/containers/sequences/deque/assert.erase.iter.pass.cpp
index 5190bee499..30b07888e0 100644
--- a/libcxx/test/libcxx/containers/sequences/deque/assert.erase.iter.pass.cpp
+++ b/libcxx/test/libcxx/containers/sequences/deque/assert.erase.iter.pass.cpp
@@ -23,8 +23,7 @@ int main(int, char**) {
   // With an invalid iterator
   {
     std::deque<int> v = {1, 2, 3, 4, 5};
-    TEST_LIBCPP_ASSERT_FAILURE(
-        v.erase(v.end()), "deque::erase(iterator) called with a non-dereferenceable iterator");
+    TEST_LIBCPP_ASSERT_FAILURE(v.erase(v.end()), "deque::erase(iterator) called with a non-dereferenceable iterator");
   }
 
   // Note that we currently can't catch misuse by erasing with an iterator from another container.

``````````

</details>


https://github.com/llvm/llvm-project/pull/90919


More information about the libcxx-commits mailing list