Use range loops. NFC.

llvm-svn: 223658
This commit is contained in:
Rafael Espindola 2014-12-08 14:20:10 +00:00
parent 21ec84eb81
commit a314d1aca4
1 changed files with 9 additions and 10 deletions

View File

@ -1189,12 +1189,12 @@ bool ModuleLinker::linkFunctionBody(Function *Dst, Function *Src) {
// Go through and convert function arguments over, remembering the mapping. // Go through and convert function arguments over, remembering the mapping.
Function::arg_iterator DI = Dst->arg_begin(); Function::arg_iterator DI = Dst->arg_begin();
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); for (Argument &Arg : Src->args()) {
I != E; ++I, ++DI) { DI->setName(Arg.getName()); // Copy the name over.
DI->setName(I->getName()); // Copy the name over.
// Add a mapping to our mapping. // Add a mapping to our mapping.
ValueMap[I] = DI; ValueMap[&Arg] = DI;
++DI;
} }
// Splice the body of the source function into the dest function. // Splice the body of the source function into the dest function.
@ -1204,15 +1204,14 @@ bool ModuleLinker::linkFunctionBody(Function *Dst, Function *Src) {
// copied over. The only problem is that they are still referencing values in // copied over. The only problem is that they are still referencing values in
// the Source function as operands. Loop through all of the operands of the // the Source function as operands. Loop through all of the operands of the
// functions and patch them up to point to the local versions. // functions and patch them up to point to the local versions.
for (Function::iterator BB = Dst->begin(), BE = Dst->end(); BB != BE; ++BB) for (BasicBlock &BB : *Dst)
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) for (Instruction &I : BB)
RemapInstruction(I, ValueMap, RF_IgnoreMissingEntries, &TypeMap, RemapInstruction(&I, ValueMap, RF_IgnoreMissingEntries, &TypeMap,
&ValMaterializer); &ValMaterializer);
// There is no need to map the arguments anymore. // There is no need to map the arguments anymore.
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); for (Argument &Arg : Src->args())
I != E; ++I) ValueMap.erase(&Arg);
ValueMap.erase(I);
Src->Dematerialize(); Src->Dematerialize();
return false; return false;