summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-12-08 14:20:10 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-12-08 14:20:10 +0000
commita314d1aca490c99ae59a7a806f7ffa283454962b (patch)
tree20165346f11fdaab088badec7e2e6e8013289365 /llvm/lib/Linker/LinkModules.cpp
parent21ec84eb815acf09fd1be8a150bc7303adc9ff75 (diff)
downloadbcm5719-llvm-a314d1aca490c99ae59a7a806f7ffa283454962b.tar.gz
bcm5719-llvm-a314d1aca490c99ae59a7a806f7ffa283454962b.zip
Use range loops. NFC.
llvm-svn: 223658
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 3becbfcb4ed..b9a05deeb17 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -1189,12 +1189,12 @@ bool ModuleLinker::linkFunctionBody(Function *Dst, Function *Src) {
// Go through and convert function arguments over, remembering the mapping.
Function::arg_iterator DI = Dst->arg_begin();
- for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
- I != E; ++I, ++DI) {
- DI->setName(I->getName()); // Copy the name over.
+ for (Argument &Arg : Src->args()) {
+ DI->setName(Arg.getName()); // Copy the name over.
// Add a mapping to our mapping.
- ValueMap[I] = DI;
+ ValueMap[&Arg] = DI;
+ ++DI;
}
// 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
// the Source function as operands. Loop through all of the operands of the
// 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::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- RemapInstruction(I, ValueMap, RF_IgnoreMissingEntries, &TypeMap,
+ for (BasicBlock &BB : *Dst)
+ for (Instruction &I : BB)
+ RemapInstruction(&I, ValueMap, RF_IgnoreMissingEntries, &TypeMap,
&ValMaterializer);
// There is no need to map the arguments anymore.
- for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
- I != E; ++I)
- ValueMap.erase(I);
+ for (Argument &Arg : Src->args())
+ ValueMap.erase(&Arg);
Src->Dematerialize();
return false;
OpenPOWER on IntegriCloud