mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ownership] Rename BorrowScopeIntroducingValue -> BorrowedValue and BorrowScopeOperand -> BorrowingOperand.
Andy and I for some time have been discussing the right name for these two "ownership concepts". What we realized is that the "ing" on BorrowScopeIntroducingValue is very unfortunate since this value is the result of a new borrow scope being introduced. So the name should be really: BorrowScopeIntroducedValue. Given that is sort of unsatisfying, we settled on the name BorrowedValue. Once we found the name BorrowedValue, we naturally realized that BorrowScopeOperand -> BorrowingOperand followed. This is because the operand is the operand of the instruction that is creating the new borrow scope. So in a sense the Operand is the "Use" that causes the original value to become borrowed. So a BorrowingOperand is where the action is and is "active".
This commit is contained in:
@@ -868,7 +868,7 @@ getEndPointsOfDataDependentChain(SILValue value, SILFunction *fun,
|
||||
/// value, if there is exactly one such introducing value. Otherwise, return
|
||||
/// None. There can be multiple borrow scopes for a SILValue iff it is derived
|
||||
/// from a guaranteed basic block parameter representing a phi node.
|
||||
static Optional<BorrowScopeIntroducingValue>
|
||||
static Optional<BorrowedValue>
|
||||
getUniqueBorrowScopeIntroducingValue(SILValue value) {
|
||||
assert(value.getOwnershipKind() == ValueOwnershipKind::Guaranteed &&
|
||||
"parameter must be a guarenteed value");
|
||||
@@ -925,7 +925,7 @@ static void replaceAllUsesAndFixLifetimes(SILValue foldedVal,
|
||||
// destroy foldedVal at the end of the borrow scope.
|
||||
assert(originalVal.getOwnershipKind() == ValueOwnershipKind::Guaranteed);
|
||||
|
||||
Optional<BorrowScopeIntroducingValue> originalScopeBegin =
|
||||
Optional<BorrowedValue> originalScopeBegin =
|
||||
getUniqueBorrowScopeIntroducingValue(originalVal);
|
||||
assert(originalScopeBegin &&
|
||||
"value without a unique borrow scope should not have been folded");
|
||||
@@ -976,7 +976,7 @@ static void substituteConstants(FoldState &foldState) {
|
||||
// value at the point where the owned value is defined.
|
||||
SILInstruction *insertionPoint = definingInst;
|
||||
if (constantSILValue.getOwnershipKind() == ValueOwnershipKind::Guaranteed) {
|
||||
Optional<BorrowScopeIntroducingValue> borrowIntroducer =
|
||||
Optional<BorrowedValue> borrowIntroducer =
|
||||
getUniqueBorrowScopeIntroducingValue(constantSILValue);
|
||||
if (!borrowIntroducer) {
|
||||
// This case happens only if constantSILValue is derived from a
|
||||
|
||||
Reference in New Issue
Block a user