Skip to content

Commit f6984d8

Browse files
committed
xstring: remove memcpies in _INSERT_STRING_ANNOTATION mode
1 parent cc418a3 commit f6984d8

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

stl/inc/xstring

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,6 +3169,7 @@ private:
31693169
auto& _My_data = _Mypair._Myval2;
31703170
auto& _Right_data = _Right._Mypair._Myval2;
31713171

3172+
#if !defined(_INSERT_STRING_ANNOTATION)
31723173
if constexpr (_Can_memcpy_val) {
31733174
#if _HAS_CXX20
31743175
if (!_STD is_constant_evaluated())
@@ -3183,24 +3184,12 @@ private:
31833184
}
31843185
#endif // _ITERATOR_DEBUG_LEVEL != 0
31853186

3186-
#ifdef _INSERT_STRING_ANNOTATION
3187-
if (!_Right_data._Large_string_engaged()) {
3188-
_ASAN_STRING_REMOVE(_Right);
3189-
}
3190-
#endif // _INSERT_STRING_ANNOTATION
3191-
31923187
_Memcpy_val_from(_Right);
3193-
3194-
#ifdef _INSERT_STRING_ANNOTATION
3195-
if (!_Right_data._Large_string_engaged()) {
3196-
_ASAN_STRING_CREATE(*this);
3197-
}
3198-
#endif // _INSERT_STRING_ANNOTATION
3199-
32003188
_Right._Tidy_init();
32013189
return;
32023190
}
32033191
}
3192+
#endif // !defined(_INSERT_STRING_ANNOTATION)
32043193

32053194
if (_Right_data._Large_string_engaged()) { // steal buffer
32063195
_Construct_in_place(_My_data._Bx._Ptr, _Right_data._Bx._Ptr);
@@ -3304,6 +3293,7 @@ private:
33043293
_CONSTEXPR20 void _Copy_assign_val_from_small(const basic_string& _Right) {
33053294
// TRANSITION, VSO-761321; inline into only caller when that's fixed
33063295
_Tidy_deallocate();
3296+
#if !defined(_INSERT_STRING_ANNOTATION)
33073297
if constexpr (_Can_memcpy_val) {
33083298
#if _HAS_CXX20
33093299
if (!_STD is_constant_evaluated())
@@ -3313,6 +3303,7 @@ private:
33133303
return;
33143304
}
33153305
}
3306+
#endif // !defined(_INSERT_STRING_ANNOTATION)
33163307

33173308
auto& _My_data = _Mypair._Myval2;
33183309
auto& _Right_data = _Right._Mypair._Myval2;

0 commit comments

Comments
 (0)