This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Granularise <thread> header
ClosedPublic

Authored by huixie90 on May 31 2023, 2:50 AM.

Details

Reviewers
Mordante
ldionne
Group Reviewers
Restricted Project
Commits
rGcea4285949b5: [libc++][NFC] Granularise <thread> header
Summary

Diff Detail

Event Timeline

huixie90 created this revision.May 31 2023, 2:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 2:50 AM
huixie90 requested review of this revision.May 31 2023, 2:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 2:50 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
huixie90 updated this revision to Diff 526990.May 31 2023, 4:03 AM

private headers

huixie90 updated this revision to Diff 527095.May 31 2023, 9:47 AM

missing includes

Mordante accepted this revision.May 31 2023, 10:21 AM
Mordante added a subscriber: Mordante.

LGTM after undoing the formatting changes and the CI passes.
Can you make two followup commits

  • format all the new files, I don't like to do that is the same commit, that makes tracking changes in git harder
  • modernize the code _LIBCPP_INLINE_VISIBILITY -> _LIBCPP_HIDE_FROM_ABI, _VSTD -> std, typedef -> using
libcxx/include/thread
111–115

Please don't mix formatting and splitting in one patch.

This revision is now accepted and ready to land.May 31 2023, 10:21 AM
huixie90 updated this revision to Diff 527761.Jun 1 2023, 11:56 PM
huixie90 marked an inline comment as done.

unformatting

huixie90 updated this revision to Diff 527794.Jun 2 2023, 3:24 AM

try again

ldionne accepted this revision.Jun 2 2023, 8:55 AM
ldionne added a subscriber: ldionne.

LGTM w/ a few comments and green CI.

libcxx/include/__thread/formatter.h
31–33

I think I would only keep this error message in the top-level <thread> header. That's just for consistency with e.g. <filesystem>. (here and everywhere else)

libcxx/include/thread
91–92

Let's remove those includes since they don't contribute to the public API of <thread>.

At first we tried to systematically include all headers from <__foo/*.h> inside <foo>, but we noticed it didn't work (I think it was causing circular dependency issues but I think @Mordante might remember more context) so now I guess the only consistent thing we can do is include only the ones that contribute to the public API of <foo>.

98–100

Let's fix those tests instead.

Mordante added inline comments.Jun 3 2023, 6:45 AM
libcxx/include/thread
91–92

I don't exactly recall. I thought still wanted to include all <__foo/*.h>. That might be less important nowadays since most headers use the granularized parts of a header instead of the entire header.

huixie90 updated this revision to Diff 532206.Jun 16 2023, 9:54 AM
huixie90 marked an inline comment as done.

rebase + trigger CI

huixie90 updated this revision to Diff 532207.Jun 16 2023, 9:56 AM
huixie90 marked 2 inline comments as done.

address issues

huixie90 updated this revision to Diff 532370.Jun 16 2023, 11:53 PM

rebase + CI

This revision was automatically updated to reflect the committed changes.
philnik added inline comments.
libcxx/include/thread
111–115

Why are these headers only removed when explicitly setting _LIBCPP_REMOVE_TRANSITIVE_INCLUDES?