summaryrefslogtreecommitdiff
path: root/libcxx/include/string
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/string')
-rw-r--r--libcxx/include/string10
1 files changed, 5 insertions, 5 deletions
diff --git a/libcxx/include/string b/libcxx/include/string
index 7b0cd828704b..6e93a6230cc2 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1048,7 +1048,7 @@ public:
__r_.first() = __str.__r_.first();
__str.__r_.first() = __rep();
__str.__annotate_new(0);
- if (!__is_long() && this != &__str)
+ if (!__is_long() && this != std::addressof(__str))
__annotate_new(size());
}
}
@@ -2711,7 +2711,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
__str.__set_short_size(0);
traits_type::assign(__str.__get_short_pointer()[0], value_type());
- if (__str_was_short && this != &__str)
+ if (__str_was_short && this != std::addressof(__str))
__str.__annotate_shrink(__str_old_size);
else
// ASan annotations: was long, so object memory is unpoisoned as new.
@@ -2725,7 +2725,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
// invariants hold (so functions without preconditions, such as the assignment operator,
// can be safely used on the object after it was moved from):"
// Quote: "v = std::move(v); // the value of v is unspecified"
- if (!__is_long() && &__str != this)
+ if (!__is_long() && std::addressof(__str) != this)
// If it is long string, delete was never called on original __str's buffer.
__annotate_new(__get_short_size());
}
@@ -3450,13 +3450,13 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
"swapping non-equal allocators");
if (!__is_long())
__annotate_delete();
- if (this != &__str && !__str.__is_long())
+ if (this != std::addressof(__str) && !__str.__is_long())
__str.__annotate_delete();
std::swap(__r_.first(), __str.__r_.first());
std::__swap_allocator(__alloc(), __str.__alloc());
if (!__is_long())
__annotate_new(__get_short_size());
- if (this != &__str && !__str.__is_long())
+ if (this != std::addressof(__str) && !__str.__is_long())
__str.__annotate_new(__str.__get_short_size());
}