This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Remove a bunch of conditionals on _LIBCPP_DEBUG_LEVEL
ClosedPublic

Authored by ldionne on Jun 3 2022, 12:32 PM.

Details

Summary

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.

Diff Detail

Event Timeline

ldionne created this revision.Jun 3 2022, 12:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2022, 12:32 PM
ldionne requested review of this revision.Jun 3 2022, 12:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2022, 12:32 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
philnik accepted this revision.Jun 3 2022, 12:53 PM
philnik added a subscriber: philnik.
philnik added inline comments.
libcxx/include/__hash_table
369–370

Maybe add __debug_db_inster_ic()?

This revision is now accepted and ready to land.Jun 3 2022, 12:53 PM
ldionne added inline comments.Jun 6 2022, 6:53 AM
libcxx/include/__hash_table
369–370

Yeah, good idea. I'll do it in a separate patch to ease rebasing D122941, which touches a lot of code.

This revision was landed with ongoing or failed builds.Jun 6 2022, 6:54 AM
This revision was automatically updated to reflect the committed changes.