[Sema] Intro set of import filters for general use

Calling getImportedModules requires to list the desired kind of imports.
With the new kind of imports this has become cumbersome. Let's simplify
it by offering common sets of imports. Advanced call sites can still
list the desired imports explicitly.
This commit is contained in:
Alexis Laferrière
2023-03-09 15:20:52 -08:00
parent 2bc92a6a59
commit 205a2edf38
11 changed files with 41 additions and 60 deletions

View File

@@ -83,11 +83,7 @@ bool swift::emitImportedModules(ModuleDecl *mainModule,
if (!clangImporter->importBridgingHeader(implicitHeaderPath, mainModule)) {
SmallVector<ImportedModule, 16> imported;
clangImporter->getImportedHeaderModule()->getImportedModules(
imported, {ModuleDecl::ImportFilterKind::Exported,
ModuleDecl::ImportFilterKind::Default,
ModuleDecl::ImportFilterKind::ImplementationOnly,
ModuleDecl::ImportFilterKind::PackageOnly,
ModuleDecl::ImportFilterKind::SPIOnly});
imported, ModuleDecl::getImportFilterLocal());
for (auto IM : imported) {
if (auto clangModule = IM.importedModule->findUnderlyingClangModule())