[Serialization] Intro package-only module wide information and serialize it

This commit is contained in:
Alexis Laferrière
2023-02-21 20:30:16 -08:00
parent cceafcf4ee
commit 6980cf211b
9 changed files with 34 additions and 9 deletions

View File

@@ -1214,7 +1214,8 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
M->getImportedModules(allImports,
{ModuleDecl::ImportFilterKind::Exported,
ModuleDecl::ImportFilterKind::Default,
ModuleDecl::ImportFilterKind::ImplementationOnly});
ModuleDecl::ImportFilterKind::ImplementationOnly,
ModuleDecl::ImportFilterKind::PackageOnly});
ImportedModule::removeDuplicates(allImports);
// Collect the public and private imports as a subset so that we can
@@ -1223,6 +1224,8 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Exported);
ImportSet privateImportSet =
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Default);
ImportSet packageOnlyImportSet =
getImportsAsSet(M, ModuleDecl::ImportFilterKind::PackageOnly);
auto clangImporter =
static_cast<ClangImporter *>(M->getASTContext().getClangModuleLoader());
@@ -1270,6 +1273,8 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
stableImportControl = ImportControl::Exported;
else if (privateImportSet.count(import))
stableImportControl = ImportControl::Normal;
else if (packageOnlyImportSet.count(import))
stableImportControl = ImportControl::PackageOnly;
else
stableImportControl = ImportControl::ImplementationOnly;