Skip to content

Commit 60d1c4e

Browse files
[llvm] Use range-based for loops (NFC) (#146945)
Note that LLVM Coding Standards discourages std::for_each and llvm::for_each unless the callable object already exists.
1 parent c3947a6 commit 60d1c4e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/lib/Target/M68k/M68kInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ bool M68kInstrInfo::AnalyzeBranchImpl(MachineBasicBlock &MBB,
9595
// Erase any instructions if allowed at the end of the scope.
9696
std::vector<std::reference_wrapper<llvm::MachineInstr>> EraseList;
9797
auto FinalizeOnReturn = llvm::make_scope_exit([&EraseList] {
98-
std::for_each(EraseList.begin(), EraseList.end(),
99-
[](auto &ref) { ref.get().eraseFromParent(); });
98+
for (auto &Ref : EraseList)
99+
Ref.get().eraseFromParent();
100100
});
101101

102102
// Start from the bottom of the block and work up, examining the

llvm/lib/Transforms/Coroutines/SpillUtils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,10 @@ void sinkSpillUsesAfterCoroBegin(const DominatorTree &Dom,
552552
Worklist.push_back(Inst);
553553
}
554554
};
555-
std::for_each(Spills.begin(), Spills.end(),
556-
[&](auto &I) { collectUsers(I.first); });
557-
std::for_each(Allocas.begin(), Allocas.end(),
558-
[&](auto &I) { collectUsers(I.Alloca); });
555+
for (auto &I : Spills)
556+
collectUsers(I.first);
557+
for (auto &I : Allocas)
558+
collectUsers(I.Alloca);
559559

560560
// Recursively collect users before coro.begin.
561561
while (!Worklist.empty()) {

0 commit comments

Comments
 (0)