[libcxx-commits] [PATCH] D127401: [WIP][libc++] Use checked iterators with std::span when the debug mode is enabled
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 9 06:00:43 PDT 2022
ldionne created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Previously, we'd use raw pointers instead of __wrap_iter, which means
we wouldn't get out-of-range checking with std::span's iterators, which
is really useful. Unfortunately, the current implementation of the debug
mode implies that a bunch of non-trivial calls need to be inserted in
span's constructors and destructors, which is not ideal. In particular,
it means that we cannot keep std::span trivially copyable and destructible
when the debug mode is enabled.
As a fly-by change, this commit removes the _LIBCPP_ABI_SPAN_POINTER_ITERATORS
knob -- not using raw pointers in place of iterators is extremely useful
for users not to start depending on properties of iterators that are not
guaranteed, which allows them to e.g. enable the debug mode without fixing
As a follow-up change, I suggest reworking the underlying implementation
of the debug mode such that containers don't need to be registered in
order to get bounds-checking iterators.
rG LLVM Github Monorepo
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 44583 bytes
Desc: not available
More information about the libcxx-commits