[llvm] [IR] Use a range-based for loop (NFC) (PR #105826)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 06:06:45 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/105826

None

>From 18958ff7abc9418a00fe97385c851d018bb7ba22 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 16 Aug 2024 09:10:46 -0700
Subject: [PATCH] [IR] Use a range-based for loop (NFC)

---
 llvm/lib/IR/Constants.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index a1c9e925a024fe..e32a54fa346a9a 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -681,9 +681,8 @@ Constant::PossibleRelocationsTy Constant::getRelocationInfo() const {
   }
 
   PossibleRelocationsTy Result = NoRelocation;
-  for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
-    Result =
-        std::max(cast<Constant>(getOperand(i))->getRelocationInfo(), Result);
+  for (const Value *Op : operands())
+    Result = std::max(cast<Constant>(Op)->getRelocationInfo(), Result);
 
   return Result;
 }



More information about the llvm-commits mailing list