From 4c8fabc7de30e17ef116b8f413f3a973c29cb56c Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 22 Feb 2017 16:10:21 +0100 Subject: llvm: stop using global context It was marked as deprecated long time ago and finally removed in LLVM 3.9. Remove all uses of getGlobalContext and create our own context. Propagate it all over the code then. [v2] use ctx, not C as name Signed-off-by: Jiri Slaby --- lib/Core/Executor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Core/Executor.cpp') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 58603e7c..19a5e3f8 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -343,9 +343,10 @@ const char *Executor::TerminateReasonNames[] = { [ Unhandled ] = "xxx", }; -Executor::Executor(const InterpreterOptions &opts, InterpreterHandler *ih) +Executor::Executor(LLVMContext &ctx, const InterpreterOptions &opts, + InterpreterHandler *ih) : Interpreter(opts), kmodule(0), interpreterHandler(ih), searcher(0), - externalDispatcher(new ExternalDispatcher()), statsTracker(0), + externalDispatcher(new ExternalDispatcher(ctx)), statsTracker(0), pathWriter(0), symPathWriter(0), specialFunctionHandler(0), processTree(0), replayKTest(0), replayPath(0), usingSeeds(0), atMemoryLimit(false), inhibitForking(false), haltExecution(false), @@ -1552,7 +1553,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { if (!isVoidReturn) { LLVM_TYPE_Q Type *t = caller->getType(); - if (t != Type::getVoidTy(getGlobalContext())) { + if (t != Type::getVoidTy(i->getContext())) { // may need to do coercion due to bitcasts Expr::Width from = result->getWidth(); Expr::Width to = getWidthForLLVMType(t); @@ -3087,7 +3088,7 @@ void Executor::callExternalFunction(ExecutionState &state, } LLVM_TYPE_Q Type *resultType = target->inst->getType(); - if (resultType != Type::getVoidTy(getGlobalContext())) { + if (resultType != Type::getVoidTy(function->getContext())) { ref e = ConstantExpr::fromMemory((void*) args, getWidthForLLVMType(resultType)); bindLocal(target, state, e); @@ -3756,7 +3757,7 @@ Expr::Width Executor::getWidthForLLVMType(LLVM_TYPE_Q llvm::Type *type) const { /// -Interpreter *Interpreter::create(const InterpreterOptions &opts, +Interpreter *Interpreter::create(LLVMContext &ctx, const InterpreterOptions &opts, InterpreterHandler *ih) { - return new Executor(opts, ih); + return new Executor(ctx, opts, ih); } -- cgit 1.4.1