SILGen: Zero-initialize structs in constructors.

Otherwise we try to release junk pointers when we reassign class fields in the struct. Add an attribute to InitializeVarInst so that when dataflow analysis comes online, it knows that these InitializeVars need to be eliminated and can't be lowered to default constructor calls (since we're already in a constructor).

Swift SVN r4730
This commit is contained in:
Joe Groff
2013-04-13 20:45:18 +00:00
parent 700615e864
commit 8ee0fb4e96
6 changed files with 27 additions and 8 deletions

View File

@@ -327,8 +327,11 @@ CopyAddrInst::CopyAddrInst(SILLocation Loc, SILValue SrcLValue, SILValue DestLVa
{
}
InitializeVarInst::InitializeVarInst(SILLocation Loc, SILValue Dest)
: SILInstruction(ValueKind::InitializeVarInst, Loc), Operands(this, Dest) {
InitializeVarInst::InitializeVarInst(SILLocation Loc, SILValue Dest,
bool CanDefaultConstruct)
: SILInstruction(ValueKind::InitializeVarInst, Loc),
CanDefaultConstruct(CanDefaultConstruct),
Operands(this, Dest) {
}
SpecializeInst *SpecializeInst::create(SILLocation Loc, SILValue Operand,