From ed9ea0cf9dc856920afc6813fa1bea0ec7660ba1 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 20 Jul 2011 13:35:52 +0000 Subject: Deprecate LLVM_VERSION_MAJOR and LLVM_VERSION_MINOR in favour of version codes. This makes the preprocessor-based version tests more concise and less error prone. Also, fix the version tests in lib/Expr/Parser.cpp (immutable zext and trunc were introduced in LLVM 2.9); now 2.9 passes "make test". git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@135583 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/klee/Config/Version.h | 18 ++++++++++++++++++ include/klee/Config/config.h.in | 5 +++++ include/klee/Internal/Module/KInstruction.h | 4 ++-- include/klee/Statistic.h | 4 ++-- include/klee/util/Bits.h | 4 ++-- include/klee/util/GetElementPtrTypeIterator.h | 3 ++- 6 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 include/klee/Config/Version.h (limited to 'include') diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h new file mode 100644 index 00000000..f5adaa66 --- /dev/null +++ b/include/klee/Config/Version.h @@ -0,0 +1,18 @@ +//===-- Version.h -----------------------------------------------*- C++ -*-===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef KLEE_CONFIG_VERSION_H +#define KLEE_CONFIG_VERSION_H + +#include "klee/Config/config.h" + +#define LLVM_VERSION(major, minor) (((major) << 8) | (minor)) +#define LLVM_VERSION_CODE LLVM_VERSION(LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR) + +#endif diff --git a/include/klee/Config/config.h.in b/include/klee/Config/config.h.in index 653b27a4..023d04fe 100644 --- a/include/klee/Config/config.h.in +++ b/include/klee/Config/config.h.in @@ -1,5 +1,8 @@ /* include/klee/Config/config.h.in. Generated from autoconf/configure.tmp.ac by autoheader. */ +#ifndef KLEE_CONFIG_CONFIG_H +#define KLEE_CONFIG_CONFIG_H + /* Does the platform use __ctype_b_loc, etc. */ #undef HAVE_CTYPE_EXTERNALS @@ -74,3 +77,5 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS + +#endif diff --git a/include/klee/Internal/Module/KInstruction.h b/include/klee/Internal/Module/KInstruction.h index f6becd4a..c96d103b 100644 --- a/include/klee/Internal/Module/KInstruction.h +++ b/include/klee/Internal/Module/KInstruction.h @@ -10,8 +10,8 @@ #ifndef KLEE_KINSTRUCTION_H #define KLEE_KINSTRUCTION_H -#include "klee/Config/config.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#include "klee/Config/Version.h" +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/DataTypes.h" #else #include "llvm/Support/DataTypes.h" diff --git a/include/klee/Statistic.h b/include/klee/Statistic.h index 6261fd95..f567f680 100644 --- a/include/klee/Statistic.h +++ b/include/klee/Statistic.h @@ -10,8 +10,8 @@ #ifndef KLEE_STATISTIC_H #define KLEE_STATISTIC_H -#include "klee/Config/config.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#include "klee/Config/Version.h" +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/DataTypes.h" #else #include "llvm/Support/DataTypes.h" diff --git a/include/klee/util/Bits.h b/include/klee/util/Bits.h index 06703604..f2bb7692 100644 --- a/include/klee/util/Bits.h +++ b/include/klee/util/Bits.h @@ -10,8 +10,8 @@ #ifndef KLEE_UTIL_BITS_H #define KLEE_UTIL_BITS_H -#include "klee/Config/config.h" -#if (LLVM_VERSION_MAJOR == 2 && LLVM_VERSION_MINOR < 9) +#include "klee/Config/Version.h" +#if LLVM_VERSION_CODE < LLVM_VERSION(2, 9) #include "llvm/System/DataTypes.h" #else #include "llvm/Support/DataTypes.h" diff --git a/include/klee/util/GetElementPtrTypeIterator.h b/include/klee/util/GetElementPtrTypeIterator.h index c552595c..302c19ef 100644 --- a/include/klee/util/GetElementPtrTypeIterator.h +++ b/include/klee/util/GetElementPtrTypeIterator.h @@ -21,7 +21,8 @@ #include "llvm/User.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" -#if (LLVM_VERSION_MAJOR > 2) +#include "klee/Config/Version.h" +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0) #include "llvm/Constants.h" #endif -- cgit 1.4.1