File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -1168,19 +1168,13 @@ bool CompilerInstance::loadPartialModulesAndImplicitImports(
11681168bool 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 ()) {
Original file line number Diff line number Diff line change @@ -1340,8 +1340,11 @@ static void performParallelIRGeneration(IRGenDescriptor desc) {
13401340
13411341 for (auto *File : M->getFiles ()) {
13421342 if (auto *SF = dyn_cast<SourceFile>(File)) {
1343- CurrentIGMPtr IGM = irgen.getGenModule (SF);
1344- IGM->emitSourceFile (*SF);
1343+ {
1344+ CurrentIGMPtr IGM = irgen.getGenModule (SF);
1345+ IGM->emitSourceFile (*SF);
1346+ }
1347+
13451348 if (auto *synthSFU = File->getSynthesizedFile ()) {
13461349 CurrentIGMPtr IGM = irgen.getGenModule (synthSFU);
13471350 IGM->emitSynthesizedFileUnit (*synthSFU);
You can’t perform that action at this time.
0 commit comments