@@ -8753,6 +8753,23 @@ SILFunction *ApplyInstBase<Impl, Base, false>::getCalleeFunction() const {
87538753 }
87548754}
87558755
8756+ class OwnershipForwardingMultipleValueInstruction
8757+ : public MultipleValueInstruction {
8758+ ValueOwnershipKind ownershipKind;
8759+
8760+ public:
8761+ OwnershipForwardingMultipleValueInstruction (SILInstructionKind kind,
8762+ SILDebugLocation loc,
8763+ ValueOwnershipKind ownershipKind)
8764+ : MultipleValueInstruction(kind, loc), ownershipKind(ownershipKind) {}
8765+
8766+ // / Returns the preferred ownership kind of this multiple value instruction.
8767+ ValueOwnershipKind getOwnershipKind () const { return ownershipKind; }
8768+ void setOwnershipKind (ValueOwnershipKind newOwnershipKind) {
8769+ ownershipKind = newOwnershipKind;
8770+ }
8771+ };
8772+
87568773// / A result for the destructure_struct instruction. See documentation for
87578774// / destructure_struct for more information.
87588775class DestructureStructResult final : public MultipleValueInstructionResult {
@@ -8776,15 +8793,15 @@ class DestructureStructResult final : public MultipleValueInstructionResult {
87768793// / struct's fields.
87778794class DestructureStructInst final
87788795 : public UnaryInstructionBase<SILInstructionKind::DestructureStructInst,
8779- MultipleValueInstruction >,
8780- public MultipleValueInstructionTrailingObjects<
8781- DestructureStructInst, DestructureStructResult> {
8796+ OwnershipForwardingMultipleValueInstruction >,
8797+ public MultipleValueInstructionTrailingObjects<DestructureStructInst,
8798+ DestructureStructResult> {
87828799 friend TrailingObjects;
87838800
87848801 DestructureStructInst (SILModule &M, SILDebugLocation Loc, SILValue Operand,
87858802 ArrayRef<SILType> Types,
87868803 ArrayRef<ValueOwnershipKind> OwnershipKinds)
8787- : UnaryInstructionBase(Loc, Operand),
8804+ : UnaryInstructionBase(Loc, Operand, Operand.getOwnershipKind() ),
87888805 MultipleValueInstructionTrailingObjects (this , Types, OwnershipKinds) {}
87898806
87908807public:
@@ -8825,15 +8842,15 @@ class DestructureTupleResult final : public MultipleValueInstructionResult {
88258842// / tuples's elements.
88268843class DestructureTupleInst final
88278844 : public UnaryInstructionBase<SILInstructionKind::DestructureTupleInst,
8828- MultipleValueInstruction >,
8829- public MultipleValueInstructionTrailingObjects<
8830- DestructureTupleInst, DestructureTupleResult> {
8845+ OwnershipForwardingMultipleValueInstruction >,
8846+ public MultipleValueInstructionTrailingObjects<DestructureTupleInst,
8847+ DestructureTupleResult> {
88318848 friend TrailingObjects;
88328849
88338850 DestructureTupleInst (SILModule &M, SILDebugLocation Loc, SILValue Operand,
88348851 ArrayRef<SILType> Types,
88358852 ArrayRef<ValueOwnershipKind> OwnershipKinds)
8836- : UnaryInstructionBase(Loc, Operand),
8853+ : UnaryInstructionBase(Loc, Operand, Operand.getOwnershipKind() ),
88378854 MultipleValueInstructionTrailingObjects (this , Types, OwnershipKinds) {}
88388855
88398856public:
0 commit comments