Skip to content

[FrontendTool] [NFC] Reduce scope of FrontendObserver #20901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions include/swift/FrontendTool/FrontendTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@ class FrontendObserver {

/// The frontend has configured the compiler instance.
virtual void configuredCompiler(CompilerInstance &instance);

/// The frontend has performed semantic analysis.
virtual void performedSemanticAnalysis(CompilerInstance &instance);

/// The frontend has performed basic SIL generation.
/// SIL diagnostic passes have not yet been applied.
virtual void performedSILGeneration(SILModule &module);

/// The frontend has executed the SIL diagnostic passes.
virtual void performedSILDiagnostics(SILModule &module);

/// The frontend has executed the SIL optimization pipeline.
virtual void performedSILOptimization(SILModule &module);

/// The frontend is about to run the program as an immediate script.
virtual void aboutToRunImmediately(CompilerInstance &instance);

// TODO: maybe enhance this interface to hear about IRGen and LLVM
// progress.
};

/// Perform all the operations of the frontend, exactly as if invoked
Expand Down
21 changes: 0 additions & 21 deletions lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,6 @@ static bool performCompile(CompilerInstance &Instance,
if (Action == FrontendOptions::ActionType::ResolveImports)
return Context.hadError();

if (observer)
observer->performedSemanticAnalysis(Instance);

if (Stats)
countStatsPostSema(*Stats, Instance);

Expand Down Expand Up @@ -1051,10 +1048,6 @@ static bool performMandatorySILPasses(CompilerInvocation &Invocation,
} else if (!Invocation.getDiagnosticOptions().SkipDiagnosticPasses) {
if (runSILDiagnosticPasses(*SM))
return true;

if (observer) {
observer->performedSILDiagnostics(*SM);
}
} else {
// Even if we are not supposed to run the diagnostic passes, we still need
// to run the ownership evaluator.
Expand Down Expand Up @@ -1154,9 +1147,6 @@ static bool processCommandLineAndRunImmediately(CompilerInvocation &Invocation,
ProcessCmdLine(opts.ImmediateArgv.begin(), opts.ImmediateArgv.end());
Instance.setSILModule(std::move(SM));

if (observer)
observer->aboutToRunImmediately(Instance);

ReturnValue =
RunImmediately(Instance, CmdLine, IRGenOpts, Invocation.getSILOptions());
return Instance.getASTContext().hadError();
Expand Down Expand Up @@ -1243,9 +1233,6 @@ static bool performCompileStepsPostSILGen(
SILOptions &SILOpts = Invocation.getSILOptions();
IRGenOptions &IRGenOpts = Invocation.getIRGenOptions();

if (observer)
observer->performedSILGeneration(*SM);

if (Stats)
countStatsPostSILGen(*Stats, *SM);

Expand Down Expand Up @@ -1301,9 +1288,6 @@ static bool performCompileStepsPostSILGen(

performSILOptimizations(Invocation, SM.get());

if (observer)
observer->performedSILOptimization(*SM);

if (Stats)
countStatsPostSILOpt(*Stats, *SM);

Expand Down Expand Up @@ -1873,8 +1857,3 @@ int swift::performFrontend(ArrayRef<const char *> Args,

void FrontendObserver::parsedArgs(CompilerInvocation &invocation) {}
void FrontendObserver::configuredCompiler(CompilerInstance &instance) {}
void FrontendObserver::performedSemanticAnalysis(CompilerInstance &instance) {}
void FrontendObserver::performedSILGeneration(SILModule &module) {}
void FrontendObserver::performedSILDiagnostics(SILModule &module) {}
void FrontendObserver::performedSILOptimization(SILModule &module) {}
void FrontendObserver::aboutToRunImmediately(CompilerInstance &instance) {}
2 changes: 1 addition & 1 deletion tools/swift-remoteast-test/swift-remoteast-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ printDynamicTypeAndAddressForExistential(void *object,
namespace {

struct Observer : public FrontendObserver {
void aboutToRunImmediately(CompilerInstance &instance) override {
void configuredCompiler(CompilerInstance &instance) override {
Context = &instance.getASTContext();
}
};
Expand Down