mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Simplify prepareEpilog() utility method
This commit is contained in:
@@ -487,8 +487,7 @@ void SILGenFunction::emitFunction(FuncDecl *fd) {
|
||||
auto captureInfo = SGM.M.Types.getLoweredLocalCaptures(SILDeclRef(fd));
|
||||
emitProlog(captureInfo, fd->getParameters(), fd->getImplicitSelfDecl(), fd,
|
||||
fd->getResultInterfaceType(), fd->hasThrows(), fd->getThrowsLoc());
|
||||
Type resultTy = fd->mapTypeIntoContext(fd->getResultInterfaceType());
|
||||
prepareEpilog(resultTy, fd->hasThrows(), CleanupLocation(fd));
|
||||
prepareEpilog(true, fd->hasThrows(), CleanupLocation(fd));
|
||||
|
||||
emitProfilerIncrement(fd->getBody());
|
||||
emitStmt(fd->getBody());
|
||||
@@ -506,8 +505,7 @@ void SILGenFunction::emitClosure(AbstractClosureExpr *ace) {
|
||||
SILDeclRef(ace));
|
||||
emitProlog(captureInfo, ace->getParameters(), /*selfParam=*/nullptr,
|
||||
ace, resultIfaceTy, ace->isBodyThrowing(), ace->getLoc());
|
||||
prepareEpilog(ace->getResultType(), ace->isBodyThrowing(),
|
||||
CleanupLocation(ace));
|
||||
prepareEpilog(true, ace->isBodyThrowing(), CleanupLocation(ace));
|
||||
emitProfilerIncrement(ace);
|
||||
if (auto *ce = dyn_cast<ClosureExpr>(ace)) {
|
||||
emitStmt(ce->getBody());
|
||||
@@ -743,7 +741,7 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, Expr *value,
|
||||
dc, interfaceType, /*throws=*/false, SourceLoc());
|
||||
if (EmitProfilerIncrement)
|
||||
emitProfilerIncrement(value);
|
||||
prepareEpilog(value->getType(), false, CleanupLocation::get(Loc));
|
||||
prepareEpilog(true, false, CleanupLocation::get(Loc));
|
||||
|
||||
{
|
||||
llvm::Optional<SILGenFunction::OpaqueValueRAII> opaqueValue;
|
||||
@@ -776,7 +774,6 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, VarDecl *var) {
|
||||
auto decl = function.getAbstractFunctionDecl();
|
||||
auto *dc = decl->getInnermostDeclContext();
|
||||
auto interfaceType = var->getValueInterfaceType();
|
||||
auto varType = var->getType();
|
||||
|
||||
// If this is the backing storage for a property with an attached
|
||||
// wrapper that was initialized with '=', the stored property initializer
|
||||
@@ -784,13 +781,12 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, VarDecl *var) {
|
||||
if (auto originalProperty = var->getOriginalWrappedProperty()) {
|
||||
if (originalProperty->isPropertyMemberwiseInitializedWithWrappedType()) {
|
||||
interfaceType = originalProperty->getValueInterfaceType();
|
||||
varType = originalProperty->getType();
|
||||
}
|
||||
}
|
||||
|
||||
emitProlog(/*paramList*/ nullptr, /*selfParam*/ nullptr, interfaceType, dc,
|
||||
/*throws=*/false, SourceLoc());
|
||||
prepareEpilog(varType, false, CleanupLocation::get(loc));
|
||||
prepareEpilog(true, false, CleanupLocation::get(loc));
|
||||
|
||||
auto pbd = var->getParentPatternBinding();
|
||||
const auto i = pbd->getPatternEntryIndexForVarDecl(var);
|
||||
|
||||
Reference in New Issue
Block a user