[llvm] [AsmPrinter] Use range-based for loops (NFC) (PR #97977)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 7 17:16:19 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/97977
None
>From 507a1e58c0deb5e167c88cc421d7e2030325288e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 7 Jul 2024 17:11:29 -0700
Subject: [PATCH] [AsmPrinter] Use range-based for loops (NFC)
---
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 1391893e55a52..e2101124c96bb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2993,8 +2993,7 @@ void AsmPrinter::emitModuleIdents(Module &M) {
return;
if (const NamedMDNode *NMD = M.getNamedMetadata("llvm.ident")) {
- for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
- const MDNode *N = NMD->getOperand(i);
+ for (const MDNode *N : NMD->operands()) {
assert(N->getNumOperands() == 1 &&
"llvm.ident metadata entry can have only one operand");
const MDString *S = cast<MDString>(N->getOperand(0));
@@ -3015,8 +3014,7 @@ void AsmPrinter::emitModuleCommandLines(Module &M) {
OutStreamer->pushSection();
OutStreamer->switchSection(CommandLine);
OutStreamer->emitZeros(1);
- for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
- const MDNode *N = NMD->getOperand(i);
+ for (const MDNode *N : NMD->operands()) {
assert(N->getNumOperands() == 1 &&
"llvm.commandline metadata entry can have only one operand");
const MDString *S = cast<MDString>(N->getOperand(0));
More information about the llvm-commits
mailing list