diff options
author | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2021-04-20 22:08:00 -0400 |
---|---|---|
committer | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2021-04-30 23:06:45 -0400 |
commit | 6946f0ecca64f3af6b9e28cced9c982de2748f19 (patch) | |
tree | 94bd8c92dbc61709e7c0304e5bb9e570d22999ea | |
parent | 0a2921993199fbf8af5078dce0dd933d6a50e25b (diff) | |
download | llvm-6946f0ecca64f3af6b9e28cced9c982de2748f19.zip llvm-6946f0ecca64f3af6b9e28cced9c982de2748f19.tar.gz llvm-6946f0ecca64f3af6b9e28cced9c982de2748f19.tar.bz2 |
[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
10 files changed, 12 insertions, 10 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index 96860c0..97d3289 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -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 diff --git a/libcxx/include/span b/libcxx/include/span index b475740..4c621ab 100644 --- a/libcxx/include/span +++ b/libcxx/include/span @@ -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; diff --git a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp index cbb6a97..aeb0540 100644 --- a/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp +++ b/libcxx/test/std/containers/views/span.cons/deduct.pass.cpp @@ -7,7 +7,6 @@ // //===---------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.iterators/begin.pass.cpp b/libcxx/test/std/containers/views/span.iterators/begin.pass.cpp index 25254f6..f6b2401 100644 --- a/libcxx/test/std/containers/views/span.iterators/begin.pass.cpp +++ b/libcxx/test/std/containers/views/span.iterators/begin.pass.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.iterators/end.pass.cpp b/libcxx/test/std/containers/views/span.iterators/end.pass.cpp index 88564e5..d531537 100644 --- a/libcxx/test/std/containers/views/span.iterators/end.pass.cpp +++ b/libcxx/test/std/containers/views/span.iterators/end.pass.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp b/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp index 1f0fb66..26e4389 100644 --- a/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp +++ b/libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp b/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp index 0d11f3be..c2bd13a 100644 --- a/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp +++ b/libcxx/test/std/containers/views/span.iterators/rend.pass.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.sub/first.pass.cpp b/libcxx/test/std/containers/views/span.sub/first.pass.cpp index 25234f1..ab0875b 100644 --- a/libcxx/test/std/containers/views/span.sub/first.pass.cpp +++ b/libcxx/test/std/containers/views/span.sub/first.pass.cpp @@ -7,7 +7,6 @@ // //===---------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.sub/last.pass.cpp b/libcxx/test/std/containers/views/span.sub/last.pass.cpp index 7d0371f..ea3b3cd 100644 --- a/libcxx/test/std/containers/views/span.sub/last.pass.cpp +++ b/libcxx/test/std/containers/views/span.sub/last.pass.cpp @@ -7,7 +7,6 @@ // //===---------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> diff --git a/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp b/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp index 01db122..347f6fd 100644 --- a/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp +++ b/libcxx/test/std/containers/views/span.sub/subspan.pass.cpp @@ -7,7 +7,6 @@ // //===---------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: LIBCXX-DEBUG-FIXME // <span> |