Skip to content

Commit dee1bb2

Browse files
committed
[NFC] Use an Iterator Again in WMO Type Checking
1 parent 0d117c1 commit dee1bb2

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,19 +1168,13 @@ bool CompilerInstance::loadPartialModulesAndImplicitImports(
11681168
bool CompilerInstance::forEachFileToTypeCheck(
11691169
llvm::function_ref<bool(SourceFile &)> fn) {
11701170
if (isWholeModuleCompilation()) {
1171-
// FIXME: Do not refactor this to use an iterator as long as
1172-
// ModuleDecl::addFile is called during Sema. Synthesized files pushed
1173-
// during semantic analysis will cause iterator invalidation here.
1174-
// See notes in SourceFile::getOrCreateSynthesizedFile() for more.
1175-
unsigned i = 0;
1176-
while (i < getMainModule()->getFiles().size()) {
1177-
auto *SF = dyn_cast<SourceFile>(getMainModule()->getFiles()[i++]);
1171+
for (auto fileName : getMainModule()->getFiles()) {
1172+
auto *SF = dyn_cast<SourceFile>(fileName);
11781173
if (!SF) {
11791174
continue;
11801175
}
11811176
if (fn(*SF))
11821177
return true;
1183-
;
11841178
}
11851179
} else {
11861180
for (auto *SF : getPrimarySourceFiles()) {

0 commit comments

Comments
 (0)