[llvm] [IR] Use range-based for loops (NFC) (PR #97575)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 06:31:47 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/97575
None
>From cfb2f579d29231a4215f845daf69dc18f5b99542 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 2 Jul 2024 19:39:20 -0700
Subject: [PATCH] [IR] Use range-based for loops (NFC)
---
llvm/lib/IR/DIBuilder.cpp | 6 +++---
llvm/lib/IR/LegacyPassManager.cpp | 5 ++---
2 files changed, 5 insertions(+), 6 deletions(-)
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