File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1889,6 +1889,12 @@ class SILGenModuleRAII {
1889
1889
SGM.visit (D);
1890
1890
}
1891
1891
1892
+ for (Decl *D : sf->getHoistedDecls ()) {
1893
+ FrontendStatsTracer StatsTracer (SGM.getASTContext ().Stats ,
1894
+ " SILgen-decl" , D);
1895
+ SGM.visit (D);
1896
+ }
1897
+
1892
1898
for (TypeDecl *TD : sf->LocalTypeDecls ) {
1893
1899
FrontendStatsTracer StatsTracer (SGM.getASTContext ().Stats ,
1894
1900
" SILgen-tydecl" , TD);
Original file line number Diff line number Diff line change @@ -346,7 +346,13 @@ void StmtEmitter::visitBraceStmt(BraceStmt *S) {
346
346
} else if (auto *E = ESD.dyn_cast <Expr*>()) {
347
347
SGF.emitIgnoredExpr (E);
348
348
} else {
349
- SGF.visit (ESD.get <Decl*>());
349
+ auto *D = ESD.get <Decl*>();
350
+
351
+ // Hoisted declarations are emitted at the top level by emitSourceFile().
352
+ if (D->isHoisted ())
353
+ continue ;
354
+
355
+ SGF.visit (D);
350
356
}
351
357
}
352
358
}
You can’t perform that action at this time.
0 commit comments