[libc++] Use bounded iterators in std::span when the debug mode is enabled
Previously, we'd use raw pointers when the debug mode was enabled, which means we wouldn't get out-of-range checking with std::span's iterators. This patch introduces a new class called __bounded_iter which can be used to wrap iterators and make them carry around bounds-related information. This allows iterators to assert when they are dereferenced outside of their bounds. As a fly-by change, this commit removes the _LIBCPP_ABI_SPAN_POINTER_ITERATORS knob. Indeed, not using a raw pointer as the iterator type is useful to avoid users depending on properties of raw pointers in their code. This is an alternative to D127401. Differential Revision: https://reviews.llvm.org/D127418
parent
92df8c27
Please register or sign in to comment