diff options
author | Tim King <taking@cs.nyu.edu> | 2017-07-20 17:04:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-20 17:04:30 -0700 |
commit | 8b0659e6cd342ae40b676781b5e819d5fd2b3af7 (patch) | |
tree | 5ac55f64d115b3e8865ce8f691f38da65fc82a94 /src/parser | |
parent | 6d82ee2d1f84065ff4a86f688a3b671b85728f80 (diff) |
Moving from the gnu extensions for hash maps to the c++11 hash maps
* Replacing __gnu_cxx::hash_map with std::unordered_map.
* Replacing __gnu_cxx::hash_set with std::unordered_set.
* Replacing __gnu_cxx::hash with std::hash.
* Adding missing includes.
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/smt1/smt1.cpp | 12 | ||||
-rw-r--r-- | src/parser/smt1/smt1.h | 7 | ||||
-rw-r--r-- | src/parser/smt2/Smt2.g | 7 | ||||
-rw-r--r-- | src/parser/smt2/smt2.h | 3 | ||||
-rw-r--r-- | src/parser/tptp/tptp.h | 7 |
5 files changed, 17 insertions, 19 deletions
diff --git a/src/parser/smt1/smt1.cpp b/src/parser/smt1/smt1.cpp index 02f0566a7..c4e670f6d 100644 --- a/src/parser/smt1/smt1.cpp +++ b/src/parser/smt1/smt1.cpp @@ -12,21 +12,17 @@ ** Definitions of SMT-LIB (v1) constants. **/ -#include <ext/hash_map> -namespace std { - using namespace __gnu_cxx; -} +#include "parser/smt1/smt1.h" #include "expr/type.h" #include "smt/command.h" #include "parser/parser.h" -#include "parser/smt1/smt1.h" namespace CVC4 { namespace parser { -std::hash_map<const std::string, Smt1::Logic, CVC4::StringHashFunction> Smt1::newLogicMap() { - std::hash_map<const std::string, Smt1::Logic, CVC4::StringHashFunction> logicMap; +std::unordered_map<std::string, Smt1::Logic> Smt1::newLogicMap() { + std::unordered_map<std::string, Smt1::Logic> logicMap; logicMap["AUFLIA"] = AUFLIA; logicMap["AUFLIRA"] = AUFLIRA; logicMap["AUFNIRA"] = AUFNIRA; @@ -68,7 +64,7 @@ std::hash_map<const std::string, Smt1::Logic, CVC4::StringHashFunction> Smt1::ne } Smt1::Logic Smt1::toLogic(const std::string& name) { - static std::hash_map<const std::string, Smt1::Logic, CVC4::StringHashFunction> logicMap = newLogicMap(); + static std::unordered_map<std::string, Smt1::Logic> logicMap = newLogicMap(); return logicMap[name]; } diff --git a/src/parser/smt1/smt1.h b/src/parser/smt1/smt1.h index 7036aad64..e9dbea1a9 100644 --- a/src/parser/smt1/smt1.h +++ b/src/parser/smt1/smt1.h @@ -17,10 +17,9 @@ #ifndef __CVC4__PARSER__SMT1_H #define __CVC4__PARSER__SMT1_H -#include <ext/hash_map> -namespace std { using namespace __gnu_cxx; } +#include <string> +#include <unordered_map> -#include "util/hash.h" #include "parser/parser.h" namespace CVC4 { @@ -117,7 +116,7 @@ public: private: void addArithmeticOperators(); - static std::hash_map<const std::string, Logic, CVC4::StringHashFunction> newLogicMap(); + static std::unordered_map<std::string, Logic> newLogicMap(); };/* class Smt1 */ }/* CVC4::parser namespace */ diff --git a/src/parser/smt2/Smt2.g b/src/parser/smt2/Smt2.g index a2c859055..c7156635d 100644 --- a/src/parser/smt2/Smt2.g +++ b/src/parser/smt2/Smt2.g @@ -117,6 +117,7 @@ namespace CVC4 { #include <set> #include <sstream> #include <string> +#include <unordered_set> #include <vector> #include "base/output.h" @@ -150,7 +151,7 @@ using namespace CVC4::parser; #define MK_CONST EXPR_MANAGER->mkConst #define UNSUPPORTED PARSER_STATE->unimplementedFeature -static bool isClosed(const Expr& e, std::set<Expr>& free, std::hash_set<Expr, ExprHashFunction>& closedCache) { +static bool isClosed(const Expr& e, std::set<Expr>& free, std::unordered_set<Expr, ExprHashFunction>& closedCache) { if(closedCache.find(e) != closedCache.end()) { return true; } @@ -181,7 +182,7 @@ static bool isClosed(const Expr& e, std::set<Expr>& free, std::hash_set<Expr, Ex } static inline bool isClosed(const Expr& e, std::set<Expr>& free) { - std::hash_set<Expr, ExprHashFunction> cache; + std::unordered_set<Expr, ExprHashFunction> cache; return isClosed(e, free, cache); } @@ -1798,7 +1799,7 @@ term[CVC4::Expr& expr, CVC4::Expr& expr2] Expr attexpr; std::vector<Expr> patexprs; std::vector<Expr> patconds; - std::hash_set<std::string, StringHashFunction> names; + std::unordered_set<std::string> names; std::vector< std::pair<std::string, Expr> > binders; Type type; std::string s; diff --git a/src/parser/smt2/smt2.h b/src/parser/smt2/smt2.h index 3eed0e871..e470c8111 100644 --- a/src/parser/smt2/smt2.h +++ b/src/parser/smt2/smt2.h @@ -22,6 +22,7 @@ #include <sstream> #include <stack> #include <string> +#include <unordered_map> #include <utility> #include "parser/parser.h" @@ -58,7 +59,7 @@ public: private: bool d_logicSet; LogicInfo d_logic; - std::hash_map<std::string, Kind, StringHashFunction> operatorKindMap; + std::unordered_map<std::string, Kind> operatorKindMap; std::pair<Expr, std::string> d_lastNamedTerm; // this is a user-context stack std::stack< std::map<Expr, std::string> > d_unsatCoreNames; diff --git a/src/parser/tptp/tptp.h b/src/parser/tptp/tptp.h index f137a9d92..3afd29415 100644 --- a/src/parser/tptp/tptp.h +++ b/src/parser/tptp/tptp.h @@ -22,7 +22,8 @@ #define __CVC4__PARSER__TPTP_H #include <cassert> -#include <ext/hash_set> +#include <unordered_map> +#include <unordered_set> #include "parser/parser.h" #include "smt/command.h" @@ -45,8 +46,8 @@ class Tptp : public Parser { Expr d_utr_op; Expr d_uts_op; // The set of expression that already have a bridge - std::hash_set<Expr, ExprHashFunction> d_r_converted; - std::hash_map<std::string, Expr, StringHashFunction> d_distinct_objects; + std::unordered_set<Expr, ExprHashFunction> d_r_converted; + std::unordered_map<std::string, Expr> d_distinct_objects; std::vector< pANTLR3_INPUT_STREAM > d_in_created; |