@@ -777,35 +777,15 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) {
777
777
}
778
778
779
779
void CompilerInstance::performParseAndResolveImportsOnly () {
780
- performSemaUpTo (SourceFile::ImportsResolved);
781
- }
782
-
783
- void CompilerInstance::performSema () {
784
- performSemaUpTo (SourceFile::TypeChecked);
785
- }
786
-
787
- void CompilerInstance::performSemaUpTo (SourceFile::ASTStage_t LimitStage) {
788
- FrontendStatsTracer tracer (getStatsReporter (), " perform-sema" );
789
-
790
- ModuleDecl *mainModule = getMainModule ();
780
+ FrontendStatsTracer tracer (getStatsReporter (), " parse-and-resolve-imports" );
791
781
792
- // Then parse all the input files.
782
+ // Resolve imports for all the source files.
783
+ auto *mainModule = getMainModule ();
793
784
for (auto *file : mainModule->getFiles ()) {
794
- auto *SF = dyn_cast<SourceFile>(file);
795
- if (!SF)
796
- continue ;
797
-
798
- // Trigger parsing of the file.
799
- if (LimitStage == SourceFile::Unprocessed) {
800
- (void )SF->getTopLevelDecls ();
801
- } else {
785
+ if (auto *SF = dyn_cast<SourceFile>(file))
802
786
performImportResolution (*SF);
803
- }
804
787
}
805
788
806
- if (LimitStage == SourceFile::Unprocessed)
807
- return ;
808
-
809
789
assert (llvm::all_of (mainModule->getFiles (), [](const FileUnit *File) -> bool {
810
790
auto *SF = dyn_cast<SourceFile>(File);
811
791
if (!SF)
@@ -815,10 +795,12 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
815
795
mainModule->setHasResolvedImports ();
816
796
817
797
bindExtensions (*mainModule);
798
+ }
818
799
819
- // If the limiting AST stage is import resolution, we're done.
820
- if (LimitStage == SourceFile::ImportsResolved)
821
- return ;
800
+ void CompilerInstance::performSema () {
801
+ performParseAndResolveImportsOnly ();
802
+
803
+ FrontendStatsTracer tracer (getStatsReporter (), " perform-sema" );
822
804
823
805
forEachFileToTypeCheck ([&](SourceFile &SF) {
824
806
performTypeChecking (SF);
0 commit comments