mirror of
https://github.com/Z3Prover/z3
synced 2026-02-10 02:50:55 +00:00
Refactor find_tactic_cmd to use std::optional<tactic_cmd*> (#8331)
* Initial plan * Refactor find_tactic_cmd to use std::optional<tactic_cmd*> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
944777afc0
commit
7b182c9440
4 changed files with 15 additions and 13 deletions
|
|
@ -59,14 +59,14 @@ extern "C" {
|
|||
Z3_TRY;
|
||||
LOG_Z3_mk_tactic(c, name);
|
||||
RESET_ERROR_CODE();
|
||||
tactic_cmd * t = mk_c(c)->find_tactic_cmd(symbol(name));
|
||||
if (t == nullptr) {
|
||||
auto t = mk_c(c)->find_tactic_cmd(symbol(name));
|
||||
if (!t) {
|
||||
std::stringstream err;
|
||||
err << "unknown tactic " << name;
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, err.str());
|
||||
RETURN_Z3(nullptr);
|
||||
}
|
||||
tactic * new_t = t->mk(mk_c(c)->m());
|
||||
tactic * new_t = (*t)->mk(mk_c(c)->m());
|
||||
RETURN_TACTIC(new_t);
|
||||
Z3_CATCH_RETURN(nullptr);
|
||||
}
|
||||
|
|
@ -391,12 +391,12 @@ extern "C" {
|
|||
Z3_TRY;
|
||||
LOG_Z3_tactic_get_descr(c, name);
|
||||
RESET_ERROR_CODE();
|
||||
tactic_cmd * t = mk_c(c)->find_tactic_cmd(symbol(name));
|
||||
if (t == nullptr) {
|
||||
auto t = mk_c(c)->find_tactic_cmd(symbol(name));
|
||||
if (!t) {
|
||||
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
|
||||
return "";
|
||||
}
|
||||
return t->get_descr();
|
||||
return (*t)->get_descr();
|
||||
Z3_CATCH_RETURN("");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue