Skip to content

Commit e9a3c7f

Browse files
authored
Merge pull request #30497 from gottesmm/pr-71c57ac72c9ecc07f75dd86474bf57988d7aa006
[ownership] Convert a few small visitor methods to be const.
2 parents aab622e + e320ee1 commit e9a3c7f

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
@@ -177,13 +177,13 @@ struct BorrowingOperand {
177177

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

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

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

197197
void print(llvm::raw_ostream &os) const;
198198
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 BorrowingOperandKind::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)