Skip to content

Commit c2c0b0d

Browse files
committed
[libc++][NFC] Remove a bunch of redundant ASan existance checks
1 parent 8abca17 commit c2c0b0d

File tree

3 files changed

+6
-35
lines changed

3 files changed

+6
-35
lines changed

libcxx/include/__vector/vector.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -716,47 +716,32 @@ class _LIBCPP_TEMPLATE_VIS vector {
716716
}
717717

718718
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
719-
(void)__current_size;
720-
#if _LIBCPP_HAS_ASAN
721719
__annotate_contiguous_container(data() + capacity(), data() + __current_size);
722-
#endif
723720
}
724721

725722
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
726-
#if _LIBCPP_HAS_ASAN
727723
__annotate_contiguous_container(data() + size(), data() + capacity());
728-
#endif
729724
}
730725

731726
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_increase(size_type __n) const _NOEXCEPT {
732-
(void)__n;
733-
#if _LIBCPP_HAS_ASAN
734727
__annotate_contiguous_container(data() + size(), data() + size() + __n);
735-
#endif
736728
}
737729

738730
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
739-
(void)__old_size;
740-
#if _LIBCPP_HAS_ASAN
741731
__annotate_contiguous_container(data() + __old_size, data() + size());
742-
#endif
743732
}
744733

745734
struct _ConstructTransaction {
746735
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n)
747736
: __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
748-
#if _LIBCPP_HAS_ASAN
749737
__v_.__annotate_increase(__n);
750-
#endif
751738
}
752739

753740
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
754741
__v_.__end_ = __pos_;
755-
#if _LIBCPP_HAS_ASAN
756742
if (__pos_ != __new_end_) {
757743
__v_.__annotate_shrink(__new_end_ - __v_.__begin_);
758744
}
759-
#endif
760745
}
761746

762747
vector& __v_;

libcxx/include/string

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ private:
21532153
__annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
21542154
(void)__old_mid;
21552155
(void)__new_mid;
2156-
# if _LIBCPP_HAS_ASAN && _LIBCPP_INSTRUMENTED_WITH_ASAN
2156+
# if _LIBCPP_INSTRUMENTED_WITH_ASAN
21572157
# if defined(__APPLE__)
21582158
// TODO: remove after addressing issue #96099 (https://github.com/llvm/llvm-project/issues/96099)
21592159
if (!__is_long())
@@ -2164,34 +2164,19 @@ private:
21642164
}
21652165

21662166
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT {
2167-
(void)__current_size;
2168-
# if _LIBCPP_HAS_ASAN && _LIBCPP_INSTRUMENTED_WITH_ASAN
2169-
if (!__libcpp_is_constant_evaluated())
2170-
__annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
2171-
# endif
2167+
__annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
21722168
}
21732169

21742170
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT {
2175-
# if _LIBCPP_HAS_ASAN && _LIBCPP_INSTRUMENTED_WITH_ASAN
2176-
if (!__libcpp_is_constant_evaluated())
2177-
__annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
2178-
# endif
2171+
__annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
21792172
}
21802173

21812174
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT {
2182-
(void)__n;
2183-
# if _LIBCPP_HAS_ASAN && _LIBCPP_INSTRUMENTED_WITH_ASAN
2184-
if (!__libcpp_is_constant_evaluated())
2185-
__annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
2186-
# endif
2175+
__annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
21872176
}
21882177

21892178
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
2190-
(void)__old_size;
2191-
# if _LIBCPP_HAS_ASAN && _LIBCPP_INSTRUMENTED_WITH_ASAN
2192-
if (!__libcpp_is_constant_evaluated())
2193-
__annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
2194-
# endif
2179+
__annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
21952180
}
21962181

21972182
// Disable ASan annotations and enable them again when going out of scope. It is assumed that the string is in a valid

libcxx/test/std/strings/basic.string/string.nonmembers/string_op+/string.string_view.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
10+
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000
1011

1112
// <string>
1213

0 commit comments

Comments
 (0)