This is an archive of the discontinued LLVM Phabricator instance.

[libc++][nfc] Move incrementable_traits and indirectly_readable_traits into separate headers.
ClosedPublic

Authored by zoecarver on Apr 16 2021, 1:28 PM.

Diff Detail

Event Timeline

zoecarver created this revision.Apr 16 2021, 1:28 PM
zoecarver requested review of this revision.Apr 16 2021, 1:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2021, 1:28 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Apr 16 2021, 1:30 PM

LGTM with fixes applied and CI passing. Thanks!

libcxx/include/__iterator/incrementable_traits.h
2

This needs a license. What I generally do is copy-paste an existing header and replace the contents. That makes sure I get the right boilerplate (not that we shouldn't work on reducing that boilerplate if possible, especially the pragma stuff).

libcxx/include/__iterator/readable_traits.h
17

It would make sense to hoist that out of this file and into <iterator>. Same for incrementable traits.

This revision is now accepted and ready to land.Apr 16 2021, 1:30 PM
zoecarver added inline comments.Apr 16 2021, 1:32 PM
libcxx/include/__iterator/readable_traits.h
17

Eh, I don't know. I'd be OK doing that and adding an #error here if it's not defined. I'd kind of like all our headers to always be includable, though.

zoecarver updated this revision to Diff 338217.Apr 16 2021, 1:33 PM
  • Add licence comment.
ldionne added inline comments.Apr 16 2021, 1:34 PM
libcxx/include/__iterator/readable_traits.h
17

Ok, this is non-blocking anyway, feel free to leave as-is. Actually when we only support compilers that support concepts, this will become #if C++ >= 20, which we should leave in this header. So it makes sense to keep.

zoecarver added inline comments.Apr 16 2021, 1:34 PM
libcxx/include/__iterator/readable_traits.h
17

SGTM.

cjdb accepted this revision.Apr 16 2021, 2:23 PM

LGTM with changes applied.

libcxx/include/__iterator/incrementable_traits.h
60

Please delete this now that we have the design doc.

libcxx/include/concepts
443–454

Please put these in __iterator/concepts.h. They shouldn't be in <concepts>.

zoecarver updated this revision to Diff 338239.Apr 16 2021, 2:33 PM
  • Apply cjdb's comments.
zoecarver updated this revision to Diff 338245.Apr 16 2021, 2:40 PM

I accidently updated this patch instead of D100686. So, I'm just putting back the correct patch here.

cjdb added inline comments.Apr 16 2021, 11:05 PM
libcxx/include/__iterator/concepts.h
1

I made a mistake: putting them in this header will create circular dependencies, since iterator_traits needs these exposition-only concepts and __iterator_traits/concepts.h will depends on iterator_traits. They, along with the cpp17-*-iterator concepts should either be in __iterator/iterator_traits.h.