Skip to content

Commit 854d6ee

Browse files
committed
[NFC] Remove forEachSourceFileIn
We actually wanted to use forEachFileToTypeCheck, which will restrict the source files we analyze to just the given primaries in incremental mode, and the whole module's source files otherwise.
1 parent 921180f commit 854d6ee

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -862,19 +862,16 @@ bool CompilerInstance::loadPartialModulesAndImplicitImports() {
862862
return hadLoadError;
863863
}
864864

865-
static void
866-
forEachSourceFileIn(ModuleDecl *module,
867-
llvm::function_ref<void(SourceFile &)> fn) {
868-
for (auto fileName : module->getFiles()) {
869-
if (auto SF = dyn_cast<SourceFile>(fileName))
870-
fn(*SF);
871-
}
872-
}
873-
874865
void CompilerInstance::forEachFileToTypeCheck(
875866
llvm::function_ref<void(SourceFile &)> fn) {
876867
if (isWholeModuleCompilation()) {
877-
forEachSourceFileIn(MainModule, [&](SourceFile &SF) { fn(SF); });
868+
for (auto fileName : MainModule->getFiles()) {
869+
auto *SF = dyn_cast<SourceFile>(fileName);
870+
if (!SF) {
871+
continue;
872+
}
873+
fn(*SF);
874+
}
878875
} else {
879876
for (auto *SF : PrimarySourceFiles) {
880877
fn(*SF);
@@ -883,7 +880,7 @@ void CompilerInstance::forEachFileToTypeCheck(
883880
}
884881

885882
void CompilerInstance::finishTypeChecking() {
886-
forEachSourceFileIn(MainModule, [&](SourceFile &SF) {
883+
forEachFileToTypeCheck([](SourceFile &SF) {
887884
performWholeModuleTypeChecking(SF);
888885
});
889886
}

0 commit comments

Comments
 (0)