From b7a6aec4eeb4cbbc71d4747d2aa6d25dda41d5d1 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 23 Feb 2017 17:41:33 +0100 Subject: convert iterators using static_cast Newer versions of LLVM do not allow to implicitly cast iterators to pointers where they point. So convert all such uses to explicit static_cast, the same as LLVM code does. Otherwise we see errors like: lib/Core/Executor.cpp:548:15: error: no viable conversion from 'Module::iterator' (aka 'ilist_iterator') to 'llvm::Function *' Function *f = i; ^ ~ Signed-off-by: Jiri Slaby --- tools/klee/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index 505d259c..c65953d1 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -677,10 +677,10 @@ static int initEnv(Module *mainModule) { klee_error("Cannot handle ""--posix-runtime"" when main() has less than two arguments.\n"); } - Instruction* firstInst = mainFn->begin()->begin(); + Instruction *firstInst = static_cast(mainFn->begin()->begin()); - Value* oldArgc = mainFn->arg_begin(); - Value* oldArgv = ++mainFn->arg_begin(); + Value *oldArgc = static_cast(mainFn->arg_begin()); + Value *oldArgv = static_cast(++mainFn->arg_begin()); AllocaInst* argcPtr = new AllocaInst(oldArgc->getType(), "argcPtr", firstInst); @@ -1082,7 +1082,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 = fi; + Function *f = static_cast(fi); const std::string &name = f->getName(); if (name[0]=='\01') { unsigned size = name.size(); @@ -1141,8 +1141,8 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir) std::vector args; args.push_back(llvm::ConstantExpr::getBitCast(userMainFn, ft->getParamType(0))); - args.push_back(stub->arg_begin()); // argc - args.push_back(++stub->arg_begin()); // argv + args.push_back(static_cast(stub->arg_begin())); // argc + args.push_back(static_cast(++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 -- cgit 1.4.1