[libcxx-commits] [libcxx] 6946f0e - [libc++] [LIBCXX-DEBUG-FIXME] <span>, like <string_view>, has no use for debug iterators.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 30 20:07:40 PDT 2021
Author: Arthur O'Dwyer
Date: 2021-04-30T23:06:45-04:00
New Revision: 6946f0ecca64f3af6b9e28cced9c982de2748f19
URL: https://github.com/llvm/llvm-project/commit/6946f0ecca64f3af6b9e28cced9c982de2748f19
DIFF: https://github.com/llvm/llvm-project/commit/6946f0ecca64f3af6b9e28cced9c982de2748f19.diff
LOG: [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
Added:
Modified:
libcxx/include/__config
libcxx/include/span
libcxx/test/std/containers/views/span.cons/deduct.pass.cpp
libcxx/test/std/containers/views/span.iterators/begin.pass.cpp
libcxx/test/std/containers/views/span.iterators/end.pass.cpp
libcxx/test/std/containers/views/span.iterators/rbegin.pass.cpp
libcxx/test/std/containers/views/span.iterators/rend.pass.cpp
libcxx/test/std/containers/views/span.sub/first.pass.cpp
libcxx/test/std/containers/views/span.sub/last.pass.cpp
libcxx/test/std/containers/views/span.sub/subspan.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 96860c0ce4c01..97d3289b69388 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 b47574084b2ac..4c621abe80f34 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 cbb6a97d6fb18..aeb0540ac0cd8 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 25254f6d277d4..f6b24017ffc1f 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 88564e548b822..d531537bb195d 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 1f0fb66dce1b3..26e4389840857 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 0d11f3beee72e..c2bd13aaf612b 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 25234f13160fd..ab0875b991250 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 7d0371f437c73..ea3b3cd4405c7 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 01db12285566d..347f6fd892154 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>
More information about the libcxx-commits
mailing list