[IR] Use range-based for loops (NFC) (#97950)

This commit is contained in:
Kazu Hirata 2024-07-08 09:06:02 +09:00 committed by GitHub
parent 73447a3302
commit cc5ba739f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -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) {

View File

@ -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;