This is an archive of the discontinued LLVM Phabricator instance.

[libc++][modularisation] Split <compare> into internal headers
ClosedPublic

Authored by rarutyun on Jul 15 2021, 3:57 PM.

Diff Detail

Event Timeline

rarutyun created this revision.Jul 15 2021, 3:57 PM
rarutyun requested review of this revision.Jul 15 2021, 3:57 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
cjdb requested changes to this revision.Jul 15 2021, 4:05 PM

This should be mostly ready to go (I'm a bit surprised we only need two headers). Two bits of feedback.

  1. Blocking: Please add these to the module map. The ranges.__ranges submodule should give you guidance on how to make the compare.__compare submodule. I'll LGTM once this is done.
  2. Non-blocking: I'd appreciate it if you could change [NFC] in your commit summary to [modularisation].
This revision now requires changes to proceed.Jul 15 2021, 4:05 PM
rarutyun updated this revision to Diff 361751.Jul 26 2021, 12:15 PM
rarutyun retitled this revision from [libc++][NFC] Split <compare> into internal headers to [libc++][modularisation] Split <compare> into internal headers.

This should be mostly ready to go (I'm a bit surprised we only need two headers). Two bits of feedback.

  1. Blocking: Please add these to the module map. The ranges.__ranges submodule should give you guidance on how to make the compare.__compare submodule. I'll LGTM once this is done.
  2. Non-blocking: I'd appreciate it if you could change [NFC] in your commit summary to [modularisation].

Done. Please check if everything correct

libcxx/include/__compare/ordering.h
10

I don't see the reason to create separate header for each ordering, but if you do I can change that.

This should be mostly ready to go (I'm a bit surprised we only need two headers).

Regarding just two headers. I expect them to be more in future because not everything is implemented in <compare> e.g. compare_three_way_result, some CPOs, etc. But for now I don't think it worth it to split ordering.h on separate partial, weak and strong unless you think opposite.

cjdb accepted this revision.EditedJul 26 2021, 12:23 PM

I'm happy with this once CI passes; @ldionne any thoughts?

libcxx/include/__compare/ordering.h
10

Since they're codependent, I'm fine with this.

Quuxplusone accepted this revision.Jul 26 2021, 12:45 PM
Quuxplusone added a subscriber: Quuxplusone.

LGTM mod nits.

libcxx/include/CMakeLists.txt
102–103

a-z plz

libcxx/include/__compare/common_comparison_category.h
10–11

I think our style would make this _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H — please check some other nested-directory files, and then change it here if I'm right.

13–14

a-z plz

30

If you want, a drive-by whitespace fix to unsigned { would be nice.

libcxx/include/compare
132–133

Is this needed now for some reason? (Historically we seem to have put __undef_macros only in files that actually use min or max as identifiers. If something breaks without these lines, it'd be nice to say in your commit message what it is; and if nothing breaks without these lines, then arguably they shouldn't be here. Although I'm not inclined to actually object.)

libcxx/include/module.modulemap
359–360

a-z plz

This revision is now accepted and ready to land.Jul 26 2021, 12:45 PM
cjdb added inline comments.Jul 26 2021, 1:16 PM
libcxx/include/compare
132–133

This maaaaay have indirectly been my doing. I used to include <__undef_macros> in all my headers before I understood its purpose. I think since then it's just been included in everything by accident at this point. I agree we should remove it, and we should probably action some mass-cleanup in the near future (since I'm apparently taking responsibility for the trend, it makes sense for me to do it).

rarutyun updated this revision to Diff 361812.Jul 26 2021, 2:41 PM
rarutyun marked 6 inline comments as done.Jul 26 2021, 2:44 PM
rarutyun added inline comments.
libcxx/include/__compare/common_comparison_category.h
10–11

Yes, you are right. I did it for ordering header but for some reason prefix was missed for this file

libcxx/include/module.modulemap
359–360

Actually I've found another mistake that is more important. `compare module was already there and I needed to just add private headers. Now it's done.

rarutyun marked 2 inline comments as done.Jul 26 2021, 2:45 PM
rarutyun updated this revision to Diff 361829.Jul 26 2021, 3:26 PM

clang-format applied

Quuxplusone accepted this revision.Jul 26 2021, 3:49 PM

One final nit, then ship it!
(Assuming you don't need someone to land this for you. But if you do, please ping me and I can do it.)

libcxx/include/module.modulemap
363–364

These two still need alphabetization between the two of them (i.e., switch their order).

rarutyun updated this revision to Diff 361849.Jul 26 2021, 4:32 PM
rarutyun marked an inline comment as done.
rarutyun added inline comments.
libcxx/include/module.modulemap
363–364

:) Done. Sorry for missing that, it's 2:30 am my timezone:)

rarutyun marked an inline comment as done.Jul 26 2021, 4:33 PM
ldionne accepted this revision.Jul 28 2021, 11:20 AM

LGTM once CI passes, and assuming you did not modify any code (only moving stuff around).

CI appears to be failing right now, so please make sure to have a green run before shipping.

LGTM once CI passes, and assuming you did not modify any code (only moving stuff around).

CI appears to be failing right now, so please make sure to have a green run before shipping.

Yep nothing in the code has changed. Only moving stuff here and there.

rarutyun updated this revision to Diff 362578.Jul 28 2021, 4:13 PM
rarutyun updated this revision to Diff 362581.Jul 28 2021, 4:32 PM

I figured out what was wrong with "Generated Output" step. I was needed to add generated tests to the commit as well. Previously I didn't know that but currently it is done. Waiting for the CI completion.

I also found the recent change in __get_comp_type function and also applied it to this patch.

There is a high probability that CI will be successful. If it's the case I would need somebody to commit this patch for me.

@Quuxplusone, if I remember correctly you volunteered to do that. Could you please help?

Full name: Ruslan Arutyunyan

Thanks.

There is a high probability that CI will be successful. If it's the case I would need somebody to commit this patch for me.
@Quuxplusone, if I remember correctly you volunteered to do that. Could you please help?
Full name: Ruslan Arutyunyan

Yes, I can land it. For that I also need your email address (which is probably gettable from Phabricator somehow, but it's not obvious ;)) because a Git committer ID is always of the form Bob Smith <bobs@example.com>.

For that I also need your email address (which is probably gettable from Phabricator somehow, but it's not obvious ;))

Didn't figure it out from Phab, but the mails sent to the reviews.llvm.org mailing list have it. I'll land this shortly.