diff options
author | Julian Büning <julian.buening@rwth-aachen.de> | 2019-07-17 22:42:12 +0200 |
---|---|---|
committer | MartinNowack <martin.nowack@gmail.com> | 2019-10-31 15:35:05 +0000 |
commit | e32ae5ae50165593b82cffb6e946532618000933 (patch) | |
tree | b7ad0b2122e21c92a73ea68aeaab51a3937e2a88 /lib/Module/IntrinsicCleaner.cpp | |
parent | 2b78a26d9dbeb7823c5a3487bfa2535fb4b274bf (diff) | |
download | klee-e32ae5ae50165593b82cffb6e946532618000933.tar.gz |
support compilation against LLVM 9.0
Diffstat (limited to 'lib/Module/IntrinsicCleaner.cpp')
-rw-r--r-- | lib/Module/IntrinsicCleaner.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 921e6766..1c30d781 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -264,14 +264,19 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { case Intrinsic::trap: { // Intrinsic instruction "llvm.trap" found. Directly lower it to // a call of the abort() function. - Function *F = cast<Function>( - M.getOrInsertFunction("abort", Type::getVoidTy(ctx) - KLEE_LLVM_GOIF_TERMINATOR)); - F->setDoesNotReturn(); - F->setDoesNotThrow(); + auto C = M.getOrInsertFunction("abort", Type::getVoidTy(ctx) + KLEE_LLVM_GOIF_TERMINATOR); +#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0) + if (auto *F = dyn_cast<Function>(C.getCallee())) { +#else + if (auto *F = dyn_cast<Function>(C)) { +#endif + F->setDoesNotReturn(); + F->setDoesNotThrow(); + } llvm::IRBuilder<> Builder(ii); - Builder.CreateCall(F); + Builder.CreateCall(C); Builder.CreateUnreachable(); i = ii->eraseFromParent(); |