@@ -1127,24 +1127,19 @@ bool ModuleDecl::isSystemModule() const {
1127
1127
return false ;
1128
1128
}
1129
1129
1130
- template <bool respectVisibility, typename Callback>
1131
- static bool forAllImportedModules (ModuleDecl *topLevel,
1132
- ModuleDecl::AccessPathTy thisPath,
1133
- bool includePrivateTopLevelImports,
1134
- const Callback &fn) {
1130
+ template <bool respectVisibility>
1131
+ static bool
1132
+ forAllImportedModules (ModuleDecl *topLevel, ModuleDecl::AccessPathTy thisPath,
1133
+ llvm::function_ref<bool (ModuleDecl::ImportedModule)> fn) {
1135
1134
using ImportedModule = ModuleDecl::ImportedModule;
1136
1135
using AccessPathTy = ModuleDecl::AccessPathTy;
1137
1136
1138
1137
llvm::SmallSet<ImportedModule, 32 , ModuleDecl::OrderImportedModules> visited;
1139
1138
SmallVector<ImportedModule, 32 > stack;
1140
1139
1141
- // Even if we're processing the top-level module like any other, we may
1142
- // still want to include non-exported modules.
1143
- ModuleDecl::ImportFilter filter = respectVisibility ? ModuleDecl::ImportFilter::Public
1144
- : ModuleDecl::ImportFilter::All;
1145
- ModuleDecl::ImportFilter topLevelFilter =
1146
- includePrivateTopLevelImports ? ModuleDecl::ImportFilter::All : filter;
1147
- topLevel->getImportedModules (stack, topLevelFilter);
1140
+ auto filter = respectVisibility ? ModuleDecl::ImportFilter::Public
1141
+ : ModuleDecl::ImportFilter::All;
1142
+ topLevel->getImportedModules (stack, filter);
1148
1143
1149
1144
// Make sure the top-level module is first; we want pre-order-ish traversal.
1150
1145
AccessPathTy overridingPath;
@@ -1182,11 +1177,10 @@ static bool forAllImportedModules(ModuleDecl *topLevel,
1182
1177
return true ;
1183
1178
}
1184
1179
1185
- bool ModuleDecl::forAllVisibleModules (AccessPathTy thisPath,
1186
- bool includePrivateTopLevelImports,
1187
- llvm::function_ref<bool (ImportedModule)> fn) {
1188
- return forAllImportedModules<true >(this , thisPath,
1189
- includePrivateTopLevelImports, fn);
1180
+ bool
1181
+ ModuleDecl::forAllVisibleModules (AccessPathTy thisPath,
1182
+ llvm::function_ref<bool (ImportedModule)> fn) {
1183
+ return forAllImportedModules<true >(this , thisPath, fn);
1190
1184
}
1191
1185
1192
1186
bool FileUnit::forAllVisibleModules (
@@ -1215,7 +1209,6 @@ void ModuleDecl::collectLinkLibraries(LinkLibraryCallback callback) {
1215
1209
void
1216
1210
SourceFile::collectLinkLibraries (ModuleDecl::LinkLibraryCallback callback) const {
1217
1211
forAllImportedModules<false >(getParentModule (), /* thisPath*/ {},
1218
- /* includePrivateTopLevelImports*/ false ,
1219
1212
[=](ModuleDecl::ImportedModule import ) -> bool {
1220
1213
swift::ModuleDecl *next = import .second ;
1221
1214
if (next->getName () == getParentModule ()->getName ())
0 commit comments