aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Module/KModule.cpp
diff options
context:
space:
mode:
authorAndrea Mattavelli <andreamattavelli@users.noreply.github.com>2017-03-01 11:21:06 +0000
committerGitHub <noreply@github.com>2017-03-01 11:21:06 +0000
commit4f5ea494986689dd89f97f9a64082527557c71c9 (patch)
treee49d673744e699506506cbe0a3dc29c215170877 /lib/Module/KModule.cpp
parente21bf6f653b9c602fe21b74ff7c389aa2430b386 (diff)
parentb7a6aec4eeb4cbbc71d4747d2aa6d25dda41d5d1 (diff)
downloadklee-4f5ea494986689dd89f97f9a64082527557c71c9.tar.gz
Merge pull request #604 from jirislaby/add_casts
convert iterators using static_cast
Diffstat (limited to 'lib/Module/KModule.cpp')
-rw-r--r--lib/Module/KModule.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 3259873e..08ec28ef 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -190,7 +190,7 @@ static void injectStaticConstructorsAndDestructors(Module *m) {
if (ctors)
CallInst::Create(getStubFunctionForCtorList(m, ctors, "klee.ctor_stub"),
- "", mainFn->begin()->begin());
+ "", static_cast<Instruction *>(mainFn->begin()->begin()));
if (dtors) {
Function *dtorStub = getStubFunctionForCtorList(m, dtors, "klee.dtor_stub");
for (Function::iterator it = mainFn->begin(), ie = mainFn->end();
@@ -280,14 +280,15 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
llvm::errs() << "KLEE: adding klee_merge at exit of: " << name << "\n";
for (llvm::Function::iterator bbit = f->begin(), bbie = f->end();
bbit != bbie; ++bbit) {
- if (&*bbit != exit) {
+ BasicBlock *bb = static_cast<BasicBlock *>(bbit);
+ if (bb != exit) {
Instruction *i = bbit->getTerminator();
if (i->getOpcode()==Instruction::Ret) {
if (result) {
- result->addIncoming(i->getOperand(0), bbit);
+ result->addIncoming(i->getOperand(0), bb);
}
i->eraseFromParent();
- BranchInst::Create(exit, bbit);
+ BranchInst::Create(exit, bb);
}
}
}
@@ -444,7 +445,8 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
if (it->isDeclaration())
continue;
- KFunction *kf = new KFunction(it, this);
+ Function *fn = static_cast<Function *>(it);
+ KFunction *kf = new KFunction(fn, this);
for (unsigned i=0; i<kf->numInstructions; ++i) {
KInstruction *ki = kf->instructions[i];
@@ -452,7 +454,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
}
functions.push_back(kf);
- functionMap.insert(std::make_pair(it, kf));
+ functionMap.insert(std::make_pair(fn, kf));
}
/* Compute various interesting properties */
@@ -529,7 +531,7 @@ KFunction::KFunction(llvm::Function *_function,
trackCoverage(true) {
for (llvm::Function::iterator bbit = function->begin(),
bbie = function->end(); bbit != bbie; ++bbit) {
- BasicBlock *bb = bbit;
+ BasicBlock *bb = static_cast<BasicBlock *>(bbit);
basicBlockEntry[bb] = numInstructions;
numInstructions += bb->size();
}
@@ -544,7 +546,7 @@ KFunction::KFunction(llvm::Function *_function,
bbie = function->end(); bbit != bbie; ++bbit) {
for (llvm::BasicBlock::iterator it = bbit->begin(), ie = bbit->end();
it != ie; ++it)
- registerMap[it] = rnum++;
+ registerMap[static_cast<Instruction *>(it)] = rnum++;
}
numRegisters = rnum;
@@ -564,11 +566,12 @@ KFunction::KFunction(llvm::Function *_function,
ki = new KInstruction(); break;
}
- ki->inst = it;
- ki->dest = registerMap[it];
+ Instruction *inst = static_cast<Instruction *>(it);
+ ki->inst = inst;
+ ki->dest = registerMap[inst];
if (isa<CallInst>(it) || isa<InvokeInst>(it)) {
- CallSite cs(it);
+ CallSite cs(inst);
unsigned numArgs = cs.arg_size();
ki->operands = new int[numArgs+1];
ki->operands[0] = getOperandNum(cs.getCalledValue(), registerMap, km,