about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2014-09-12 14:08:26 -0700
committerDaniel Dunbar <daniel@zuster.org>2014-09-12 17:39:17 -0700
commitcc364493808ba1453d6ea84124f16ace0e975194 (patch)
tree084288b99a1b10295a457ba255709cf6de717e3a
parentd6f8d78a31becd3c2c397bb1be8c9ad707d33371 (diff)
downloadklee-cc364493808ba1453d6ea84124f16ace0e975194.tar.gz
When building against libc++ (vs libstdcxx), use standard unordered_{map,set} includes.
 - I'm not sure what the status of libstdcxx's c++11 support is. It may be we
   can just move over to <unordered_map> everywhere, but I don't have a Linux
   test machine handy at the moment.
-rw-r--r--include/klee/util/ArrayExprHash.h12
-rw-r--r--include/klee/util/ExprHashMap.h25
-rw-r--r--lib/Solver/CachingSolver.cpp13
3 files changed, 38 insertions, 12 deletions
diff --git a/include/klee/util/ArrayExprHash.h b/include/klee/util/ArrayExprHash.h
index 1e5ffc2e..646ffd0c 100644
--- a/include/klee/util/ArrayExprHash.h
+++ b/include/klee/util/ArrayExprHash.h
@@ -15,7 +15,15 @@
 #include "SolverStats.h"
 
 #include <map>
+
+#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
 
 namespace klee {
   
@@ -60,11 +68,11 @@ public:
   void hashUpdateNodeExpr(const UpdateNode* un, T& exp);  
   
 protected:
-  typedef std::tr1::unordered_map<const Array*, T, ArrayHashFn, ArrayCmpFn> ArrayHash;
+  typedef unordered_map<const Array*, T, ArrayHashFn, ArrayCmpFn> ArrayHash;
   typedef typename ArrayHash::iterator ArrayHashIter;
   typedef typename ArrayHash::const_iterator ArrayHashConstIter;
   
-  typedef std::tr1::unordered_map<const UpdateNode*, T, UpdateNodeHashFn, UpdateNodeCmpFn> UpdateNodeHash;
+  typedef unordered_map<const UpdateNode*, T, UpdateNodeHashFn, UpdateNodeCmpFn> UpdateNodeHash;
   typedef typename UpdateNodeHash::iterator UpdateNodeHashIter;
   typedef typename UpdateNodeHash::const_iterator UpdateNodeHashConstIter;
   
diff --git a/include/klee/util/ExprHashMap.h b/include/klee/util/ExprHashMap.h
index d2e6cb1a..867ad001 100644
--- a/include/klee/util/ExprHashMap.h
+++ b/include/klee/util/ExprHashMap.h
@@ -11,8 +11,19 @@
 #define KLEE_EXPRHASHMAP_H
 
 #include "klee/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 {
 
@@ -33,15 +44,15 @@ namespace klee {
   template<class T> 
   class ExprHashMap : 
 
-    public std::tr1::unordered_map<ref<Expr>,
-				   T,
-				   klee::util::ExprHash,
-				   klee::util::ExprCmp> {
+    public unordered_map<ref<Expr>,
+                         T,
+                         klee::util::ExprHash,
+                         klee::util::ExprCmp> {
   };
   
-  typedef std::tr1::unordered_set<ref<Expr>,
-				  klee::util::ExprHash,
-				  klee::util::ExprCmp> ExprHashSet;
+  typedef unordered_set<ref<Expr>,
+                        klee::util::ExprHash,
+                        klee::util::ExprCmp> ExprHashSet;
 
 }
 
diff --git a/lib/Solver/CachingSolver.cpp b/lib/Solver/CachingSolver.cpp
index 674d4627..cfe08a96 100644
--- a/lib/Solver/CachingSolver.cpp
+++ b/lib/Solver/CachingSolver.cpp
@@ -17,7 +17,14 @@
 
 #include "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;
 
@@ -59,9 +66,9 @@ private:
     }
   };
 
-  typedef std::tr1::unordered_map<CacheEntry, 
-                                  IncompleteSolver::PartialValidity, 
-                                  CacheEntryHash> cache_map;
+  typedef unordered_map<CacheEntry, 
+                        IncompleteSolver::PartialValidity, 
+                        CacheEntryHash> cache_map;
   
   Solver *solver;
   cache_map cache;