@@ -680,29 +680,31 @@ class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr {
680
680
return static_cast <U*>(GetForExtraction ());
681
681
}
682
682
683
- PA_ALWAYS_INLINE constexpr raw_ptr& operator ++() {
683
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr raw_ptr& operator ++() {
684
684
static_assert (
685
685
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
686
686
" cannot increment raw_ptr unless AllowPtrArithmetic trait is present." );
687
687
wrapped_ptr_ = Impl::Advance (wrapped_ptr_, 1 , true );
688
688
return *this ;
689
689
}
690
- PA_ALWAYS_INLINE constexpr raw_ptr& operator --() {
690
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr raw_ptr& operator --() {
691
691
static_assert (
692
692
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
693
693
" cannot decrement raw_ptr unless AllowPtrArithmetic trait is present." );
694
694
wrapped_ptr_ = Impl::Retreat (wrapped_ptr_, 1 , true );
695
695
return *this ;
696
696
}
697
- PA_ALWAYS_INLINE constexpr raw_ptr operator ++(int /* post_increment */ ) {
697
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr raw_ptr operator ++(
698
+ int /* post_increment */ ) {
698
699
static_assert (
699
700
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
700
701
" cannot increment raw_ptr unless AllowPtrArithmetic trait is present." );
701
702
raw_ptr result = *this ;
702
703
++(*this );
703
704
return result;
704
705
}
705
- PA_ALWAYS_INLINE constexpr raw_ptr operator --(int /* post_decrement */ ) {
706
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr raw_ptr operator --(
707
+ int /* post_decrement */ ) {
706
708
static_assert (
707
709
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
708
710
" cannot decrement raw_ptr unless AllowPtrArithmetic trait is present." );
@@ -713,7 +715,8 @@ class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr {
713
715
template <
714
716
typename Z,
715
717
typename = std::enable_if_t <partition_alloc::internal::is_offset_type<Z>>>
716
- PA_ALWAYS_INLINE constexpr raw_ptr& operator +=(Z delta_elems) {
718
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr raw_ptr& operator +=(
719
+ Z delta_elems) {
717
720
static_assert (
718
721
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
719
722
" cannot increment raw_ptr unless AllowPtrArithmetic trait is present." );
@@ -723,7 +726,8 @@ class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr {
723
726
template <
724
727
typename Z,
725
728
typename = std::enable_if_t <partition_alloc::internal::is_offset_type<Z>>>
726
- PA_ALWAYS_INLINE constexpr raw_ptr& operator -=(Z delta_elems) {
729
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr raw_ptr& operator -=(
730
+ Z delta_elems) {
727
731
static_assert (
728
732
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
729
733
" cannot decrement raw_ptr unless AllowPtrArithmetic trait is present." );
@@ -736,7 +740,8 @@ class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr {
736
740
typename = std::enable_if_t <
737
741
!std::is_void_v<typename std::remove_cv<U>::type> &&
738
742
partition_alloc::internal::is_offset_type<Z>>>
739
- PA_ALWAYS_INLINE constexpr U& operator [](Z delta_elems) const {
743
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE constexpr U& operator [](
744
+ Z delta_elems) const {
740
745
static_assert (
741
746
raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
742
747
" cannot index raw_ptr unless AllowPtrArithmetic trait is present." );
@@ -760,8 +765,9 @@ class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr {
760
765
// generate code that converts `raw_ptr<T>` to `T*` and adds uint64_t to that,
761
766
// bypassing the OOB protection entirely.
762
767
template <typename Z>
763
- PA_ALWAYS_INLINE friend constexpr raw_ptr operator +(const raw_ptr& p,
764
- Z delta_elems) {
768
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE friend constexpr raw_ptr operator +(
769
+ const raw_ptr& p,
770
+ Z delta_elems) {
765
771
// Don't check `is_offset_type<Z>` here, as existence of `Advance` is
766
772
// already gated on that, and we'd get double errors.
767
773
static_assert (
@@ -771,13 +777,15 @@ class PA_TRIVIAL_ABI PA_GSL_POINTER raw_ptr {
771
777
return result;
772
778
}
773
779
template <typename Z>
774
- PA_ALWAYS_INLINE friend constexpr raw_ptr operator +(Z delta_elems,
775
- const raw_ptr& p) {
780
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE friend constexpr raw_ptr operator +(
781
+ Z delta_elems,
782
+ const raw_ptr& p) {
776
783
return p + delta_elems;
777
784
}
778
785
template <typename Z>
779
- PA_ALWAYS_INLINE friend constexpr raw_ptr operator -(const raw_ptr& p,
780
- Z delta_elems) {
786
+ PA_UNSAFE_BUFFER_USAGE PA_ALWAYS_INLINE friend constexpr raw_ptr operator -(
787
+ const raw_ptr& p,
788
+ Z delta_elems) {
781
789
// Don't check `is_offset_type<Z>` here, as existence of `Retreat` is
782
790
// already gated on that, and we'd get double errors.
783
791
static_assert (raw_ptr_traits::IsPtrArithmeticAllowed (Traits),
0 commit comments