Skip to content

Commit 9fe475f

Browse files
committed
[Frontend] Inline parseAndCheckTypesUpTo
`performSemaUpTo` will only shrink from here, so go ahead and inline `parseAndCheckTypesUpTo` into it already.
1 parent b78f474 commit 9fe475f

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ class CompilerInstance {
671671
ImplicitImportInfo getImplicitImportInfo() const;
672672

673673
void performSemaUpTo(SourceFile::ASTStage_t LimitStage);
674-
void parseAndCheckTypesUpTo(SourceFile::ASTStage_t LimitStage);
675674

676675
/// Return true if had load error
677676
bool parsePartialModulesAndInputFiles();

lib/Frontend/Frontend.cpp

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -794,32 +794,6 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
794794
MainBufferID);
795795
}
796796

797-
parseAndCheckTypesUpTo(LimitStage);
798-
}
799-
800-
bool CompilerInstance::loadStdlib() {
801-
FrontendStatsTracer tracer(getStatsReporter(), "load-stdlib");
802-
ModuleDecl *M = Context->getStdlibModule(true);
803-
804-
if (!M) {
805-
Diagnostics.diagnose(SourceLoc(), diag::error_stdlib_not_found,
806-
Invocation.getTargetTriple());
807-
return false;
808-
}
809-
810-
// If we failed to load, we should have already diagnosed
811-
if (M->failedToLoad()) {
812-
assert(Diagnostics.hadAnyError() &&
813-
"Module failed to load but nothing was diagnosed?");
814-
return false;
815-
}
816-
return true;
817-
}
818-
819-
void CompilerInstance::parseAndCheckTypesUpTo(
820-
SourceFile::ASTStage_t limitStage) {
821-
FrontendStatsTracer tracer(getStatsReporter(), "parse-and-check-types");
822-
823797
bool hadLoadError = parsePartialModulesAndInputFiles();
824798
if (hadLoadError)
825799
return;
@@ -833,7 +807,7 @@ void CompilerInstance::parseAndCheckTypesUpTo(
833807
MainModule->setHasResolvedImports();
834808

835809
forEachFileToTypeCheck([&](SourceFile &SF) {
836-
if (limitStage == SourceFile::ImportsResolved) {
810+
if (LimitStage == SourceFile::ImportsResolved) {
837811
bindExtensions(SF);
838812
return;
839813
}
@@ -849,13 +823,32 @@ void CompilerInstance::parseAndCheckTypesUpTo(
849823
});
850824

851825
// If the limiting AST stage is import resolution, we're done.
852-
if (limitStage <= SourceFile::ImportsResolved) {
826+
if (LimitStage <= SourceFile::ImportsResolved) {
853827
return;
854828
}
855829

856830
finishTypeChecking();
857831
}
858832

833+
bool CompilerInstance::loadStdlib() {
834+
FrontendStatsTracer tracer(getStatsReporter(), "load-stdlib");
835+
ModuleDecl *M = Context->getStdlibModule(true);
836+
837+
if (!M) {
838+
Diagnostics.diagnose(SourceLoc(), diag::error_stdlib_not_found,
839+
Invocation.getTargetTriple());
840+
return false;
841+
}
842+
843+
// If we failed to load, we should have already diagnosed
844+
if (M->failedToLoad()) {
845+
assert(Diagnostics.hadAnyError() &&
846+
"Module failed to load but nothing was diagnosed?");
847+
return false;
848+
}
849+
return true;
850+
}
851+
859852
bool CompilerInstance::parsePartialModulesAndInputFiles() {
860853
FrontendStatsTracer tracer(getStatsReporter(),
861854
"parse-partial-modules-and-input-files");

0 commit comments

Comments
 (0)