3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-28 12:58:43 +00:00

Revert "Refactor find_probe() to use std::optional (#8334)"

This reverts commit 49817bc259.
This commit is contained in:
Nikolaj Bjorner 2026-01-26 13:19:56 -08:00
parent 7a2eea6f40
commit 3f26d42215
4 changed files with 13 additions and 14 deletions

View file

@ -91,12 +91,12 @@ extern "C" {
Z3_TRY;
LOG_Z3_mk_probe(c, name);
RESET_ERROR_CODE();
auto p = mk_c(c)->find_probe(symbol(name));
if (!p) {
probe_info * p = mk_c(c)->find_probe(symbol(name));
if (p == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
RETURN_Z3(nullptr);
}
probe * new_p = (*p)->get();
probe * new_p = p->get();
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(nullptr);
}
@ -404,12 +404,12 @@ extern "C" {
Z3_TRY;
LOG_Z3_probe_get_descr(c, name);
RESET_ERROR_CODE();
auto p = mk_c(c)->find_probe(symbol(name));
if (!p) {
probe_info * p = mk_c(c)->find_probe(symbol(name));
if (p == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
return "";
}
return (*p)->get_descr();
return p->get_descr();
Z3_CATCH_RETURN("");
}

View file

@ -767,9 +767,9 @@ MK_NARY_PROBE(mk_mul);
probe * sexpr2probe(cmd_context & ctx, sexpr * n) {
if (n->is_symbol()) {
auto pinfo = ctx.find_probe(n->get_symbol());
if (pinfo)
return (*pinfo)->get();
probe_info * pinfo = ctx.find_probe(n->get_symbol());
if (pinfo != nullptr)
return pinfo->get();
throw cmd_exception("invalid probe, unknown builtin probe ", n->get_symbol(), n->get_line(), n->get_pos());
}
else if (n->is_numeral()) {

View file

@ -70,10 +70,9 @@ simplifier_cmd * tactic_manager::find_simplifier_cmd(symbol const & s) const {
return c;
}
std::optional<probe_info*> tactic_manager::find_probe(symbol const & s) const {
probe_info * tactic_manager::find_probe(symbol const & s) const {
probe_info * p = nullptr;
if (m_name2probe.find(s, p))
return p;
return std::nullopt;
m_name2probe.find(s, p);
return p;
}

View file

@ -38,7 +38,7 @@ public:
void insert(simplifier_cmd* c);
void insert(probe_info * p);
std::optional<tactic_cmd*> find_tactic_cmd(symbol const & s) const;
std::optional<probe_info*> find_probe(symbol const & s) const;
probe_info * find_probe(symbol const & s) const;
simplifier_cmd* find_simplifier_cmd(symbol const& s) const;
unsigned num_tactics() const { return m_tactics.size(); }