From 5fe62b55508a9374519b363f08fc9bf32a0c5151 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 15 Jan 2018 10:27:54 +0100 Subject: llvm5: handle getOrInsertFunction terminator llvm 5 does not terminate getOrInsertFunction parameters with NULL, take care of that. Since commit 9d54400bba7eb04bca80fce97fa170452d19eaf1. Signed-off-by: Jiri Slaby --- include/klee/Config/Version.h | 6 ++++++ lib/Module/Checks.cpp | 4 ++-- lib/Module/IntrinsicCleaner.cpp | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h index 53205160..a02ce28b 100644 --- a/include/klee/Config/Version.h +++ b/include/klee/Config/Version.h @@ -27,4 +27,10 @@ # define KLEE_LLVM_CL_VAL_END , clEnumValEnd #endif +#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0) +# define KLEE_LLVM_GOIF_TERMINATOR +#else +# define KLEE_LLVM_GOIF_TERMINATOR , NULL +#endif + #endif diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index 9286c491..10481f14 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -73,7 +73,7 @@ bool DivCheckPass::runOnModule(Module &M) { KleeIRMetaData md(ctx); auto divZeroCheckFunction = cast( M.getOrInsertFunction("klee_div_zero_check", Type::getVoidTy(ctx), - Type::getInt64Ty(ctx), NULL)); + Type::getInt64Ty(ctx) KLEE_LLVM_GOIF_TERMINATOR)); for (auto &divInst : divInstruction) { llvm::IRBuilder<> Builder(divInst /* Inserts before divInst*/); @@ -132,7 +132,7 @@ bool OvershiftCheckPass::runOnModule(Module &M) { KleeIRMetaData md(ctx); auto overshiftCheckFunction = cast(M.getOrInsertFunction( "klee_overshift_check", Type::getVoidTy(ctx), Type::getInt64Ty(ctx), - Type::getInt64Ty(ctx), NULL)); + Type::getInt64Ty(ctx) KLEE_LLVM_GOIF_TERMINATOR)); for (auto &shiftInst : shiftInstructions) { llvm::IRBuilder<> Builder(shiftInst); diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index c48952c2..ab16a265 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -210,7 +210,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { // Intrinsic instruction "llvm.trap" found. Directly lower it to // a call of the abort() function. Function *F = cast( - M.getOrInsertFunction("abort", Type::getVoidTy(ctx), NULL)); + M.getOrInsertFunction("abort", Type::getVoidTy(ctx) + KLEE_LLVM_GOIF_TERMINATOR)); F->setDoesNotReturn(); F->setDoesNotThrow(); -- cgit 1.4.1