This is an archive of the discontinued LLVM Phabricator instance.

[C++20][Modules][4/8] Handle generation of partition implementation CMIs.
ClosedPublic

Authored by iains on Jan 31 2022, 2:28 AM.

Details

Summary

Partition implementations are special, they generate a CMI, but it
does not have an 'export' line, and we cannot export anything from the
it [that is it can only make decls available to other members of the
owning module, not to importers of that].

Diff Detail

Event Timeline

iains created this revision.Jan 31 2022, 2:28 AM
iains updated this revision to Diff 405593.Feb 3 2022, 5:30 AM

rebased onto import state machine

iains updated this revision to Diff 408762.Feb 15 2022, 1:25 AM

Rebased onto other modules work.

iains updated this revision to Diff 408862.Feb 15 2022, 7:07 AM

Update formatting

iains published this revision for review.Feb 15 2022, 8:32 AM

this is the fourth patch of eight to implement basic C++20 module partition support.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2022, 8:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
iains updated this revision to Diff 409202.Feb 16 2022, 4:15 AM

rebased onto changes in parent patches.

iains retitled this revision from [C++20][Modules] Handle generation of partition implementation CMIs. to [C++20][Modules][4/8] Handle generation of partition implementation CMIs..Feb 16 2022, 4:16 AM
urnathan accepted this revision.Feb 16 2022, 7:22 AM

with the assert fixed

clang/lib/Sema/SemaModule.cpp
123

llvm::unreachable ("how did we get a partition type set?");

clang/test/Modules/cxx20-10-1-ex1.cpp
22

I think I'm getting used to this idiom, or maybe Stockholm has kicked in?

This revision is now accepted and ready to land.Feb 16 2022, 7:22 AM
ChuanqiXu added inline comments.Feb 17 2022, 1:28 AM
clang/test/Modules/cxx20-10-1-ex1.cpp
8–9

In my implementation, I replace ':' to '-' in pcm filename. I do so since I remember this is the behavior of GCC. I think '-' is better than '_' since '_' is possible to occur in name.

And I am surprised that the compiler wouldn't complain about that it couldn't find the corresponding pcm. Since I don't see corresponding code so far.

iains updated this revision to Diff 409627.Feb 17 2022, 6:35 AM
iains marked 2 inline comments as done.

address review comments, rebase

clang/test/Modules/cxx20-10-1-ex1.cpp
8–9

The filename could/should be completely decoupled from the module name; changing the filenames to something randomly chosen should make no difference to the tests passing.

I made a comment on why/how this works in 3/8 in reply a similar comment made there (essentially the pairing of module-name and filename is something known by the lmodule loader and/or the header search mechanisms - it is not something that Sema needs to know).

22

we are all hostage to some style decisions made by others?
FAOD, the idiom is not my device, I plagiarised ...

iains updated this revision to Diff 409637.Feb 17 2022, 6:57 AM

fix a typo

iains updated this revision to Diff 410514.Feb 22 2022, 5:34 AM

rebased, revised testcases to use split-file.

This revision was landed with ongoing or failed builds.Feb 25 2022, 1:33 AM
This revision was automatically updated to reflect the committed changes.