arrowdodger avatar arrowdodger committed 27c9018

Some C++11 support.

Comments (0)

Files changed (6)

cmake/config.cmake

 endif()
 
 include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
 include(CheckLibraryExists)
 include(CheckSymbolExists)
 include(CheckFunctionExists)
 check_include_file(sys/acl.h HAVE_SYS_ACL_H)
 check_include_file(selinux/selinux.h HAVE_SELINUX_SELINUX_H)
 check_include_file(unistd.h HAVE_UNISTD_H)
+check_include_file_cxx(unordered_map HAVE_UNORDERED_MAP)
+check_include_file_cxx(unordered_set HAVE_UNORDERED_SET)
 
 # library checks
 if( NOT PURE_WINDOWS )

include/klee/Config/config.h.cmake

 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H 1
 
+#cmakedefine HAVE_UNORDERED_MAP 1
+#cmakedefine HAVE_UNORDERED_SET 1
+
 /* Path to KLEE's uClibc */
 #undef KLEE_UCLIBC
 

include/klee/Config/config.h.in

 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+#undef HAVE_UNORDERED_MAP
+#undef HAVE_UNORDERED_SET
+
 /* Path to KLEE's uClibc */
 #undef KLEE_UCLIBC
 

include/klee/util/ArrayExprHash.h

 #include "SolverStats.h"
 
 #include <map>
+#if HAVE_UNORDERED_MAP
+#include <unordered_map>
+#define STD_TR1_NAMESPACE std
+#else
 #include <tr1/unordered_map>
+#define STD_TR1_NAMESPACE std::tr1
+#endif
 
 namespace klee {
   
   void hashUpdateNodeExpr(const UpdateNode* un, T& exp);  
   
 protected:
-  typedef std::tr1::unordered_map<const Array*, T, ArrayHashFn, ArrayCmpFn> ArrayHash;
+  typedef STD_TR1_NAMESPACE::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 STD_TR1_NAMESPACE::unordered_map<const UpdateNode*, T, UpdateNodeHashFn, UpdateNodeCmpFn> UpdateNodeHash;
   typedef typename UpdateNodeHash::iterator UpdateNodeHashIter;
   typedef typename UpdateNodeHash::const_iterator UpdateNodeHashConstIter;
   

include/klee/util/ExprHashMap.h

 #define KLEE_EXPRHASHMAP_H
 
 #include "klee/Expr.h"
+#if HAVE_UNORDERED_MAP && HAVE_UNORDERED_SET
+#include <unordered_map>
+#include <unordered_set>
+#define STD_TR1_NAMESPACE std
+#else
 #include <tr1/unordered_map>
 #include <tr1/unordered_set>
+#define STD_TR1_NAMESPACE std::tr1
+#endif
 
 namespace klee {
 
   template<class T> 
   class ExprHashMap : 
 
-    public std::tr1::unordered_map<ref<Expr>,
+    public STD_TR1_NAMESPACE::unordered_map<ref<Expr>,
 				   T,
 				   klee::util::ExprHash,
 				   klee::util::ExprCmp> {
   };
   
-  typedef std::tr1::unordered_set<ref<Expr>,
+  typedef STD_TR1_NAMESPACE::unordered_set<ref<Expr>,
 				  klee::util::ExprHash,
 				  klee::util::ExprCmp> ExprHashSet;
 

lib/Solver/CachingSolver.cpp

 
 #include "SolverStats.h"
 
+#if HAVE_UNORDERED_MAP
+#include <unordered_map>
+#define STD_TR1_NAMESPACE std
+#else
 #include <tr1/unordered_map>
+#define STD_TR1_NAMESPACE std::tr1
+#endif
 
 using namespace klee;
 
     }
   };
 
-  typedef std::tr1::unordered_map<CacheEntry, 
+  typedef STD_TR1_NAMESPACE::unordered_map<CacheEntry, 
                                   IncompleteSolver::PartialValidity, 
                                   CacheEntryHash> cache_map;
   
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.