Skip to content

Commit 8408f82

Browse files
committed
Serialization: Replace ModuleDecl::ImportFilter math with explicit switch statements
This one is particularly obnoxious.
1 parent 2535867 commit 8408f82

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

lib/Serialization/ModuleFile.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,9 +1591,26 @@ void ModuleFile::getImportedModules(
15911591
PrettyStackTraceModuleFile stackEntry(*this);
15921592

15931593
for (auto &dep : Dependencies) {
1594-
if (filter != ModuleDecl::ImportFilter::All &&
1595-
(filter == ModuleDecl::ImportFilter::Public) ^ dep.isExported())
1596-
continue;
1594+
switch (filter) {
1595+
case ModuleDecl::ImportFilter::All:
1596+
// We're including all imports.
1597+
break;
1598+
1599+
case ModuleDecl::ImportFilter::Private:
1600+
// Skip @_exported imports.
1601+
if (dep.isExported())
1602+
continue;
1603+
1604+
break;
1605+
1606+
case ModuleDecl::ImportFilter::Public:
1607+
// Only include @_exported imports.
1608+
if (!dep.isExported())
1609+
continue;
1610+
1611+
break;
1612+
}
1613+
15971614
assert(dep.isLoaded());
15981615
results.push_back(dep.Import);
15991616
}

0 commit comments

Comments
 (0)