klee/0001-llvm5-avoid-on-function-arg_begin.patch

37 lines
1.3 KiB
Diff

From: Jiri Slaby <jirislaby@gmail.com>
Date: Mon, 15 Jan 2018 10:35:19 +0100
Subject: llvm5: avoid ++ on function->arg_begin()
Patch-mainline: no
Starting with llvm 5, arguments of a function are not an iterator, but
an array. So they cannot be incremented in-place. Add a local auto
variable and increment that.
Otherwise we see:
../tools/klee/main.cpp:661:23: error: expression is not assignable
Value *oldArgv = &*(++mainFn->arg_begin());
^ ~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
tools/klee/main.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 1de5fbeb7e0e..3be619138bd6 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -1036,7 +1036,8 @@ createLibCWrapper(std::vector<std::unique_ptr<llvm::Module>> &modules,
args.push_back(
llvm::ConstantExpr::getBitCast(inModuleRefernce, ft->getParamType(0)));
args.push_back(&*(stub->arg_begin())); // argc
- args.push_back(&*(++stub->arg_begin())); // argv
+ auto arg_it = stub->arg_begin();
+ args.push_back(&*(++arg_it)); // 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
--
2.19.0