M1 = CloneModule(M1);
M2 = CloneModule(M2);
}
- if (Linker::LinkModules(M1, M2))
+ if (Linker::linkModules(*M1, *M2))
exit(1);
delete M2; // We are done with this module.
MisCompFunctions.emplace_back(F->getName(), F->getFunctionType());
}
- if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted))
+ if (Linker::linkModules(*ToNotOptimize, *ToOptimizeLoopExtracted))
exit(1);
MiscompiledFunctions.clear();
// extraction both didn't break the program, and didn't mask the problem.
// Replace the current program with the loop extracted version, and try to
// extract another loop.
- if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted))
+ if (Linker::linkModules(*ToNotOptimize, *ToOptimizeLoopExtracted))
exit(1);
delete ToOptimizeLoopExtracted;
std::vector<BasicBlock*> Blocks;
for (unsigned i = 0, e = MiscompiledFunctions.size(); i != e; ++i)
- for (Function::iterator I = MiscompiledFunctions[i]->begin(),
- E = MiscompiledFunctions[i]->end(); I != E; ++I)
- Blocks.push_back(I);
+ for (BasicBlock &BB : *MiscompiledFunctions[i])
+ Blocks.push_back(&BB);
// Use the list reducer to identify blocks that can be extracted without
// obscuring the bug. The Blocks list will end up containing blocks that must
if (!I->isDeclaration())
MisCompFunctions.emplace_back(I->getName(), I->getFunctionType());
- if (Linker::LinkModules(ProgClone, Extracted.get()))
+ if (Linker::linkModules(*ProgClone, *Extracted))
exit(1);
// Set the new program and delete the old one.
// the program.
std::vector<Function*> MiscompiledFunctions;
Module *Prog = BD.getProgram();
- for (Module::iterator I = Prog->begin(), E = Prog->end(); I != E; ++I)
- if (!I->isDeclaration())
- MiscompiledFunctions.push_back(I);
+ for (Function &F : *Prog)
+ if (!F.isDeclaration())
+ MiscompiledFunctions.push_back(&F);
// Do the reduction...
if (!BugpointIsInterrupted)
I = newMain->arg_begin(), E = newMain->arg_end(),
OI = oldMain->arg_begin(); I != E; ++I, ++OI) {
I->setName(OI->getName()); // Copy argument names from oldMain
- args.push_back(I);
+ args.push_back(&*I);
}
// Call the old main function and return its result
// Save the argument list.
std::vector<Value*> Args;
- for (Function::arg_iterator i = FuncWrapper->arg_begin(),
- e = FuncWrapper->arg_end(); i != e; ++i)
- Args.push_back(i);
+ for (Argument &A : FuncWrapper->args())
+ Args.push_back(&A);
// Pass on the arguments to the real function, return its result
if (F->getReturnType()->isVoidTy()) {