@@ -620,8 +620,8 @@ void ValueEnumerator::EnumerateNamedMetadata(const Module &M) {
620
620
}
621
621
622
622
void ValueEnumerator::EnumerateNamedMDNode (const NamedMDNode *MD) {
623
- for (unsigned i = 0 , e = MD->getNumOperands (); i != e; ++i )
624
- EnumerateMetadata (nullptr , MD-> getOperand (i) );
623
+ for (const MDNode *N : MD->operands () )
624
+ EnumerateMetadata (nullptr , N );
625
625
}
626
626
627
627
unsigned ValueEnumerator::getMetadataFunctionID (const Function *F) const {
@@ -931,10 +931,9 @@ void ValueEnumerator::EnumerateValue(const Value *V) {
931
931
// itself. This makes it more likely that we can avoid forward references
932
932
// in the reader. We know that there can be no cycles in the constants
933
933
// graph that don't go through a global variable.
934
- for (User::const_op_iterator I = C->op_begin (), E = C->op_end ();
935
- I != E; ++I)
936
- if (!isa<BasicBlock>(*I)) // Don't enumerate BB operand to BlockAddress.
937
- EnumerateValue (*I);
934
+ for (const Use &U : C->operands ())
935
+ if (!isa<BasicBlock>(U)) // Don't enumerate BB operand to BlockAddress.
936
+ EnumerateValue (U);
938
937
if (auto *CE = dyn_cast<ConstantExpr>(C)) {
939
938
if (CE->getOpcode () == Instruction::ShuffleVector)
940
939
EnumerateValue (CE->getShuffleMaskForBitcode ());
@@ -1144,12 +1143,12 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
1144
1143
}
1145
1144
1146
1145
// Add all of the function-local metadata.
1147
- for (unsigned i = 0 , e = FnLocalMDVector. size (); i != e; ++i ) {
1146
+ for (const LocalAsMetadata *Local : FnLocalMDVector) {
1148
1147
// At this point, every local values have been incorporated, we shouldn't
1149
1148
// have a metadata operand that references a value that hasn't been seen.
1150
- assert (ValueMap.count (FnLocalMDVector[i] ->getValue ()) &&
1149
+ assert (ValueMap.count (Local ->getValue ()) &&
1151
1150
" Missing value for metadata operand" );
1152
- EnumerateFunctionLocalMetadata (F, FnLocalMDVector[i] );
1151
+ EnumerateFunctionLocalMetadata (F, Local );
1153
1152
}
1154
1153
// DIArgList entries must come after function-local metadata, as it is not
1155
1154
// possible to forward-reference them.
@@ -1159,8 +1158,8 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
1159
1158
1160
1159
void ValueEnumerator::purgeFunction () {
1161
1160
// / Remove purged values from the ValueMap.
1162
- for (unsigned i = NumModuleValues, e = Values. size (); i != e; ++i )
1163
- ValueMap.erase (Values[i] .first );
1161
+ for (const auto &V : llvm::drop_begin (Values, NumModuleValues) )
1162
+ ValueMap.erase (V .first );
1164
1163
for (const Metadata *MD : llvm::drop_begin (MDs, NumModuleMDs))
1165
1164
MetadataMap.erase (MD);
1166
1165
for (const BasicBlock *BB : BasicBlocks)
0 commit comments