[llvm] a379b22 - [IR] Use range-based for loops (NFC) (#97575)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 12:53:10 PDT 2024
Author: Kazu Hirata
Date: 2024-07-03T12:53:06-07:00
New Revision: a379b2260fc3bada0c11a6a1cd7891a1a6e1fb99
URL: https://github.com/llvm/llvm-project/commit/a379b2260fc3bada0c11a6a1cd7891a1a6e1fb99
DIFF: https://github.com/llvm/llvm-project/commit/a379b2260fc3bada0c11a6a1cd7891a1a6e1fb99.diff
LOG: [IR] Use range-based for loops (NFC) (#97575)
Added:
Modified:
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/LegacyPassManager.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index f39149ae0dad4..30b79b6d6f60f 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -79,9 +79,9 @@ void DIBuilder::finalize() {
// list. Use a set to remove the duplicates while we transform the
// TrackingVHs back into Values.
SmallPtrSet<Metadata *, 16> RetainSet;
- for (unsigned I = 0, E = AllRetainTypes.size(); I < E; I++)
- if (RetainSet.insert(AllRetainTypes[I]).second)
- RetainValues.push_back(AllRetainTypes[I]);
+ for (const TrackingMDNodeRef &N : AllRetainTypes)
+ if (RetainSet.insert(N).second)
+ RetainValues.push_back(N);
if (!RetainValues.empty())
CUNode->replaceRetainedTypes(MDTuple::get(VMContext, RetainValues));
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index d361bd9a98391..01aaedcf7d547 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -823,9 +823,8 @@ void PMTopLevelManager::dumpPasses() const {
return;
// Print out the immutable passes
- for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) {
- ImmutablePasses[i]->dumpPassStructure(0);
- }
+ for (ImmutablePass *Pass : ImmutablePasses)
+ Pass->dumpPassStructure(0);
// Every class that derives from PMDataManager also derives from Pass
// (sometimes indirectly), but there's no inheritance relationship
More information about the llvm-commits
mailing list