Skip to content

Commit 4c7ccf5

Browse files
committed
[NFC] Clean Up FrontendTool
Try to impose a simple structure that splits performing actions from the pre and post-pipeline conditions. Wherever actions would take more than a simple return, split them into functions. Refine functions that perform effects to return status codes when they fail. Finally, delineate functions that need semantic analysis from those that do not. Overall this should be NFC.
1 parent 83b50cd commit 4c7ccf5

File tree

7 files changed

+204
-172
lines changed

7 files changed

+204
-172
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ class CompilerInstance {
621621
///
622622
/// This is similar to a parse-only invocation, but module imports will also
623623
/// be processed.
624-
void performParseAndResolveImportsOnly();
624+
bool performParseAndResolveImportsOnly();
625625

626626
/// Performs mandatory, diagnostic, and optimization passes over the SIL.
627627
/// \param silModule The SIL module that was generated during SILGen.

lib/Frontend/Frontend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ void CompilerInstance::setMainModule(ModuleDecl *newMod) {
848848
Context->addLoadedModule(newMod);
849849
}
850850

851-
void CompilerInstance::performParseAndResolveImportsOnly() {
851+
bool CompilerInstance::performParseAndResolveImportsOnly() {
852852
FrontendStatsTracer tracer(getStatsReporter(), "parse-and-resolve-imports");
853853

854854
// Resolve imports for all the source files.
@@ -867,6 +867,7 @@ void CompilerInstance::performParseAndResolveImportsOnly() {
867867
mainModule->setHasResolvedImports();
868868

869869
bindExtensions(*mainModule);
870+
return Context->hadError();
870871
}
871872

872873
void CompilerInstance::performSema() {

0 commit comments

Comments
 (0)