about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2019-12-12 15:18:58 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-02-13 18:13:00 +0000
commit0e34aab465c361b4dd3b7f1d5ff40b312922f921 (patch)
tree349a342b6ea8dcf6b0888bfac82bbfc41aa28a85
parenta34c5c7604f110a45f20c999f6ff970336673886 (diff)
downloadklee-0e34aab465c361b4dd3b7f1d5ff40b312922f921.tar.gz
Replace old TR1 implementations of unordered_map/set with std::* versions
TR1 implementation got replaced by the std::* equivalents with C++11.
Start to use the standard versions instead of the old ones.
-rw-r--r--include/klee/Expr/ArrayCache.h17
-rw-r--r--include/klee/Expr/ExprHashMap.h38
-rw-r--r--lib/Solver/CachingSolver.cpp15
3 files changed, 18 insertions, 52 deletions
diff --git a/include/klee/Expr/ArrayCache.h b/include/klee/Expr/ArrayCache.h
index 09eddf49..f482cba6 100644
--- a/include/klee/Expr/ArrayCache.h
+++ b/include/klee/Expr/ArrayCache.h
@@ -13,16 +13,8 @@
 #include "klee/Expr/Expr.h"
 #include "klee/Expr/ArrayExprHash.h" // For klee::ArrayHashFn
 
-// FIXME: Remove this hack when we switch to C++11
-#ifdef _LIBCPP_VERSION
-#include <unordered_set>
-#define unordered_set std::unordered_set
-#else
-#include <tr1/unordered_set>
-#define unordered_set std::tr1::unordered_set
-#endif
-
 #include <string>
+#include <unordered_set>
 #include <vector>
 
 namespace klee {
@@ -68,14 +60,13 @@ public:
                            Expr::Width _range = Expr::Int8);
 
 private:
-  typedef unordered_set<const Array *, klee::ArrayHashFn,
-                        klee::EquivArrayCmpFn> ArrayHashMap;
+  typedef std::unordered_set<const Array *, klee::ArrayHashFn,
+                             klee::EquivArrayCmpFn>
+      ArrayHashMap;
   ArrayHashMap cachedSymbolicArrays;
   typedef std::vector<const Array *> ArrayPtrVec;
   ArrayPtrVec concreteArrays;
 };
 }
 
-#undef unordered_set
-
 #endif /* KLEE_ARRAYCACHE_H */
diff --git a/include/klee/Expr/ExprHashMap.h b/include/klee/Expr/ExprHashMap.h
index 2b0b3bda..0143668d 100644
--- a/include/klee/Expr/ExprHashMap.h
+++ b/include/klee/Expr/ExprHashMap.h
@@ -12,18 +12,8 @@
 
 #include "klee/Expr/Expr.h"
 
-#include <ciso646>
-#ifdef _LIBCPP_VERSION
 #include <unordered_map>
 #include <unordered_set>
-#define unordered_map std::unordered_map
-#define unordered_set std::unordered_set
-#else
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
-#define unordered_map std::tr1::unordered_map
-#define unordered_set std::tr1::unordered_set
-#endif
 
 namespace klee {
 
@@ -40,23 +30,15 @@ namespace klee {
       }
     };
   }
-  
-  template<class T> 
-  class ExprHashMap : 
-
-    public unordered_map<ref<Expr>,
-                         T,
-                         klee::util::ExprHash,
-                         klee::util::ExprCmp> {
-  };
-  
-  typedef unordered_set<ref<Expr>,
-                        klee::util::ExprHash,
-                        klee::util::ExprCmp> ExprHashSet;
-
-}
-
-#undef unordered_map
-#undef unordered_set
+
+  template <class T>
+  class ExprHashMap
+      : public std::unordered_map<ref<Expr>, T, klee::util::ExprHash,
+                                  klee::util::ExprCmp> {};
+
+  typedef std::unordered_set<ref<Expr>, klee::util::ExprHash,
+                             klee::util::ExprCmp>
+      ExprHashSet;
+} // namespace klee
 
 #endif /* KLEE_EXPRHASHMAP_H */
diff --git a/lib/Solver/CachingSolver.cpp b/lib/Solver/CachingSolver.cpp
index 2c7371d0..5e2d45a2 100644
--- a/lib/Solver/CachingSolver.cpp
+++ b/lib/Solver/CachingSolver.cpp
@@ -16,14 +16,7 @@
 #include "klee/Solver/SolverImpl.h"
 #include "klee/Solver/SolverStats.h"
 
-#include <ciso646>
-#ifdef _LIBCPP_VERSION
 #include <unordered_map>
-#define unordered_map std::unordered_map
-#else
-#include <tr1/unordered_map>
-#define unordered_map std::tr1::unordered_map
-#endif
 
 using namespace klee;
 
@@ -65,10 +58,10 @@ private:
     }
   };
 
-  typedef unordered_map<CacheEntry, 
-                        IncompleteSolver::PartialValidity, 
-                        CacheEntryHash> cache_map;
-  
+  typedef std::unordered_map<CacheEntry, IncompleteSolver::PartialValidity,
+                             CacheEntryHash>
+      cache_map;
+
   Solver *solver;
   cache_map cache;