[llvm] [Linker] Use a range-based for loop (NFC) (PR #98785)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 13 18:46:33 PDT 2024


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

None

>From c4a2c24ace1b826d37d75748249538497380f642 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 3 Jul 2024 21:34:21 -0700
Subject: [PATCH] [Linker] Use a range-based for loop (NFC)

---
 llvm/lib/Linker/IRMover.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index ba8f371127764..beab194a52b81 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1192,8 +1192,8 @@ void IRLinker::prepareCompileUnitsForImport() {
   // When importing for ThinLTO, prevent importing of types listed on
   // the DICompileUnit that we don't need a copy of in the importing
   // module. They will be emitted by the originating module.
-  for (unsigned I = 0, E = SrcCompileUnits->getNumOperands(); I != E; ++I) {
-    auto *CU = cast<DICompileUnit>(SrcCompileUnits->getOperand(I));
+  for (MDNode *N : SrcCompileUnits->operands()) {
+    auto *CU = cast<DICompileUnit>(N);
     assert(CU && "Expected valid compile unit");
     // Enums, macros, and retained types don't need to be listed on the
     // imported DICompileUnit. This means they will only be imported



More information about the llvm-commits mailing list