Skip to content

Commit bd5af6b

Browse files
authored
Merge pull request #59393 from meg-gupta/fixloadborrowimmutablean
Fix LoadBorrowImmutabilityChecker to handle reborrows
2 parents fecba2e + b6231d2 commit bd5af6b

26 files changed

+50
-3
lines changed

lib/SIL/Verifier/LoadBorrowImmutabilityChecker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ bool LoadBorrowImmutabilityAnalysis::isImmutable(LoadBorrowInst *lbi) {
363363
// cases to try and exhaustively identify if those writes overlap with our
364364
// load_borrow.
365365
SmallVector<Operand *, 8> endBorrowUses;
366-
transform(lbi->getUsersOfType<EndBorrowInst>(),
367-
std::back_inserter(endBorrowUses),
368-
[](EndBorrowInst *ebi) { return &ebi->getAllOperands()[0]; });
366+
visitTransitiveEndBorrows(lbi, [&](EndBorrowInst *endBorrow) {
367+
endBorrowUses.push_back(&endBorrow->getOperandRef());
368+
});
369369

370370
switch (accessPath.getStorage().getKind()) {
371371
case AccessStorage::Nested: {

0 commit comments

Comments
 (0)