This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Include <__iterator/distance.h> instead of <iterator> in a few algorithm headers
ClosedPublic

Authored by jloser on Aug 19 2021, 10:48 AM.

Details

Summary

A few headers in algorithm include <iterator> when
<__iterator/distance.h> would suffice. Change them to just include
<__iterator.distance.h>.

Diff Detail

Event Timeline

jloser requested review of this revision.Aug 19 2021, 10:48 AM
jloser created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2021, 10:48 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
jloser edited the summary of this revision. (Show Details)
jloser edited the summary of this revision. (Show Details)
cjdb accepted this revision.Aug 19 2021, 10:51 AM

This seems obviously correct to me.

@cjdb thanks for the quick review. I don't have commit rights -- do you mind committing on my behalf, please?

cjdb added inline comments.Aug 19 2021, 10:51 AM
libcxx/include/__algorithm/equal.h
16–17

Please sort these alphabetically.

cjdb added a comment.Aug 19 2021, 10:52 AM

@cjdb thanks for the quick review. I don't have commit rights -- do you mind committing on my behalf, please?

Sure. Upload the new patch, and I'll take care of it post-CI.

jloser updated this revision to Diff 367550.Aug 19 2021, 10:53 AM

Sort includes in libcxx/include/__algorithm/equal.h

@cjdb thanks for the quick review. I don't have commit rights -- do you mind committing on my behalf, please?

Sure. Upload the new patch, and I'll take care of it post-CI.

Thanks -- just updated the patch to sort the includes.

Mordante accepted this revision as: Mordante.Aug 19 2021, 11:01 AM
Mordante added a subscriber: Mordante.

LGTM, provided the build passes.

ldionne accepted this revision.Aug 19 2021, 11:46 AM
This revision is now accepted and ready to land.Aug 19 2021, 11:46 AM
libcxx/include/__algorithm/equal.h
16–17

You need <type_traits> in both places now, for add_lvalue_reference_t. Otherwise the modules build breaks.

jloser updated this revision to Diff 367581.Aug 19 2021, 12:05 PM

Include <type_traits> for add_lvalue_reference

jloser marked 2 inline comments as done.Aug 19 2021, 12:05 PM
jloser added inline comments.
libcxx/include/__algorithm/equal.h
16–17

Fixed. Good spot, @Quuxplusone.

@Quuxplusone do you want to land this and then have https://reviews.llvm.org/D108400 rebase with it or just pursue https://reviews.llvm.org/D108400 instead of this? CI just passed for this diff.

@Quuxplusone do you want to land this and then have D108400 rebase with it or just pursue D108400 instead of this? CI just passed for this diff.

Once D108400 gets the OK from @ldionne I'll land it. If D108393 lands first, I'll rebase. If D108400 lands first, I'll close D108393. I don't think it matters whether D108393 is landed or not.

@Quuxplusone do you want to land this and then have D108400 rebase with it or just pursue D108400 instead of this? CI just passed for this diff.

Once D108400 gets the OK from @ldionne I'll land it. If D108393 lands first, I'll rebase. If D108400 lands first, I'll close D108393. I don't think it matters whether D108393 is landed or not.

Fair enough. I don't have commit rights, so I'll need someone else to commit this on my behalf if we want to land this standalone.