Introduce a new null_class SIL instruction for forming a null pointer

reference to something of class type.  This is required to model
RebindSelfInConstructorExpr correctly to DI, since in the class case, 
self.init and super.init *take* a value out of class box so that it 
can pass the +1 value without performing an extra retain.  Nothing
else in the compiler uninitializes a DI-controlled memory object
like this, so nothing else needs this.  DI really doesn't like something
going from initialized to uninitialized.

Yes, I feel super-gross about this and am really unhappy about it.  I
may end up reverting this if I can find an alternate solution to this
problem.



Swift SVN r27525
This commit is contained in:
Chris Lattner
2015-04-21 05:56:55 +00:00
parent f2455bd668
commit 42b4a966b0
18 changed files with 105 additions and 12 deletions

View File

@@ -44,7 +44,6 @@ static void LowerAssignInstruction(SILBuilder &B, AssignInst *Inst,
++NumAssignRewritten;
auto &M = Inst->getModule();
SILValue Src = Inst->getSrc();
// If this is an initialization, or the storage type is trivial, we
@@ -54,7 +53,7 @@ static void LowerAssignInstruction(SILBuilder &B, AssignInst *Inst,
// assignment with a store. If it has non-trivial type and is an
// initialization, we can also replace it with a store.
if (isInitialization == IsInitialization ||
Inst->getDest().getType().isTrivial(M)) {
Inst->getDest().getType().isTrivial(Inst->getModule())) {
B.createStore(Inst->getLoc(), Src, Inst->getDest());
} else {
// Otherwise, we need to replace the assignment with the full