mirror of
https://github.com/Z3Prover/z3
synced 2025-06-23 22:33:40 +00:00
spread a few anonymous namespaces and remove some m_imp idioms
This commit is contained in:
parent
178e5b31e8
commit
3104291b80
2 changed files with 179 additions and 201 deletions
|
@ -25,8 +25,8 @@ Revision History:
|
||||||
#include "tactic/goal_shared_occs.h"
|
#include "tactic/goal_shared_occs.h"
|
||||||
#include "ast/pb_decl_plugin.h"
|
#include "ast/pb_decl_plugin.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
class propagate_values_tactic : public tactic {
|
class propagate_values_tactic : public tactic {
|
||||||
struct imp {
|
|
||||||
ast_manager & m;
|
ast_manager & m;
|
||||||
th_rewriter m_r;
|
th_rewriter m_r;
|
||||||
scoped_ptr<expr_substitution> m_subst;
|
scoped_ptr<expr_substitution> m_subst;
|
||||||
|
@ -35,27 +35,12 @@ class propagate_values_tactic : public tactic {
|
||||||
unsigned m_idx;
|
unsigned m_idx;
|
||||||
unsigned m_max_rounds;
|
unsigned m_max_rounds;
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
|
params_ref m_params;
|
||||||
imp(ast_manager & m, params_ref const & p):
|
|
||||||
m(m),
|
|
||||||
m_r(m, p),
|
|
||||||
m_goal(nullptr),
|
|
||||||
m_occs(m, true /* track atoms */) {
|
|
||||||
updt_params_core(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
~imp() { }
|
|
||||||
|
|
||||||
void updt_params_core(params_ref const & p) {
|
void updt_params_core(params_ref const & p) {
|
||||||
m_max_rounds = p.get_uint("max_rounds", 4);
|
m_max_rounds = p.get_uint("max_rounds", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updt_params(params_ref const & p) {
|
|
||||||
m_r.updt_params(p);
|
|
||||||
updt_params_core(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool is_shared(expr * t) {
|
bool is_shared(expr * t) {
|
||||||
return m_occs.is_shared(t);
|
return m_occs.is_shared(t);
|
||||||
}
|
}
|
||||||
|
@ -149,8 +134,7 @@ class propagate_values_tactic : public tactic {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(goal_ref const & g,
|
void run(goal_ref const & g, goal_ref_buffer & result) {
|
||||||
goal_ref_buffer & result) {
|
|
||||||
SASSERT(g->is_well_sorted());
|
SASSERT(g->is_well_sorted());
|
||||||
tactic_report report("propagate-values", *g);
|
tactic_report report("propagate-values", *g);
|
||||||
m_goal = g.get();
|
m_goal = g.get();
|
||||||
|
@ -222,27 +206,25 @@ class propagate_values_tactic : public tactic {
|
||||||
TRACE("propagate_values_core", m_goal->display_with_dependencies(tout););
|
TRACE("propagate_values_core", m_goal->display_with_dependencies(tout););
|
||||||
m_goal = nullptr;
|
m_goal = nullptr;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
imp * m_imp;
|
|
||||||
params_ref m_params;
|
|
||||||
public:
|
public:
|
||||||
propagate_values_tactic(ast_manager & m, params_ref const & p):
|
propagate_values_tactic(ast_manager & m, params_ref const & p):
|
||||||
|
m(m),
|
||||||
|
m_r(m, p),
|
||||||
|
m_goal(nullptr),
|
||||||
|
m_occs(m, true /* track atoms */),
|
||||||
m_params(p) {
|
m_params(p) {
|
||||||
m_imp = alloc(imp, m, p);
|
updt_params_core(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
tactic * translate(ast_manager & m) override {
|
tactic * translate(ast_manager & m) override {
|
||||||
return alloc(propagate_values_tactic, m, m_params);
|
return alloc(propagate_values_tactic, m, m_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
~propagate_values_tactic() override {
|
|
||||||
dealloc(m_imp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void updt_params(params_ref const & p) override {
|
void updt_params(params_ref const & p) override {
|
||||||
m_params = p;
|
m_params = p;
|
||||||
m_imp->updt_params(p);
|
m_r.updt_params(p);
|
||||||
|
updt_params_core(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void collect_param_descrs(param_descrs & r) override {
|
void collect_param_descrs(param_descrs & r) override {
|
||||||
|
@ -252,7 +234,7 @@ public:
|
||||||
|
|
||||||
void operator()(goal_ref const & in, goal_ref_buffer & result) override {
|
void operator()(goal_ref const & in, goal_ref_buffer & result) override {
|
||||||
try {
|
try {
|
||||||
(*m_imp)(in, result);
|
run(in, result);
|
||||||
}
|
}
|
||||||
catch (rewriter_exception & ex) {
|
catch (rewriter_exception & ex) {
|
||||||
throw tactic_exception(ex.msg());
|
throw tactic_exception(ex.msg());
|
||||||
|
@ -260,15 +242,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup() override {
|
void cleanup() override {
|
||||||
ast_manager & m = m_imp->m;
|
m_r.cleanup();
|
||||||
params_ref p = std::move(m_params);
|
m_subst = nullptr;
|
||||||
m_imp->~imp();
|
m_occs.cleanup();
|
||||||
new (m_imp) imp(m, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
tactic * mk_propagate_values_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_propagate_values_tactic(ast_manager & m, params_ref const & p) {
|
||||||
return alloc(propagate_values_tactic, m, p);
|
return alloc(propagate_values_tactic, m, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,7 @@ Author:
|
||||||
Revision History:
|
Revision History:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
#ifndef PROPAGATE_VALUES_TACTIC_H_
|
#pragma once
|
||||||
#define PROPAGATE_VALUES_TACTIC_H_
|
|
||||||
|
|
||||||
#include "util/params.h"
|
#include "util/params.h"
|
||||||
class ast_manager;
|
class ast_manager;
|
||||||
|
@ -29,5 +28,3 @@ tactic * mk_propagate_values_tactic(ast_manager & m, params_ref const & p = para
|
||||||
/*
|
/*
|
||||||
ADD_TACTIC("propagate-values", "propagate constants.", "mk_propagate_values_tactic(m, p)")
|
ADD_TACTIC("propagate-values", "propagate constants.", "mk_propagate_values_tactic(m, p)")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue