Merge exported modules with the same public name in generated interface

If a module has the same `public-module-name` as the module being
generated and its import is exported, merge it into the same generated
interface.

Fix various always-imported modules from being printed while here and
update all the tests that checked for them.

Resolves rdar://137887712.
This commit is contained in:
Ben Barham
2025-04-21 11:24:31 -07:00
parent 6735659d39
commit ddddc667c8
35 changed files with 3500 additions and 3640 deletions

View File

@@ -764,7 +764,8 @@ static StringRef getModuleName(const ValueDecl *VD,
// overlay's declaring module as the owning module.
if (ModuleDecl *Declaring = MD->getDeclaringModuleIfCrossImportOverlay())
MD = Declaring;
return MD->getNameStr();
return MD->getPublicModuleName(/*onlyIfImported=*/false).str();
}
struct DeclInfo {