Use a range loop. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239919 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-17 17:33:37 +00:00
parent 7540f2c60a
commit b200e2f9b4

View File

@ -725,33 +725,28 @@ void SlotTracker::processModule() {
ST_DEBUG("begin processModule!\n"); ST_DEBUG("begin processModule!\n");
// Add all of the unnamed global variables to the value table. // Add all of the unnamed global variables to the value table.
for (Module::const_global_iterator I = TheModule->global_begin(), for (const GlobalVariable &Var : TheModule->globals()) {
E = TheModule->global_end(); I != E; ++I) { if (!Var.hasName())
if (!I->hasName()) CreateModuleSlot(&Var);
CreateModuleSlot(I);
} }
// Add metadata used by named metadata. // Add metadata used by named metadata.
for (Module::const_named_metadata_iterator for (const NamedMDNode &NMD : TheModule->named_metadata()) {
I = TheModule->named_metadata_begin(), for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)
E = TheModule->named_metadata_end(); I != E; ++I) { CreateMetadataSlot(NMD.getOperand(i));
const NamedMDNode *NMD = I;
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i)
CreateMetadataSlot(NMD->getOperand(i));
} }
for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); for (const Function &F : *TheModule) {
I != E; ++I) { if (!F.hasName())
if (!I->hasName())
// Add all the unnamed functions to the table. // Add all the unnamed functions to the table.
CreateModuleSlot(I); CreateModuleSlot(&F);
if (ShouldInitializeAllMetadata) if (ShouldInitializeAllMetadata)
processFunctionMetadata(*I); processFunctionMetadata(F);
// Add all the function attributes to the table. // Add all the function attributes to the table.
// FIXME: Add attributes of other objects? // FIXME: Add attributes of other objects?
AttributeSet FnAttrs = I->getAttributes().getFnAttributes(); AttributeSet FnAttrs = F.getAttributes().getFnAttributes();
if (FnAttrs.hasAttributes(AttributeSet::FunctionIndex)) if (FnAttrs.hasAttributes(AttributeSet::FunctionIndex))
CreateAttributeSetSlot(FnAttrs); CreateAttributeSetSlot(FnAttrs);
} }