[libcxx-commits] [libcxx] [ASan][libc++] std::basic_string annotations (PR #72677)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 18:06:18 PST 2023


================
@@ -18,18 +18,27 @@
 #include "test_macros.h"
 #include "test_allocator.h"
 #include "min_allocator.h"
+#include "asan_testing.h"
 
 // clang-format off
 template <template <class> class Alloc>
 TEST_CONSTEXPR_CXX20 void test_string() {
   {
     std::basic_string<char, std::char_traits<char>, Alloc<char> > s = {'a', 'b', 'c'};
     assert(s == "abc");
+    LIBCPP_ASSERT(is_string_asan_correct(s));
+  }
+  {
+    std::basic_string<char, std::char_traits<char>, Alloc<char> > s;
+    s = {'a', 'b', 'c'};
+    assert(s == "abc");
+    LIBCPP_ASSERT(is_string_asan_correct(s));
   }
----------------
AdvenamTacet wrote:

A similar test already exists in the correct place, so I simply removed that one.

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


More information about the libcxx-commits mailing list