This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][modularisation] properly modularises advance, next, and prev
ClosedPublic

Authored by cjdb on Jun 28 2021, 8:55 PM.

Details

Summary

__function_like wasn't being exported, so certain properties of the
ranges functions weren't being propagated in modules land.

Diff Detail

Event Timeline

cjdb created this revision.Jun 28 2021, 8:55 PM
cjdb requested review of this revision.Jun 28 2021, 8:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2021, 8:55 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
cjdb added a comment.Jun 28 2021, 8:57 PM

Distinct from D105076 since this patch does more than just splicing.

cjdb updated this revision to Diff 360611.Jul 21 2021, 2:57 PM
cjdb edited the summary of this revision. (Show Details)
  • simplifies patch based on current libc++ trajectory
zoecarver accepted this revision as: zoecarver.Jul 21 2021, 3:01 PM

Thanks for the cleanup.

libcxx/include/module.modulemap
481–484

I don't like the formatting here. But whatever.

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/special_function.compile.pass.cpp
17

Don't we still support clang-13 or am I missing something? Does this patch work around the bug?

Quuxplusone requested changes to this revision.Jul 21 2021, 3:08 PM
Quuxplusone added a subscriber: Quuxplusone.
Quuxplusone added inline comments.
libcxx/include/module.modulemap
481–484

There should be no need to export __function_like here. Then it'll all fit on one line, consistent with all the other lines, so there won't be a formatting problem anymore.

787

Probably this private is the original problem. What happens if you remove it?
(Compare to __hash_table, __nullptr, etc.)

This revision now requires changes to proceed.Jul 21 2021, 3:08 PM
cjdb marked 2 inline comments as done.Jul 21 2021, 3:17 PM
cjdb added inline comments.
libcxx/include/module.modulemap
481–484

I don't like the formatting here. But whatever.

Yeah, I didn't notice till after I threw it up on Phab. Will fix before merging.

There should be no need to export __function_like here. Then it'll all fit on one line, consistent with all the other lines, so there won't be a formatting problem anymore.

There is a need to export __function_like. I've gone into this in other patches before, so I'm not going to repeat myself here.

787

Nope. Nothing gets fixed because this isn't the problem.

libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/special_function.compile.pass.cpp
17

This patch isn't a workaround: it's the correct fix.

Mordante accepted this revision.Jul 22 2021, 1:26 AM

LGTM, but please hold off landing a short time to give @Quuxplusone an opportunity to respond.

libcxx/include/module.modulemap
481–484

There should be no need to export __function_like here.

I agree, but clang disagrees. I had the same issue in my format series, before we made these headers private.
I know no other solution than what @cjdb did here.

libcxx/include/__iterator/advance.h
73

Btw, should there be a private here? __next_fn and __prev_fn both use private inheritance here, not public inheritance. At least we should be consistent.
(obsoleted by D106567)

libcxx/include/module.modulemap
481–484

I've looked into it a bit, and uploaded D106567 with a simpler fix.

cjdb marked 2 inline comments as done.Jul 22 2021, 1:02 PM

@ldionne now needs to weigh in on this in order for any progress to be made, which I was hoping to avoid.

libcxx/include/module.modulemap
481–484

You have a strange definition of the word "simpler".

ldionne accepted this revision.Jul 22 2021, 1:31 PM

Ah-Ah! So that was the issue all along then.

IMO this module-specific fix is cleaner than using a macro just to satisfy the modules build.

This revision was not accepted when it landed; it landed in state Needs Revision.Jul 22 2021, 4:30 PM
This revision was automatically updated to reflect the committed changes.