mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Move a few methods from VarDecl down to ParamDecl
This commit is contained in:
@@ -245,23 +245,23 @@ struct ArgumentInitHelper {
|
||||
|
||||
/// Create a SILArgument and store its value into the given Initialization,
|
||||
/// if not null.
|
||||
void makeArgumentIntoBinding(Type ty, SILBasicBlock *parent, VarDecl *vd) {
|
||||
SILLocation loc(vd);
|
||||
void makeArgumentIntoBinding(Type ty, SILBasicBlock *parent, ParamDecl *pd) {
|
||||
SILLocation loc(pd);
|
||||
loc.markAsPrologue();
|
||||
|
||||
ManagedValue argrv = makeArgument(ty, vd->isInOut(), parent, loc);
|
||||
ManagedValue argrv = makeArgument(ty, pd->isInOut(), parent, loc);
|
||||
|
||||
if (vd->isInOut()) {
|
||||
if (pd->isInOut()) {
|
||||
assert(argrv.getType().isAddress() && "expected inout to be address");
|
||||
} else {
|
||||
assert(vd->isImmutable() && "expected parameter to be immutable!");
|
||||
assert(pd->isImmutable() && "expected parameter to be immutable!");
|
||||
// If the variable is immutable, we can bind the value as is.
|
||||
// Leave the cleanup on the argument, if any, in place to consume the
|
||||
// argument if we're responsible for it.
|
||||
}
|
||||
SGF.VarLocs[vd] = SILGenFunction::VarLoc::get(argrv.getValue());
|
||||
SGF.VarLocs[pd] = SILGenFunction::VarLoc::get(argrv.getValue());
|
||||
SILValue value = argrv.getValue();
|
||||
SILDebugVariable varinfo(vd->isLet(), ArgNo);
|
||||
SILDebugVariable varinfo(pd->isImmutable(), ArgNo);
|
||||
if (!argrv.getType().isAddress()) {
|
||||
SGF.B.createDebugValue(loc, value, varinfo);
|
||||
} else {
|
||||
@@ -496,7 +496,7 @@ static void emitIndirectResultParameters(SILGenFunction &SGF, Type resultType,
|
||||
return;
|
||||
}
|
||||
auto &ctx = SGF.getASTContext();
|
||||
auto var = new (ctx) ParamDecl(VarDecl::Specifier::InOut,
|
||||
auto var = new (ctx) ParamDecl(ParamDecl::Specifier::InOut,
|
||||
SourceLoc(), SourceLoc(),
|
||||
ctx.getIdentifier("$return_value"), SourceLoc(),
|
||||
ctx.getIdentifier("$return_value"),
|
||||
|
||||
Reference in New Issue
Block a user