aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__iterator/wrap_iter.h
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2022-06-03 15:17:03 -0400
committerLouis Dionne <ldionne.2@gmail.com>2022-06-06 09:54:26 -0400
commit4eab04f8491ab4fb8456eea9a73657701c554625 (patch)
treed451142edb4c92341d36e43a86ecffa38af453c8 /libcxx/include/__iterator/wrap_iter.h
parenta1f1bd547b0d4c4b200dd485b85366bcd24c84c0 (diff)
downloadllvm-4eab04f8491ab4fb8456eea9a73657701c554625.zip
llvm-4eab04f8491ab4fb8456eea9a73657701c554625.tar.gz
llvm-4eab04f8491ab4fb8456eea9a73657701c554625.tar.bz2
[libc++] Remove a bunch of conditionals on _LIBCPP_DEBUG_LEVEL
Instead of providing two different constructors for iterators that support the debug mode, provide a single constructor but leave the container parameter unused when the debug mode is not enabled. This allows simplifying all the call sites to unconditionally pass the container, which removes a bunch of duplication in the container's implementation. Note that this patch does add some complexity to std::span, however that is only because std::span has the ability to use raw pointers as iterators instead of __wrap_iter. In retrospect, I believe it was a mistake to provide that capability, and so it will be removed in a future patch, along with the complexity added by this patch. Differential Revision: https://reviews.llvm.org/D126993
Diffstat (limited to 'libcxx/include/__iterator/wrap_iter.h')
-rw-r--r--libcxx/include/__iterator/wrap_iter.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 69e5ee1..a3f42ca7 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -135,17 +135,15 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 iterator_type base() const _NOEXCEPT {return __i;}
private:
-#if _LIBCPP_DEBUG_LEVEL == 2
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
- explicit __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
+ explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i(__x)
{
+ (void)__p;
+#if _LIBCPP_DEBUG_LEVEL == 2
if (!__libcpp_is_constant_evaluated())
__get_db()->__insert_ic(this, __p);
- }
-#else
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
- explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
#endif
+ }
template <class _Up> friend class __wrap_iter;
template <class _CharT, class _Traits, class _Alloc> friend class basic_string;