[llvm] cc5ba73 - [IR] Use range-based for loops (NFC) (#97950)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 7 17:06:06 PDT 2024
Author: Kazu Hirata
Date: 2024-07-08T09:06:02+09:00
New Revision: cc5ba739f27ab2f28d4a0f2e295d1e426aa836a7
URL: https://github.com/llvm/llvm-project/commit/cc5ba739f27ab2f28d4a0f2e295d1e426aa836a7
DIFF: https://github.com/llvm/llvm-project/commit/cc5ba739f27ab2f28d4a0f2e295d1e426aa836a7.diff
LOG: [IR] Use range-based for loops (NFC) (#97950)
Added:
Modified:
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/Module.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 0bf8be9ac55f9..6599730590de6 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1021,8 +1021,8 @@ void SlotTracker::processModule() {
// Add metadata used by named metadata.
for (const NamedMDNode &NMD : TheModule->named_metadata()) {
- for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)
- CreateMetadataSlot(NMD.getOperand(i));
+ for (const MDNode *N : NMD.operands())
+ CreateMetadataSlot(N);
}
for (const Function &F : *TheModule) {
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 16c79442f82fe..c966c53d09baf 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -387,8 +387,7 @@ void Module::setModuleFlag(ModFlagBehavior Behavior, StringRef Key,
Metadata *Val) {
NamedMDNode *ModFlags = getOrInsertModuleFlagsMetadata();
// Replace the flag if it already exists.
- for (unsigned I = 0, E = ModFlags->getNumOperands(); I != E; ++I) {
- MDNode *Flag = ModFlags->getOperand(I);
+ for (MDNode *Flag : ModFlags->operands()) {
ModFlagBehavior MFB;
MDString *K = nullptr;
Metadata *V = nullptr;
More information about the llvm-commits
mailing list