@@ -230,7 +230,7 @@ static bool canFixUpOwnershipForRAUW(SILValue oldValue, SILValue newValue,
230
230
// / extending %ownedValue's liveness to new paths and hopefully simplifies
231
231
// / downstream optimization and debugging. Unnecessary copies could be
232
232
// / avoided with simple dominance check if it becomes desirable to do so.
233
- struct BorrowedLifetimeExtender {
233
+ class BorrowedLifetimeExtender {
234
234
BorrowedValue borrowedValue;
235
235
236
236
// Owned value currently being extended over borrowedValue.
@@ -245,6 +245,21 @@ struct BorrowedLifetimeExtender {
245
245
// / utility and OSSA representation are stable.
246
246
SWIFT_ASSERT_ONLY_DECL (llvm::SmallDenseSet<PhiOperand, 4 > reborrowedOperands);
247
247
248
+ public:
249
+ // / Precondition: \p borrowedValue must introduce a local borrow scope
250
+ // / (begin_borrow, load_borrow, & phi).
251
+ BorrowedLifetimeExtender (BorrowedValue borrowedValue,
252
+ InstModCallbacks &callbacks)
253
+ : borrowedValue(borrowedValue), callbacks(callbacks) {
254
+ assert (borrowedValue.isLocalScope () && " expect a valid borrowed value" );
255
+ }
256
+
257
+ // / Extend \p ownedValue over this extended borrow scope.
258
+ // /
259
+ // / Precondition: \p ownedValue dominates this borrowed value.
260
+ void extendOverBorrowScopeAndConsume (SILValue ownedValue);
261
+
262
+ protected:
248
263
// / Initially map the reborrowed phi to an invalid value prior to creating the
249
264
// / owned phi.
250
265
void discoverReborrow (PhiValue reborrowedPhi) {
@@ -282,21 +297,6 @@ struct BorrowedLifetimeExtender {
282
297
return SILValue ();
283
298
}
284
299
285
- public:
286
- // / Precondition: \p borrowedValue must introduce a local borrow scope
287
- // / (begin_borrow, load_borrow, & phi).
288
- BorrowedLifetimeExtender (BorrowedValue borrowedValue,
289
- InstModCallbacks &callbacks)
290
- : borrowedValue(borrowedValue), callbacks(callbacks) {
291
- assert (borrowedValue.isLocalScope () && " expect a valid borrowed value" );
292
- }
293
-
294
- // / Extend \p ownedValue over this extended borrow scope.
295
- // /
296
- // / Precondition: \p ownedValue dominates this borrowed value.
297
- void extendOverBorrowScopeAndConsume (SILValue ownedValue);
298
-
299
- protected:
300
300
void analyzeExtendedScope ();
301
301
302
302
SILValue createCopyAtEdge (PhiOperand reborrowOper);
0 commit comments