Rangify several for loops, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239733 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Yaron Keren
2015-06-15 16:20:16 +00:00
parent 2ecc72cc58
commit b4c2481907

View File

@@ -1254,15 +1254,15 @@ bool ModuleLinker::linkGlobalValueBody(GlobalValue &Src) {
/// Insert all of the named MDNodes in Src into the Dest module. /// Insert all of the named MDNodes in Src into the Dest module.
void ModuleLinker::linkNamedMDNodes() { void ModuleLinker::linkNamedMDNodes() {
const NamedMDNode *SrcModFlags = SrcM->getModuleFlagsMetadata(); const NamedMDNode *SrcModFlags = SrcM->getModuleFlagsMetadata();
for (Module::const_named_metadata_iterator I = SrcM->named_metadata_begin(), for (const NamedMDNode &NMD : SrcM->named_metadata()) {
E = SrcM->named_metadata_end(); I != E; ++I) {
// Don't link module flags here. Do them separately. // Don't link module flags here. Do them separately.
if (&*I == SrcModFlags) continue; if (&NMD == SrcModFlags)
NamedMDNode *DestNMD = DstM->getOrInsertNamedMetadata(I->getName()); continue;
NamedMDNode *DestNMD = DstM->getOrInsertNamedMetadata(NMD.getName());
// Add Src elements into Dest node. // Add Src elements into Dest node.
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) for (const MDNode *op : NMD.operands())
DestNMD->addOperand(MapMetadata(I->getOperand(i), ValueMap, RF_None, DestNMD->addOperand(
&TypeMap, &ValMaterializer)); MapMetadata(op, ValueMap, RF_None, &TypeMap, &ValMaterializer));
} }
} }
@@ -1542,9 +1542,8 @@ bool ModuleLinker::run() {
// Insert all of the globals in src into the DstM module... without linking // Insert all of the globals in src into the DstM module... without linking
// initializers (which could refer to functions not yet mapped over). // initializers (which could refer to functions not yet mapped over).
for (Module::global_iterator I = SrcM->global_begin(), for (GlobalVariable &GV : SrcM->globals())
E = SrcM->global_end(); I != E; ++I) if (linkGlobalValueProto(&GV))
if (linkGlobalValueProto(I))
return true; return true;
// Link the functions together between the two modules, without doing function // Link the functions together between the two modules, without doing function
@@ -1552,18 +1551,17 @@ bool ModuleLinker::run() {
// function... We do this so that when we begin processing function bodies, // function... We do this so that when we begin processing function bodies,
// all of the global values that may be referenced are available in our // all of the global values that may be referenced are available in our
// ValueMap. // ValueMap.
for (Module::iterator I = SrcM->begin(), E = SrcM->end(); I != E; ++I) for (Function &F :*SrcM)
if (linkGlobalValueProto(I)) if (linkGlobalValueProto(&F))
return true; return true;
// If there were any aliases, link them now. // If there were any aliases, link them now.
for (Module::alias_iterator I = SrcM->alias_begin(), for (GlobalAlias &GA : SrcM->aliases())
E = SrcM->alias_end(); I != E; ++I) if (linkGlobalValueProto(&GA))
if (linkGlobalValueProto(I))
return true; return true;
for (unsigned i = 0, e = AppendingVars.size(); i != e; ++i) for (const AppendingVarInfo &AppendingVar : AppendingVars)
linkAppendingVarInit(AppendingVars[i]); linkAppendingVarInit(AppendingVar);
for (const auto &Entry : DstM->getComdatSymbolTable()) { for (const auto &Entry : DstM->getComdatSymbolTable()) {
const Comdat &C = Entry.getValue(); const Comdat &C = Entry.getValue();