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

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 06:07:21 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/105826.diff


1 Files Affected:

- (modified) llvm/lib/IR/Constants.cpp (+2-3) 


``````````diff
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;
 }

``````````

</details>


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


More information about the llvm-commits mailing list