about summary refs log tree commit diff homepage
path: root/lib/Module
diff options
context:
space:
mode:
authorAndrea Mattavelli <andreamattavelli@users.noreply.github.com>2017-07-18 17:39:21 +0100
committerGitHub <noreply@github.com>2017-07-18 17:39:21 +0100
commit5e4f0b7c79d57b9a9908f6293a5936fa54e511e9 (patch)
tree8429e4cb0c60bec43621c4971626fea397ea108f /lib/Module
parent64f367ea9db4739b70414cba002bf25d28db6242 (diff)
parentc9c90a0ecdce10172fd5318aea60a9ff4057679f (diff)
downloadklee-5e4f0b7c79d57b9a9908f6293a5936fa54e511e9.tar.gz
Merge pull request #672 from jirislaby/llvm40_static_casts
llvm: get rid of static_casts from iterators
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/Checks.cpp4
-rw-r--r--lib/Module/InstructionInfoTable.cpp4
-rw-r--r--lib/Module/KModule.cpp12
-rw-r--r--lib/Module/LowerSwitch.cpp2
-rw-r--r--lib/Module/RaiseAsm.cpp2
5 files changed, 12 insertions, 12 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp
index 48a4eb94..eb0f189b 100644
--- a/lib/Module/Checks.cpp
+++ b/lib/Module/Checks.cpp
@@ -71,7 +71,7 @@ bool DivCheckPass::runOnModule(Module &M) {
                                           Type::getInt64Ty(ctx),
                                           false,  /* sign doesn't matter */
                                           "int_cast_to_i64",
-                                          static_cast<Instruction *>(i));
+                                          &*i);
             
             // Lazily bind the function to avoid always importing it.
             if (!divZeroCheckFunction) {
@@ -129,7 +129,7 @@ bool OvershiftCheckPass::runOnModule(Module &M) {
                                           Type::getInt64Ty(ctx),
                                           false,  /* sign doesn't matter */
                                           "int_cast_to_i64",
-                                          static_cast<Instruction *>(i));
+                                          &*i);
             args.push_back(shift);
 
 
diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp
index 8f6c7c2b..3ba4895e 100644
--- a/lib/Module/InstructionInfoTable.cpp
+++ b/lib/Module/InstructionInfoTable.cpp
@@ -120,7 +120,7 @@ InstructionInfoTable::InstructionInfoTable(Module *m)
 
   for (Module::iterator fnIt = m->begin(), fn_ie = m->end(); 
        fnIt != fn_ie; ++fnIt) {
-    Function *fn = static_cast<Function *>(fnIt);
+    Function *fn = &*fnIt;
 
     // We want to ensure that as all instructions have source information, if
     // available. Clang sometimes will not write out debug information on the
@@ -193,6 +193,6 @@ InstructionInfoTable::getFunctionInfo(const Function *f) const {
     // and construct a test case for it if it does, though.
     return dummyInfo;
   } else {
-    return getInfo(static_cast<const Instruction *>(f->begin()->begin()));
+    return getInfo(&*(f->begin()->begin()));
   }
 }
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 005c8869..aafabacc 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -196,7 +196,7 @@ static void injectStaticConstructorsAndDestructors(Module *m) {
 
     if (ctors)
     CallInst::Create(getStubFunctionForCtorList(m, ctors, "klee.ctor_stub"),
-		     "", static_cast<Instruction *>(mainFn->begin()->begin()));
+		     "", &*(mainFn->begin()->begin()));
     if (dtors) {
       Function *dtorStub = getStubFunctionForCtorList(m, dtors, "klee.dtor_stub");
       for (Function::iterator it = mainFn->begin(), ie = mainFn->end();
@@ -286,7 +286,7 @@ 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) {
-	BasicBlock *bb = static_cast<BasicBlock *>(bbit);
+	BasicBlock *bb = &*bbit;
         if (bb != exit) {
           Instruction *i = bbit->getTerminator();
           if (i->getOpcode()==Instruction::Ret) {
@@ -451,7 +451,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts,
     if (it->isDeclaration())
       continue;
 
-    Function *fn = static_cast<Function *>(it);
+    Function *fn = &*it;
     KFunction *kf = new KFunction(fn, this);
     
     for (unsigned i=0; i<kf->numInstructions; ++i) {
@@ -542,7 +542,7 @@ KFunction::KFunction(llvm::Function *_function,
     trackCoverage(true) {
   for (llvm::Function::iterator bbit = function->begin(), 
          bbie = function->end(); bbit != bbie; ++bbit) {
-    BasicBlock *bb = static_cast<BasicBlock *>(bbit);
+    BasicBlock *bb = &*bbit;
     basicBlockEntry[bb] = numInstructions;
     numInstructions += bb->size();
   }
@@ -557,7 +557,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[static_cast<Instruction *>(it)] = rnum++;
+      registerMap[&*it] = rnum++;
   }
   numRegisters = rnum;
   
@@ -577,7 +577,7 @@ KFunction::KFunction(llvm::Function *_function,
         ki = new KInstruction(); break;
       }
 
-      Instruction *inst = static_cast<Instruction *>(it);
+      Instruction *inst = &*it;
       ki->inst = inst;
       ki->dest = registerMap[inst];
 
diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp
index 5cc6b991..b20c21ab 100644
--- a/lib/Module/LowerSwitch.cpp
+++ b/lib/Module/LowerSwitch.cpp
@@ -44,7 +44,7 @@ bool LowerSwitchPass::runOnFunction(Function &F) {
   bool changed = false;
 
   for (Function::iterator I = F.begin(), E = F.end(); I != E; ) {
-    BasicBlock *cur = static_cast<BasicBlock *>(I);
+    BasicBlock *cur = &*I;
     I++; // Advance over block so we don't traverse new blocks
 
     if (SwitchInst *SI = dyn_cast<SwitchInst>(cur->getTerminator())) {
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 5fc54ef1..113dcc62 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -124,7 +124,7 @@ bool RaiseAsmPass::runOnModule(Module &M) {
   for (Module::iterator fi = M.begin(), fe = M.end(); fi != fe; ++fi) {
     for (Function::iterator bi = fi->begin(), be = fi->end(); bi != be; ++bi) {
       for (BasicBlock::iterator ii = bi->begin(), ie = bi->end(); ii != ie;) {
-        Instruction *i = static_cast<Instruction *>(ii);
+        Instruction *i = &*ii;
         ++ii;  
         changed |= runOnInstruction(M, i);
       }