Skip to content

Commit e320ee1

Browse files
committed
[ownership] Convert a few small visitor methods to be const.
1 parent dbe0cfa commit e320ee1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/swift/SIL/OwnershipUtils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ struct BorrowingOperand {
178178

179179
/// Visit all of the results of the operand's user instruction that are
180180
/// consuming uses.
181-
void visitUserResultConsumingUses(function_ref<void(Operand *)> visitor);
181+
void visitUserResultConsumingUses(function_ref<void(Operand *)> visitor) const;
182182

183183
/// Visit all of the "results" of the user of this operand that are borrow
184184
/// scope introducers for the specific scope that this borrow scope operand
185185
/// summarizes.
186186
void
187-
visitBorrowIntroducingUserResults(function_ref<void(BorrowedValue)> visitor);
187+
visitBorrowIntroducingUserResults(function_ref<void(BorrowedValue)> visitor) const;
188188

189189
/// Passes to visitor all of the consuming uses of this use's using
190190
/// instruction.
@@ -193,7 +193,7 @@ struct BorrowingOperand {
193193
/// guaranteed scope by using a worklist and checking if any of the operands
194194
/// are BorrowScopeOperands.
195195
void visitConsumingUsesOfBorrowIntroducingUserResults(
196-
function_ref<void(Operand *)> visitor);
196+
function_ref<void(Operand *)> visitor) const;
197197

198198
void print(llvm::raw_ostream &os) const;
199199
SWIFT_DEBUG_DUMP { print(llvm::dbgs()); }

lib/SIL/OwnershipUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void BorrowingOperand::visitEndScopeInstructions(
190190
}
191191

192192
void BorrowingOperand::visitBorrowIntroducingUserResults(
193-
function_ref<void(BorrowedValue)> visitor) {
193+
function_ref<void(BorrowedValue)> visitor) const {
194194
switch (kind) {
195195
case BorrowScopeOperandKind::BeginApply:
196196
llvm_unreachable("Never has borrow introducer results!");
@@ -212,7 +212,7 @@ void BorrowingOperand::visitBorrowIntroducingUserResults(
212212
}
213213

214214
void BorrowingOperand::visitConsumingUsesOfBorrowIntroducingUserResults(
215-
function_ref<void(Operand *)> func) {
215+
function_ref<void(Operand *)> func) const {
216216
// First visit all of the results of our user that are borrow introducing
217217
// values.
218218
visitBorrowIntroducingUserResults([&](BorrowedValue value) {
@@ -238,7 +238,7 @@ void BorrowingOperand::visitConsumingUsesOfBorrowIntroducingUserResults(
238238
}
239239

240240
void BorrowingOperand::visitUserResultConsumingUses(
241-
function_ref<void(Operand *)> visitor) {
241+
function_ref<void(Operand *)> visitor) const {
242242
auto *ti = dyn_cast<TermInst>(op->getUser());
243243
if (!ti) {
244244
for (SILValue result : op->getUser()->getResults()) {

0 commit comments

Comments
 (0)