From 37e92d0c802524c19a9a84164253639aac47fee3 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Sat, 22 Jul 2017 01:03:44 +0200 Subject: Remove support for LLVM < 3.4 Request LLVM 3.4 as minimal requirement for KLEE --- include/klee/Config/Version.h | 6 ---- include/klee/Expr.h | 3 -- include/klee/Internal/Module/KModule.h | 8 ----- include/klee/Internal/Support/ModuleUtil.h | 6 ---- include/klee/util/GetElementPtrTypeIterator.h | 51 ++++++++++----------------- 5 files changed, 18 insertions(+), 56 deletions(-) (limited to 'include') diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h index c1fdbb97..ccf54ae1 100644 --- a/include/klee/Config/Version.h +++ b/include/klee/Config/Version.h @@ -15,12 +15,6 @@ #define LLVM_VERSION(major, minor) (((major) << 8) | (minor)) #define LLVM_VERSION_CODE LLVM_VERSION(LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR) -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0) -# define LLVM_TYPE_Q -#else -# define LLVM_TYPE_Q const -#endif - #if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) # define KLEE_LLVM_CL_VAL_END #else diff --git a/include/klee/Expr.h b/include/klee/Expr.h index 6c5351df..212053b4 100644 --- a/include/klee/Expr.h +++ b/include/klee/Expr.h @@ -332,13 +332,10 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Expr &e) { return os; } -// XXX the following macro is to work around the ExprTest unit test compile error -#ifndef LLVM_29_UNITTEST inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Expr::Kind kind) { Expr::printKind(os, kind); return os; } -#endif inline std::stringstream &operator<<(std::stringstream &os, const Expr &e) { std::string str; diff --git a/include/klee/Internal/Module/KModule.h b/include/klee/Internal/Module/KModule.h index 76db4694..f0f20394 100644 --- a/include/klee/Internal/Module/KModule.h +++ b/include/klee/Internal/Module/KModule.h @@ -23,11 +23,7 @@ namespace llvm { class Function; class Instruction; class Module; -#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) - class TargetData; -#else class DataLayout; -#endif } namespace klee { @@ -85,11 +81,7 @@ namespace klee { class KModule { public: llvm::Module *module; -#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) - llvm::TargetData *targetData; -#else llvm::DataLayout *targetData; -#endif // Some useful functions to know the address of llvm::Function *kleeMergeFn; diff --git a/include/klee/Internal/Support/ModuleUtil.h b/include/klee/Internal/Support/ModuleUtil.h index 78998051..4c3243ce 100644 --- a/include/klee/Internal/Support/ModuleUtil.h +++ b/include/klee/Internal/Support/ModuleUtil.h @@ -12,15 +12,9 @@ #include "klee/Config/Version.h" -#if LLVM_VERSION_CODE > LLVM_VERSION(3, 2) #include "llvm/IR/Module.h" #include "llvm/IR/Function.h" #include "llvm/IR/LLVMContext.h" -#else -#include "llvm/Module.h" -#include "llvm/Function.h" -#include "llvm/LLVMContext.h" -#endif #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 5) #include "llvm/IR/CallSite.h" diff --git a/include/klee/util/GetElementPtrTypeIterator.h b/include/klee/util/GetElementPtrTypeIterator.h index 2d145cd6..5fb9f4ec 100644 --- a/include/klee/util/GetElementPtrTypeIterator.h +++ b/include/klee/util/GetElementPtrTypeIterator.h @@ -18,32 +18,22 @@ #ifndef KLEE_UTIL_GETELEMENTPTRTYPE_H #define KLEE_UTIL_GETELEMENTPTRTYPE_H -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3) #include "llvm/IR/User.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Constants.h" -#else -#include "llvm/User.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0) -#include "llvm/Constants.h" -#endif -#endif #include "klee/Config/Version.h" namespace klee { - template - class generic_gep_type_iterator - : public std::iterator { - typedef std::iterator super; +template +class generic_gep_type_iterator + : public std::iterator { + typedef std::iterator + super; ItTy OpIt; - LLVM_TYPE_Q llvm::Type *CurTy; + llvm::Type *CurTy; generic_gep_type_iterator() {} llvm::Value *asValue(llvm::Value *V) const { return V; } @@ -52,9 +42,7 @@ namespace klee { } public: - - static generic_gep_type_iterator begin(LLVM_TYPE_Q llvm::Type *Ty, - ItTy It) { + static generic_gep_type_iterator begin(llvm::Type *Ty, ItTy It) { generic_gep_type_iterator I; I.CurTy = Ty; I.OpIt = It; @@ -74,24 +62,21 @@ namespace klee { return !operator==(x); } - LLVM_TYPE_Q llvm::Type *operator*() const { - return CurTy; - } + llvm::Type *operator*() const { return CurTy; } - LLVM_TYPE_Q llvm::Type *getIndexedType() const { - LLVM_TYPE_Q llvm::CompositeType *CT = cast(CurTy); + llvm::Type *getIndexedType() const { + llvm::CompositeType *CT = cast(CurTy); return CT->getTypeAtIndex(getOperand()); } // This is a non-standard operator->. It allows you to call methods on the // current type directly. - LLVM_TYPE_Q llvm::Type *operator->() const { return operator*(); } + llvm::Type *operator->() const { return operator*(); } llvm::Value *getOperand() const { return asValue(*OpIt); } generic_gep_type_iterator& operator++() { // Preincrement - if (LLVM_TYPE_Q llvm::CompositeType *CT = - dyn_cast(CurTy)) { + if (llvm::CompositeType *CT = dyn_cast(CurTy)) { CurTy = CT->getTypeAtIndex(getOperand()); } else { CurTy = 0; @@ -149,15 +134,15 @@ namespace klee { return vce_type_iterator::end(CE->getIndices().end()); } - template - inline generic_gep_type_iterator - gep_type_begin(LLVM_TYPE_Q llvm::Type *Op0, ItTy I, ItTy E) { + template + inline generic_gep_type_iterator gep_type_begin(llvm::Type *Op0, ItTy I, + ItTy E) { return generic_gep_type_iterator::begin(Op0, I); } - template - inline generic_gep_type_iterator - gep_type_end(LLVM_TYPE_Q llvm::Type *Op0, ItTy I, ItTy E) { + template + inline generic_gep_type_iterator gep_type_end(llvm::Type *Op0, ItTy I, + ItTy E) { return generic_gep_type_iterator::end(E); } } // end namespace klee -- cgit 1.4.1