[libc++] [LIBCXX-DEBUG-FIXME] <span>, like <string_view>, has no use for debug iterators.

A span has no idea what container (if any) "owns" its iterators, nor
under what circumstances they might become invalidated.

However, continue to use `__wrap_iter<T*>` instead of raw `T*` outside
of debug mode, because we've been shipping `std::span` since Clang 7
and ldionne doesn't want to break ABI. (Namely, the mangling of functions
taking `span::iterator` as a parameter.) Permit using raw `T*` there,
but only under an ABI macro: `_LIBCPP_ABI_SPAN_POINTER_ITERATORS`.

Differential Revision: https://reviews.llvm.org/D101003
This commit is contained in:
Arthur O'Dwyer 2021-04-20 22:08:00 -04:00
parent 0a29219931
commit 6946f0ecca
10 changed files with 12 additions and 10 deletions

View File

@ -106,6 +106,8 @@
# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
// All the regex constants must be distinct and nonzero.
# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
// Use raw pointers, not wrapped ones, for std::span's iterator type.
# define _LIBCPP_ABI_SPAN_POINTER_ITERATORS
// Re-worked external template instantiations for std::string with a focus on
// performance and fast-path inlining.
# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION

View File

@ -200,7 +200,11 @@ public:
using const_pointer = const _Tp *;
using reference = _Tp &;
using const_reference = const _Tp &;
using iterator = __wrap_iter<pointer>;
#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
using iterator = pointer;
#else
using iterator = __wrap_iter<pointer>;
#endif
using reverse_iterator = _VSTD::reverse_iterator<iterator>;
static constexpr size_type extent = _Extent;
@ -375,7 +379,11 @@ public:
using const_pointer = const _Tp *;
using reference = _Tp &;
using const_reference = const _Tp &;
using iterator = __wrap_iter<pointer>;
#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS)
using iterator = pointer;
#else
using iterator = __wrap_iter<pointer>;
#endif
using reverse_iterator = _VSTD::reverse_iterator<iterator>;
static constexpr size_type extent = dynamic_extent;

View File

@ -7,7 +7,6 @@
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -7,7 +7,6 @@
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -7,7 +7,6 @@
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>

View File

@ -7,7 +7,6 @@
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: LIBCXX-DEBUG-FIXME
// <span>