Change ModuleDecl::getImportedModules to take an option set

...in preparation for me adding a third kind of import, making the
existing "All" kind a problem. NFC, except that I did rewrite the
ClangModuleUnit implementation of getImportedModules to be simpler!
This commit is contained in:
Jordan Rose
2018-12-13 17:45:06 -08:00
parent a62c87f6cd
commit 9ed3fe061d
18 changed files with 97 additions and 102 deletions

View File

@@ -1695,24 +1695,12 @@ void ModuleFile::getImportedModules(
PrettyStackTraceModuleFile stackEntry(*this);
for (auto &dep : Dependencies) {
switch (filter) {
case ModuleDecl::ImportFilter::All:
// We're including all imports.
break;
case ModuleDecl::ImportFilter::Private:
// Skip @_exported imports.
if (dep.isExported())
if (dep.isExported()) {
if (!filter.contains(ModuleDecl::ImportFilterKind::Public))
continue;
break;
case ModuleDecl::ImportFilter::Public:
// Only include @_exported imports.
if (!dep.isExported())
} else {
if (!filter.contains(ModuleDecl::ImportFilterKind::Private))
continue;
break;
}
assert(dep.isLoaded());