mirror of
https://github.com/Z3Prover/z3
synced 2025-08-14 14:55:25 +00:00
remove a bunch of string copies
This commit is contained in:
parent
97aa46add3
commit
f23b053fb9
2 changed files with 53 additions and 37 deletions
|
@ -29,52 +29,56 @@ bool smt_logics::supported_logic(symbol const & s) {
|
|||
}
|
||||
|
||||
bool smt_logics::logic_has_reals_only(symbol const& s) {
|
||||
auto str = s.str();
|
||||
return
|
||||
s.str().find("LRA") != std::string::npos ||
|
||||
s.str().find("LRA") != std::string::npos ||
|
||||
s.str().find("NRA") != std::string::npos ||
|
||||
s.str().find("RDL") != std::string::npos;
|
||||
str.find("LRA") != std::string::npos ||
|
||||
str.find("LRA") != std::string::npos ||
|
||||
str.find("NRA") != std::string::npos ||
|
||||
str.find("RDL") != std::string::npos;
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_arith(symbol const & s) {
|
||||
auto str = s.str();
|
||||
return
|
||||
s.str().find("LRA") != std::string::npos ||
|
||||
s.str().find("LIRA") != std::string::npos ||
|
||||
s.str().find("LIA") != std::string::npos ||
|
||||
s.str().find("LRA") != std::string::npos ||
|
||||
s.str().find("NRA") != std::string::npos ||
|
||||
s.str().find("NIRA") != std::string::npos ||
|
||||
s.str().find("NIA") != std::string::npos ||
|
||||
s.str().find("IDL") != std::string::npos ||
|
||||
s.str().find("RDL") != std::string::npos ||
|
||||
s == "QF_BVRE" ||
|
||||
s == "QF_FP" ||
|
||||
s == "FP" ||
|
||||
s == "QF_FPBV" ||
|
||||
s == "QF_BVFP" ||
|
||||
s == "QF_S" ||
|
||||
str.find("LRA") != std::string::npos ||
|
||||
str.find("LIRA") != std::string::npos ||
|
||||
str.find("LIA") != std::string::npos ||
|
||||
str.find("LRA") != std::string::npos ||
|
||||
str.find("NRA") != std::string::npos ||
|
||||
str.find("NIRA") != std::string::npos ||
|
||||
str.find("NIA") != std::string::npos ||
|
||||
str.find("IDL") != std::string::npos ||
|
||||
str.find("RDL") != std::string::npos ||
|
||||
str == "QF_BVRE" ||
|
||||
str == "QF_FP" ||
|
||||
str == "FP" ||
|
||||
str == "QF_FPBV" ||
|
||||
str == "QF_BVFP" ||
|
||||
str == "QF_S" ||
|
||||
logic_is_all(s) ||
|
||||
s == "QF_FD" ||
|
||||
s == "HORN";
|
||||
str == "QF_FD" ||
|
||||
str == "HORN";
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_bv(symbol const & s) {
|
||||
auto str = s.str();
|
||||
return
|
||||
s.str().find("BV") != std::string::npos ||
|
||||
s == "FP" ||
|
||||
str.find("BV") != std::string::npos ||
|
||||
str == "FP" ||
|
||||
logic_is_all(s) ||
|
||||
s == "QF_FD" ||
|
||||
s == "SMTFD" ||
|
||||
s == "HORN";
|
||||
str == "QF_FD" ||
|
||||
str == "SMTFD" ||
|
||||
str == "HORN";
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_array(symbol const & s) {
|
||||
auto str = s.str();
|
||||
return
|
||||
s.str().starts_with("QF_A") ||
|
||||
s.str().starts_with("A") ||
|
||||
str.starts_with("QF_A") ||
|
||||
str.starts_with("A") ||
|
||||
logic_is_all(s) ||
|
||||
s == "SMTFD" ||
|
||||
s == "HORN";
|
||||
str == "SMTFD" ||
|
||||
str == "HORN";
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_seq(symbol const & s) {
|
||||
|
@ -82,17 +86,28 @@ bool smt_logics::logic_has_seq(symbol const & s) {
|
|||
}
|
||||
|
||||
bool smt_logics::logic_has_str(symbol const & s) {
|
||||
return s == "QF_S" || s == "QF_SLIA" || s == "QF_SNIA" || logic_is_all(s);
|
||||
auto str = s.str();
|
||||
return str == "QF_S" ||
|
||||
str == "QF_SLIA" ||
|
||||
str == "QF_SNIA" ||
|
||||
logic_is_all(s);
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_fpa(symbol const & s) {
|
||||
return s == "FP" || s == "QF_FP" || s == "QF_FPBV" || s == "QF_BVFP" || s == "QF_FPLRA" || logic_is_all(s);
|
||||
auto str = s.str();
|
||||
return str == "FP" ||
|
||||
str == "QF_FP" ||
|
||||
str == "QF_FPBV" ||
|
||||
str == "QF_BVFP" ||
|
||||
str == "QF_FPLRA" ||
|
||||
logic_is_all(s);
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_uf(symbol const & s) {
|
||||
auto str = s.str();
|
||||
return
|
||||
s.str().find("UF") != std::string::npos ||
|
||||
s == "SMTFD";
|
||||
str.find("UF") != std::string::npos ||
|
||||
str == "SMTFD";
|
||||
}
|
||||
|
||||
bool smt_logics::logic_has_horn(symbol const& s) {
|
||||
|
@ -104,9 +119,10 @@ bool smt_logics::logic_has_pb(symbol const& s) {
|
|||
}
|
||||
|
||||
bool smt_logics::logic_has_datatype(symbol const& s) {
|
||||
auto str = s.str();
|
||||
return
|
||||
s.str().find("DT") != std::string::npos ||
|
||||
s == "QF_FD" ||
|
||||
str.find("DT") != std::string::npos ||
|
||||
str == "QF_FD" ||
|
||||
logic_is_all(s) ||
|
||||
logic_has_horn(s);
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ public:
|
|||
symbol sp(p.c_str());
|
||||
std::ostringstream buffer;
|
||||
ps.display(buffer, sp);
|
||||
return buffer.str();
|
||||
return std::move(buffer).str();
|
||||
}
|
||||
|
||||
std::string get_default(param_descrs const & d, std::string const & p, std::string const & m) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue