@@ -655,6 +655,8 @@ class PartitionOp {
655
655
return source.get <SILInstruction *>();
656
656
}
657
657
658
+ bool hasSourceInst () const { return source.is <SILInstruction *>(); }
659
+
658
660
Operand *getSourceOp () const { return source.get <Operand *>(); }
659
661
660
662
SILLocation getSourceLoc () const { return getSourceInst ()->getLoc (); }
@@ -1095,6 +1097,11 @@ struct PartitionOpEvaluator {
1095
1097
// / if they need to.
1096
1098
static SILLocation getLoc (SILInstruction *inst) { return Impl::getLoc (inst); }
1097
1099
1100
+ // / Some evaluators pass in mock operands that one cannot call getLoc()
1101
+ // / upon. So to allow for this, provide a routine that our impl can override
1102
+ // / if they need to.
1103
+ static SILLocation getLoc (Operand *op) { return Impl::getLoc (op); }
1104
+
1098
1105
// / Apply \p op to the partition op.
1099
1106
void apply (const PartitionOp &op) const {
1100
1107
if (shouldEmitVerboseLogging ()) {
@@ -1113,7 +1120,9 @@ struct PartitionOpEvaluator {
1113
1120
1114
1121
// Set the boundary so that as we push, this shows when to stop processing
1115
1122
// for this PartitionOp.
1116
- p.pushHistorySequenceBoundary (getLoc (op.getSourceInst ()));
1123
+ SILLocation loc = op.hasSourceInst () ? getLoc (op.getSourceInst ())
1124
+ : getLoc (op.getSourceOp ());
1125
+ p.pushHistorySequenceBoundary (loc);
1117
1126
1118
1127
switch (op.getKind ()) {
1119
1128
case PartitionOpKind::Assign:
@@ -1356,6 +1365,7 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
1356
1365
bool shouldTryToSquelchErrors () const { return true ; }
1357
1366
1358
1367
static SILLocation getLoc (SILInstruction *inst) { return inst->getLoc (); }
1368
+ static SILLocation getLoc (Operand *op) { return op->getUser ()->getLoc (); }
1359
1369
};
1360
1370
1361
1371
// / A subclass of PartitionOpEvaluatorBaseImpl that doesn't have any special
0 commit comments