diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2017-02-22 16:10:21 +0100 |
---|---|---|
committer | Jiri Slaby <jirislaby@gmail.com> | 2017-02-25 11:11:04 +0100 |
commit | 4c8fabc7de30e17ef116b8f413f3a973c29cb56c (patch) | |
tree | 29e23676c07a95e83c58b5bcb5f8fd4189efaf45 /lib/Module/Checks.cpp | |
parent | 1b67624c3a2fc1ca6f60d0a2b0f675d046dbba76 (diff) | |
download | klee-4c8fabc7de30e17ef116b8f413f3a973c29cb56c.tar.gz |
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 <jirislaby@gmail.com>
Diffstat (limited to 'lib/Module/Checks.cpp')
-rw-r--r-- | lib/Module/Checks.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 7d9b7284..44b35e6e 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -53,6 +53,7 @@ char DivCheckPass::ID; bool DivCheckPass::runOnModule(Module &M) { Function *divZeroCheckFunction = 0; + LLVMContext &ctx = M.getContext(); bool moduleChanged = false; @@ -67,7 +68,7 @@ bool DivCheckPass::runOnModule(Module &M) { CastInst *denominator = CastInst::CreateIntegerCast(i->getOperand(1), - Type::getInt64Ty(getGlobalContext()), + Type::getInt64Ty(ctx), false, /* sign doesn't matter */ "int_cast_to_i64", i); @@ -75,8 +76,8 @@ bool DivCheckPass::runOnModule(Module &M) { // Lazily bind the function to avoid always importing it. if (!divZeroCheckFunction) { Constant *fc = M.getOrInsertFunction("klee_div_zero_check", - Type::getVoidTy(getGlobalContext()), - Type::getInt64Ty(getGlobalContext()), + Type::getVoidTy(ctx), + Type::getInt64Ty(ctx), NULL); divZeroCheckFunction = cast<Function>(fc); } @@ -100,6 +101,7 @@ char OvershiftCheckPass::ID; bool OvershiftCheckPass::runOnModule(Module &M) { Function *overshiftCheckFunction = 0; + LLVMContext &ctx = M.getContext(); bool moduleChanged = false; @@ -118,12 +120,13 @@ bool OvershiftCheckPass::runOnModule(Module &M) { // Determine bit width of first operand uint64_t bitWidth=i->getOperand(0)->getType()->getScalarSizeInBits(); - ConstantInt *bitWidthC = ConstantInt::get(Type::getInt64Ty(getGlobalContext()),bitWidth,false); + ConstantInt *bitWidthC = ConstantInt::get(Type::getInt64Ty(ctx), + bitWidth, false); args.push_back(bitWidthC); CastInst *shift = CastInst::CreateIntegerCast(i->getOperand(1), - Type::getInt64Ty(getGlobalContext()), + Type::getInt64Ty(ctx), false, /* sign doesn't matter */ "int_cast_to_i64", i); @@ -133,9 +136,9 @@ bool OvershiftCheckPass::runOnModule(Module &M) { // Lazily bind the function to avoid always importing it. if (!overshiftCheckFunction) { Constant *fc = M.getOrInsertFunction("klee_overshift_check", - Type::getVoidTy(getGlobalContext()), - Type::getInt64Ty(getGlobalContext()), - Type::getInt64Ty(getGlobalContext()), + Type::getVoidTy(ctx), + Type::getInt64Ty(ctx), + Type::getInt64Ty(ctx), NULL); overshiftCheckFunction = cast<Function>(fc); } |