about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-06-07 14:30:54 +0200
committerJiri Slaby <jirislaby@gmail.com>2017-06-15 14:42:45 +0200
commitc9c90a0ecdce10172fd5318aea60a9ff4057679f (patch)
tree9bb4b6d1ca326480776340312c5454ee78a2a1a5 /tools
parent6204a1faed8f6ed15318be8da3e8e4b5e2f2a4ac (diff)
downloadklee-c9c90a0ecdce10172fd5318aea60a9ff4057679f.tar.gz
llvm: get rid of static_casts from iterators
In commit b7a6aec4eeb4 (convert iterators using static_cast), I switched
all implicit casts to static_cast. It turned out that llvm 4.0 banned
casting via static_cast. See e.g. 1e2bc42eb988 in the llvm repo what
they do.

So similarly to the above commit, change all the casts of iterators to
"&*" which is what they do in LLVM.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 94798dad..e7f79243 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -670,10 +670,10 @@ static int initEnv(Module *mainModule) {
     klee_error("Cannot handle ""--posix-runtime"" when main() has less than two arguments.\n");
   }
 
-  Instruction *firstInst = static_cast<Instruction *>(mainFn->begin()->begin());
+  Instruction *firstInst = &*(mainFn->begin()->begin());
 
-  Value *oldArgc = static_cast<Argument *>(mainFn->arg_begin());
-  Value *oldArgv = static_cast<Argument *>(++mainFn->arg_begin());
+  Value *oldArgc = &*(mainFn->arg_begin());
+  Value *oldArgv = &*(++mainFn->arg_begin());
 
   AllocaInst* argcPtr =
     new AllocaInst(oldArgc->getType(), "argcPtr", firstInst);
@@ -1080,7 +1080,7 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir)
   // naming conflict.
   for (Module::iterator fi = mainModule->begin(), fe = mainModule->end();
        fi != fe; ++fi) {
-    Function *f = static_cast<Function *>(fi);
+    Function *f = &*fi;
     const std::string &name = f->getName();
     if (name[0]=='\01') {
       unsigned size = name.size();
@@ -1139,8 +1139,8 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir)
   std::vector<llvm::Value*> args;
   args.push_back(llvm::ConstantExpr::getBitCast(userMainFn,
                                                 ft->getParamType(0)));
-  args.push_back(static_cast<Argument *>(stub->arg_begin())); // argc
-  args.push_back(static_cast<Argument *>(++stub->arg_begin())); // argv
+  args.push_back(&*(stub->arg_begin())); // argc
+  args.push_back(&*(++stub->arg_begin())); // argv
   args.push_back(Constant::getNullValue(ft->getParamType(3))); // app_init
   args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini
   args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini