This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][iterator] adds `std::input_or_output_iterator` and `std::sentinel_for`
ClosedPublic

Authored by cjdb on Apr 8 2021, 7:12 PM.

Details

Summary

Implements parts of:

  • P0896R4 The One Ranges Proposal`

Depends on D100080

Diff Detail

Event Timeline

cjdb requested review of this revision.Apr 8 2021, 7:12 PM
cjdb created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2021, 7:12 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
cjdb updated this revision to Diff 336701.Apr 11 2021, 2:41 PM

updates synopsis, rebases to activate CI

cjdb updated this revision to Diff 337003.Apr 12 2021, 5:45 PM

adds subsumption test

miscco added inline comments.Apr 12 2021, 10:52 PM
libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.sentinel/sentinel_for.compile.pass.cpp
45–49

semi_regular also requires copyability (https://eel.is/c++draft/concepts.object). Please add a check that a non copyable iterator is not a sentinel for itself (aka move-only input iterators)

zoecarver accepted this revision as: zoecarver.Apr 14 2021, 3:41 PM

LGMT.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.iterator/input_or_output_iterator.compile.pass.cpp
186

I'm not going to keep commenting on this if I see it again.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.sentinel/sentinel_for.compile.pass.cpp
45–49

+1

cjdb updated this revision to Diff 337811.Apr 15 2021, 9:54 AM

rebases to activate CI

In general LGTM modulo some nits and the request of @miscco. But I like to know more about the locale_dependent test before approving.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.sentinel/sentinel_for.compile.pass.cpp
13

Please update this part to template<class S, class I>

102

Here iterator and const_iterator are not tested against the full set, like reverse_iterator and const_reverse_iterator. Can you add them for completeness?

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/locale_dependent.compile.pass.cpp
12

What's locale dependent with this test?
If it's locale dependent it should contain a line // UNSUPPORTED: libcpp-has-no-localization

21

Please remove the sized_sentinel since it isn't added here.

cjdb updated this revision to Diff 339034.Apr 20 2021, 4:24 PM

rebases to activate CI

cjdb updated this revision to Diff 339089.Apr 20 2021, 8:31 PM

rebases to activate CI

ldionne requested changes to this revision.Apr 21 2021, 11:29 AM

Requesting changes until my and other reviewer's comments have been address, to help keep track of the status of this patch.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.iterator/input_or_output_iterator.compile.pass.cpp
65

Why do we have those here if we also have the various iterator_concept_conformance.compile.pass.cpp tests?

This revision now requires changes to proceed.Apr 21 2021, 11:29 AM
cjdb updated this revision to Diff 339330.Apr 21 2021, 11:31 AM

rebases to activate CI

cjdb updated this revision to Diff 339356.Apr 21 2021, 12:54 PM
cjdb marked 2 inline comments as done.

applies feedback

cjdb marked 4 inline comments as done.Apr 21 2021, 12:55 PM
cjdb added inline comments.
libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.iterator/input_or_output_iterator.compile.pass.cpp
65

I mustn't have deleted these before pushing :S
Deleted.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.sentinel/sentinel_for.compile.pass.cpp
102

PTAL at the individual tests.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/locale_dependent.compile.pass.cpp
12

File deleted.

ldionne accepted this revision.Apr 21 2021, 2:21 PM

LGTM with @Mordante 's comment fixed and CI passing. Thanks!

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.iterator/input_or_output_iterator.compile.pass.cpp
54–71

It's not clear to me that testing *all* of those qualifiers adds that much value over just testing one of them. Non-blocking, but if I had written this myself, I wouldn't have tested all of them since it feels like diminishing returns to me.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.sentinel/sentinel_for.compile.pass.cpp
13

You seem to have missed this comment.

This revision is now accepted and ready to land.Apr 21 2021, 2:21 PM
cjdb updated this revision to Diff 339406.Apr 21 2021, 3:23 PM
cjdb marked 2 inline comments as done.

rebases to activate CI

cjdb updated this revision to Diff 339659.Apr 22 2021, 8:31 AM

rebases to activate CI

Mordante accepted this revision.Apr 22 2021, 12:41 PM

LGTM, but please address the two minor issues before landing https://reviews.llvm.org/D100160#inline-951054 and the comment below.
And please wait for the CI to turn green.

libcxx/test/std/iterators/iterator.requirements/iterator.concepts/locale_dependent.compile.pass.cpp
21

I still see this comment.

cjdb updated this revision to Diff 340076.Apr 23 2021, 9:22 AM

rebases to activate CI

cjdb updated this revision to Diff 340240.Apr 23 2021, 10:39 PM
cjdb marked 4 inline comments as done.
cjdb retitled this revision from [libcxx] adds `std::input_or_output_iterator` and `std::sentinel_for` to <iterator> to [libcxx][iterator] adds `std::input_or_output_iterator` and `std::sentinel_for`.