[ModuleInterface] Actually generate SIL for the module.

This commit is contained in:
Graydon Hoare
2018-10-11 19:06:11 -07:00
parent 1cce09627d
commit 2be23089a6
2 changed files with 8 additions and 2 deletions

View File

@@ -155,14 +155,16 @@ static bool buildSwiftModuleFromSwiftInterface(
return;
}
SILOptions &SILOpts = SubInvocation.getSILOptions();
auto Mod = SubInstance.getMainModule();
auto SILMod = SubInstance.takeSILModule();
auto SILMod = performSILGeneration(Mod, SILOpts);
if (SILMod) {
LLVM_DEBUG(llvm::dbgs() << "Running SIL diagnostic passes\n");
if (runSILDiagnosticPasses(*SILMod)) {
SubError = true;
return;
}
SILMod->verify();
}
LLVM_DEBUG(llvm::dbgs() << "Serializing " << OutPath << "\n");
@@ -170,7 +172,10 @@ static bool buildSwiftModuleFromSwiftInterface(
std::string OutPathStr = OutPath;
serializationOpts.OutputPath = OutPathStr.c_str();
serializationOpts.SerializeAllSIL = true;
serialize(Mod, serializationOpts, SILMod.get());
SILMod->setSerializeSILAction([&]() {
serialize(Mod, serializationOpts, SILMod.get());
});
SILMod->serialize();
SubError = Diags.hadAnyError();
});
return !RunSuccess || SubError;