Page MenuHomePhabricator

[C++20] [Module] Support reachable definition initially/partially
Changes PlannedPublic

Authored by ChuanqiXu on Nov 10 2021, 12:11 AM.

Details

Summary

This fixes: https://bugs.llvm.org/show_bug.cgi?id=52281 and https://godbolt.org/z/81f3ocjfW.

This patch introduces a new kind of ModuleOwnershipKind as ReachableWhenImported. This intended the status for reachable described at: https://eel.is/c++draft/module.reach#3.

Note that this patch is not intended to support all semantics about reachable semantics.

An important feature not included in this patch is discarding declaration in global module fragment. See https://eel.is/c++draft/module.global.frag#3 and https://eel.is/c++draft/module.global.frag#4. This feature is important since it would cut off many unused declarations so that user could import a large module without worrying it would be too heavy. And I think this is related to the bug https://bugs.llvm.org/show_bug.cgi?id=52342 mentioned @rsmith .

But after all, I think it is not easy to implement in one shot. So this patch didn't contain that feature. In other words, now all the declarations in the global module fragment are reachable even they could be reduced. But this is not worse than the current situation. So I think it may not be unacceptable.

Test Plan: check-all and https://godbolt.org/z/81f3ocjfW.

Diff Detail

Event Timeline

ChuanqiXu created this revision.Nov 10 2021, 12:11 AM
ChuanqiXu requested review of this revision.Nov 10 2021, 12:11 AM
ChuanqiXu updated this revision to Diff 393028.Dec 8 2021, 10:11 PM

Update comments.

ChuanqiXu planned changes to this revision.Dec 9 2021, 3:48 AM

I think it would be better to resent this when it is more complete.