about summary refs log tree commit diff homepage
path: root/include
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-07-20 18:36:48 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2011-07-20 18:36:48 +0000
commitb640fcf217c848ad051977018c6dc8f3a5a37e1f (patch)
tree70c49e15714efdd13bfa096352701638c3b23db1 /include
parented9ea0cf9dc856920afc6813fa1bea0ec7660ba1 (diff)
downloadklee-b640fcf217c848ad051977018c6dc8f3a5a37e1f.tar.gz
Updates for LLVM 3.0. Based on changes by arrowdodger, thanks!
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@135598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/klee/Config/Version.h6
-rw-r--r--include/klee/util/GetElementPtrTypeIterator.h27
2 files changed, 22 insertions, 11 deletions
diff --git a/include/klee/Config/Version.h b/include/klee/Config/Version.h
index f5adaa66..ea2af961 100644
--- a/include/klee/Config/Version.h
+++ b/include/klee/Config/Version.h
@@ -15,4 +15,10 @@
 #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
+
 #endif
diff --git a/include/klee/util/GetElementPtrTypeIterator.h b/include/klee/util/GetElementPtrTypeIterator.h
index 302c19ef..4446914d 100644
--- a/include/klee/util/GetElementPtrTypeIterator.h
+++ b/include/klee/util/GetElementPtrTypeIterator.h
@@ -18,6 +18,8 @@
 #ifndef KLEE_UTIL_GETELEMENTPTRTYPE_H
 #define KLEE_UTIL_GETELEMENTPTRTYPE_H
 
+#include "klee/Config/Version.h"
+
 #include "llvm/User.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
@@ -29,12 +31,13 @@
 namespace klee {
   template<typename ItTy = llvm::User::const_op_iterator>
   class generic_gep_type_iterator
-    : public std::iterator<std::forward_iterator_tag, const llvm::Type *, ptrdiff_t> {
+    : public std::iterator<std::forward_iterator_tag,
+                           LLVM_TYPE_Q llvm::Type *, ptrdiff_t> {
     typedef std::iterator<std::forward_iterator_tag,
-                          const llvm::Type *, ptrdiff_t> super;
+                          LLVM_TYPE_Q llvm::Type *, ptrdiff_t> super;
 
     ItTy OpIt;
-    const llvm::Type *CurTy;
+    LLVM_TYPE_Q llvm::Type *CurTy;
     generic_gep_type_iterator() {}
 
     llvm::Value *asValue(llvm::Value *V) const { return V; }
@@ -44,7 +47,8 @@ namespace klee {
 
   public:
 
-    static generic_gep_type_iterator begin(const llvm::Type *Ty, ItTy It) {
+    static generic_gep_type_iterator begin(LLVM_TYPE_Q llvm::Type *Ty,
+                                           ItTy It) {
       generic_gep_type_iterator I;
       I.CurTy = Ty;
       I.OpIt = It;
@@ -64,23 +68,24 @@ namespace klee {
       return !operator==(x);
     }
 
-    const llvm::Type *operator*() const {
+    LLVM_TYPE_Q llvm::Type *operator*() const {
       return CurTy;
     }
 
-    const llvm::Type *getIndexedType() const {
-      const llvm::CompositeType *CT = cast<llvm::CompositeType>(CurTy);
+    LLVM_TYPE_Q llvm::Type *getIndexedType() const {
+      LLVM_TYPE_Q llvm::CompositeType *CT = cast<llvm::CompositeType>(CurTy);
       return CT->getTypeAtIndex(getOperand());
     }
 
     // This is a non-standard operator->.  It allows you to call methods on the
     // current type directly.
-    const llvm::Type *operator->() const { return operator*(); }
+    LLVM_TYPE_Q llvm::Type *operator->() const { return operator*(); }
 
     llvm::Value *getOperand() const { return asValue(*OpIt); }
 
     generic_gep_type_iterator& operator++() {   // Preincrement
-      if (const llvm::CompositeType *CT = dyn_cast<llvm::CompositeType>(CurTy)) {
+      if (LLVM_TYPE_Q llvm::CompositeType *CT =
+            dyn_cast<llvm::CompositeType>(CurTy)) {
         CurTy = CT->getTypeAtIndex(getOperand());
       } else {
         CurTy = 0;
@@ -140,13 +145,13 @@ namespace klee {
 
   template<typename ItTy>
   inline generic_gep_type_iterator<ItTy>
-  gep_type_begin(const llvm::Type *Op0, ItTy I, ItTy E) {
+  gep_type_begin(LLVM_TYPE_Q llvm::Type *Op0, ItTy I, ItTy E) {
     return generic_gep_type_iterator<ItTy>::begin(Op0, I);
   }
 
   template<typename ItTy>
   inline generic_gep_type_iterator<ItTy>
-  gep_type_end(const llvm::Type *Op0, ItTy I, ItTy E) {
+  gep_type_end(LLVM_TYPE_Q llvm::Type *Op0, ItTy I, ItTy E) {
     return generic_gep_type_iterator<ItTy>::end(E);
   }
 } // end namespace klee