@@ -74,7 +74,6 @@ bool Initialization::canForwardInBranch() const {
74
74
return true ;
75
75
76
76
// These initializations expect to be activated exactly once.
77
- case Kind::AddressBinding:
78
77
case Kind::LetValue:
79
78
case Kind::Translating:
80
79
return false ;
@@ -126,8 +125,6 @@ Initialization::getSubInitializationsForTuple(SILGenFunction &gen, CanType type,
126
125
// This could actually be done by collecting translated values, if
127
126
// we introduce new needs for translating initializations.
128
127
llvm_unreachable (" cannot destructure a translating initialization" );
129
- case Kind::AddressBinding:
130
- llvm_unreachable (" cannot destructure an address binding initialization" );
131
128
}
132
129
llvm_unreachable (" bad initialization kind" );
133
130
}
@@ -461,52 +458,6 @@ class CleanupWriteBackToInOut : public Cleanup {
461
458
}
462
459
};
463
460
464
- // / Initialize a writeback buffer that receives the "in" value of a inout
465
- // / argument on function entry and writes the "out" value back to the inout
466
- // / address on function exit.
467
- class InOutInitialization : public Initialization {
468
- // / The VarDecl for the inout symbol.
469
- VarDecl *vd;
470
- public:
471
- InOutInitialization (VarDecl *vd)
472
- : Initialization(Initialization::Kind::AddressBinding), vd(vd) {}
473
-
474
- SILValue getAddressOrNull () const override {
475
- llvm_unreachable (" inout argument should be bound by bindAddress" );
476
- }
477
- ArrayRef<InitializationPtr> getSubInitializations () const override {
478
- return {};
479
- }
480
-
481
- void bindAddress (SILValue address, SILGenFunction &gen,
482
- SILLocation loc) override {
483
- CanType objectType =
484
- cast<InOutType>(vd->getType ()->getCanonicalType ()).getObjectType ();
485
-
486
- // As a special case, don't introduce a local variable for
487
- // Builtin.UnsafeValueBuffer, which is not copyable.
488
- if (isa<BuiltinUnsafeValueBufferType>(objectType)) {
489
- // FIXME: mark a debug location?
490
- gen.VarLocs [vd] = SILGenFunction::VarLoc::get (address);
491
- return ;
492
- }
493
-
494
- // Allocate the local variable for the inout.
495
- auto initVar = gen.emitLocalVariableWithCleanup (vd, false );
496
-
497
- // Initialize with the value from the inout with an "autogenerated"
498
- // copyaddr.
499
- loc.markAsPrologue ();
500
- loc.markAutoGenerated ();
501
- gen.B .createCopyAddr (loc, address, initVar->getAddress (),
502
- IsNotTake, IsInitialization);
503
- initVar->finishInitialization (gen);
504
-
505
- // Set up a cleanup to write back to the inout.
506
- gen.Cleanups .pushCleanup <CleanupWriteBackToInOut>(vd, address);
507
- }
508
- };
509
-
510
461
// / Initialize a variable of reference-storage type.
511
462
class ReferenceStorageInitialization : public Initialization {
512
463
InitializationPtr VarInit;
@@ -666,10 +617,7 @@ SILGenFunction::emitInitializationForVarDecl(VarDecl *vd, Type patternType) {
666
617
667
618
CanType varType = vd->getType ()->getCanonicalType ();
668
619
669
- // If this is an inout parameter, set up the writeback variable.
670
- if (isa<InOutType>(varType)) {
671
- return InitializationPtr (new InOutInitialization (vd));
672
- }
620
+ assert (!isa<InOutType>(varType) && " local variables should never be inout" );
673
621
674
622
// If this is a 'let' initialization for a non-global, set up a
675
623
// let binding, which stores the initialization value into VarLocs directly.
0 commit comments