[Frontend] Set up output file .swiftmodule.summary

This patch focus on teaching frontend and driver to emit this file.
The actual serialization and deserialization implementation will come
later.
This commit is contained in:
Yuta Saito
2020-08-04 17:08:46 +09:00
parent e387b36656
commit 43fb346b67
18 changed files with 151 additions and 1 deletions

View File

@@ -1899,6 +1899,17 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs,
return Context.hadError();
}
static bool serializeModuleSummary(SILModule *SM,
const PrimarySpecificPaths &PSPs,
const ASTContext &Context) {
auto summaryOutputPath = PSPs.SupplementaryOutputs.ModuleSummaryOutputPath;
return withOutputFile(Context.Diags, summaryOutputPath,
[&](llvm::raw_ostream &out) {
out << "Some stuff";
return false;
});
}
static GeneratedModule
generateIR(const IRGenOptions &IRGenOpts, const TBDGenOptions &TBDOpts,
std::unique_ptr<SILModule> SM,
@@ -2123,6 +2134,12 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
if (observer)
observer->performedSILProcessing(*SM);
if (PSPs.haveModuleSummaryOutputPath()) {
if (serializeModuleSummary(SM.get(), PSPs, Context)) {
return true;
}
}
if (Action == FrontendOptions::ActionType::EmitSIB)
return serializeSIB(SM.get(), PSPs, Context, MSF);