Skip to content

[silgen] Tell prepareEpilog to emit a rethrow block instead of callin… #13279

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
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
14 changes: 5 additions & 9 deletions lib/SILGen/SILGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,23 +1252,19 @@ class SourceFileScope {

sgm.TopLevelSGF = new SILGenFunction(sgm, *toplevel);
sgm.TopLevelSGF->MagicFunctionName = sgm.SwiftModule->getName();
sgm.TopLevelSGF->prepareEpilog(Type(), false,
CleanupLocation::getModuleCleanupLocation());

sgm.TopLevelSGF->prepareRethrowEpilog(
CleanupLocation::getModuleCleanupLocation());
auto moduleCleanupLoc = CleanupLocation::getModuleCleanupLocation();
sgm.TopLevelSGF->prepareEpilog(Type(), true, moduleCleanupLoc);

// Create the argc and argv arguments.
auto PrologueLoc = RegularLocation::getModuleLocation();
PrologueLoc.markAsPrologue();
auto prologueLoc = RegularLocation::getModuleLocation();
prologueLoc.markAsPrologue();
auto entry = sgm.TopLevelSGF->B.getInsertionBB();
auto paramTypeIter =
sgm.TopLevelSGF->F.getConventions().getParameterSILTypes().begin();
entry->createFunctionArgument(*paramTypeIter);
entry->createFunctionArgument(*std::next(paramTypeIter));

scope.emplace(sgm.TopLevelSGF->Cleanups,
CleanupLocation::getModuleCleanupLocation());
scope.emplace(sgm.TopLevelSGF->Cleanups, moduleCleanupLoc);
}
}

Expand Down