[libcxx-commits] [PATCH] D136765: [ASan][libcxx] Annotating std::vector with all allocators
Tacet via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 2 12:44:17 PDT 2022
AdvenamTacet updated this revision to Diff 472728.
AdvenamTacet added a comment.
Turning on old check for llvm without new annotation implementation.
(Check for _LIBCPP_CLANG_VER.)
For old llvm versions, it will work the same way.
Btw. I do not have a commiter access.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136765/new/
https://reviews.llvm.org/D136765
Files:
libcxx/include/vector
libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
Index: libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
===================================================================
--- libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
+++ libcxx/test/libcxx/containers/sequences/vector/asan.pass.cpp
@@ -36,7 +36,7 @@
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
- volatile T foo = c[c.size()]; // bad, but not caught by ASAN
+ volatile T foo = c[c.size() - 1];
((void)foo);
}
#endif
Index: libcxx/include/vector
===================================================================
--- libcxx/include/vector
+++ libcxx/include/vector
@@ -744,8 +744,11 @@
const void *__old_mid,
const void *__new_mid) const
{
-
+#if _LIBCPP_CLANG_VER >= 16000
+ if (!__libcpp_is_constant_evaluated() && __beg)
+#else
if (!__libcpp_is_constant_evaluated() && __beg && is_same<allocator_type, __default_allocator_type>::value)
+#endif
__sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid);
}
#else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136765.472728.patch
Type: text/x-patch
Size: 1201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221102/ad96104b/attachment.bin>
More information about the libcxx-commits
mailing list