Skip to content

Commit a12f42c

Browse files
committed
AST: Fold forAllImportedModules() into forAllVisibleModules()
1 parent 0c32c54 commit a12f42c

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

lib/AST/Module.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,18 +1127,15 @@ bool ModuleDecl::isSystemModule() const {
11271127
return false;
11281128
}
11291129

1130-
static bool forAllImportedModules(ModuleDecl *topLevel,
1131-
ModuleDecl::AccessPathTy thisPath,
1132-
llvm::function_ref<bool(ModuleDecl::ImportedModule)> fn) {
1133-
using ImportedModule = ModuleDecl::ImportedModule;
1134-
1130+
bool ModuleDecl::forAllVisibleModules(AccessPathTy thisPath,
1131+
llvm::function_ref<bool(ImportedModule)> fn) {
11351132
llvm::SmallSet<ImportedModule, 32, ModuleDecl::OrderImportedModules> visited;
11361133
SmallVector<ImportedModule, 32> stack;
11371134

1138-
topLevel->getImportedModules(stack, ModuleDecl::ImportFilter::Public);
1135+
getImportedModules(stack, ModuleDecl::ImportFilter::Public);
11391136

11401137
// Make sure the top-level module is first; we want pre-order-ish traversal.
1141-
stack.push_back(ImportedModule(thisPath, topLevel));
1138+
stack.push_back(ImportedModule(thisPath, this));
11421139

11431140
while (!stack.empty()) {
11441141
auto next = stack.pop_back_val();
@@ -1167,11 +1164,6 @@ static bool forAllImportedModules(ModuleDecl *topLevel,
11671164
return true;
11681165
}
11691166

1170-
bool ModuleDecl::forAllVisibleModules(AccessPathTy thisPath,
1171-
llvm::function_ref<bool(ImportedModule)> fn) {
1172-
return forAllImportedModules(this, thisPath, fn);
1173-
}
1174-
11751167
bool FileUnit::forAllVisibleModules(
11761168
llvm::function_ref<bool(ModuleDecl::ImportedModule)> fn) {
11771169
if (!getParentModule()->forAllVisibleModules(ModuleDecl::AccessPathTy(), fn))

0 commit comments

Comments
 (0)