@@ -711,23 +711,7 @@ template <class _CharT, class _Traits, class _Allocator>
711
711
class basic_string {
712
712
private:
713
713
using __default_allocator_type = allocator<_CharT>;
714
- #ifndef _LIBCPP_HAS_NO_ASAN
715
- pointer __asan_volatile_wrapper (pointer __ptr) const {
716
- volatile pointer __copy_ptr = __ptr;
717
-
718
- return __copy_ptr;
719
- }
720
-
721
- const_pointer const __asan_volatile_wrapper (const_pointer __ptr) const {
722
- volatile const_pointer __copy_ptr = __ptr;
723
714
724
- return __copy_ptr;
725
- }
726
-
727
- #define _LIBCPP_ASAN_VOLATILE_WRAPPER (ptr ) __asan_volatile_wrapper(ptr)
728
- #else
729
- #define _LIBCPP_ASAN_VOLATILE_WRAPPER (ptr ) ptr
730
- #endif
731
715
public:
732
716
typedef basic_string __self;
733
717
typedef basic_string_view<_CharT, _Traits> __self_view;
@@ -751,7 +735,7 @@ public:
751
735
//
752
736
// This string implementation doesn't contain any references into itself. It only contains a bit that says whether
753
737
// it is in small or large string mode, so the entire structure is trivially relocatable if its members are.
754
- #ifndef _LIBCPP_HAS_NO_ASAN
738
+ #if !defined( _LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
755
739
// When compiling with AddressSanitizer (ASan), basic_string cannot be trivially
756
740
// relocatable. Because the object's memory might be poisoned when its content
757
741
// is kept inside objects memory (short string optimization), instead of in allocated
@@ -765,7 +749,23 @@ public:
765
749
basic_string,
766
750
void >;
767
751
#endif
752
+ #if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
753
+ pointer __asan_volatile_wrapper (pointer __ptr) const {
754
+ volatile pointer __copy_ptr = __ptr;
755
+
756
+ return __copy_ptr;
757
+ }
758
+
759
+ const_pointer const __asan_volatile_wrapper (const_pointer __ptr) const {
760
+ volatile const_pointer __copy_ptr = __ptr;
761
+
762
+ return __copy_ptr;
763
+ }
768
764
765
+ #define _LIBCPP_ASAN_VOLATILE_WRAPPER (ptr ) __asan_volatile_wrapper(ptr)
766
+ #else
767
+ #define _LIBCPP_ASAN_VOLATILE_WRAPPER (ptr ) ptr
768
+ #endif
769
769
static_assert ((!is_array<value_type>::value), " Character type of basic_string must not be an array" );
770
770
static_assert ((is_standard_layout<value_type>::value), " Character type of basic_string must be standard-layout" );
771
771
static_assert ((is_trivial<value_type>::value), " Character type of basic_string must be trivial" );
0 commit comments