mirror of
https://github.com/Z3Prover/z3
synced 2025-09-29 12:49:02 +00:00
remove a few useless dynamic casts
This commit is contained in:
parent
f0c788581a
commit
c350ddf990
8 changed files with 18 additions and 28 deletions
|
@ -139,7 +139,7 @@ public:
|
|||
if (m_mcs.back()) result->m_mcs.push_back(m_mcs.back()->translate(tr));
|
||||
if (m_sat_mc) {
|
||||
m_sat_mc->flush_smc(m_solver, m_map);
|
||||
result->m_sat_mc = dynamic_cast<sat2goal::mc*>(m_sat_mc->translate(tr));
|
||||
result->m_sat_mc = static_cast<sat2goal::mc*>(m_sat_mc->translate(tr));
|
||||
}
|
||||
result->m_has_uninterpreted = m_has_uninterpreted;
|
||||
// copy m_bb_rewriter?
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace euf {
|
|||
model_ref mdl;
|
||||
auto s = get_solver(m.mk_family_id("sls"), nullptr);
|
||||
if (s)
|
||||
mdl = dynamic_cast<sls::solver*>(s)->get_model();
|
||||
mdl = static_cast<sls::solver*>(s)->get_model();
|
||||
return mdl;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ void sat2goal::mc::flush_gmc() {
|
|||
model_converter* sat2goal::mc::translate(ast_translation& translator) {
|
||||
mc* result = alloc(mc, translator.to());
|
||||
result->m_smc.copy(m_smc);
|
||||
result->m_gmc = m_gmc ? dynamic_cast<generic_model_converter*>(m_gmc->translate(translator)) : nullptr;
|
||||
result->m_gmc = m_gmc ? static_cast<generic_model_converter*>(m_gmc->translate(translator)) : nullptr;
|
||||
for (expr* e : m_var2expr) {
|
||||
result->m_var2expr.push_back(translator(e));
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ struct sat2goal::imp {
|
|||
ba->to_formulas(l2e, fmls);
|
||||
}
|
||||
else
|
||||
dynamic_cast<euf::solver*>(ext)->to_formulas(l2e, fmls);
|
||||
static_cast<euf::solver*>(ext)->to_formulas(l2e, fmls);
|
||||
for (expr* f : fmls)
|
||||
r.assert_expr(f);
|
||||
}
|
||||
|
|
|
@ -1568,7 +1568,7 @@ namespace smt {
|
|||
family_id fid = m.get_family_id("specrels");
|
||||
theory* th = get_theory(fid);
|
||||
if (th)
|
||||
dynamic_cast<theory_special_relations*>(th)->get_specrels(rels);
|
||||
static_cast<theory_special_relations*>(th)->get_specrels(rels);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3602,7 +3602,7 @@ namespace smt {
|
|||
auto p = m_theories.get_plugin(tid);
|
||||
if (!p)
|
||||
return false;
|
||||
m_model = dynamic_cast<theory_sls*>(p)->get_model();
|
||||
m_model = static_cast<theory_sls*>(p)->get_model();
|
||||
return m_model.get() != nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ public:
|
|||
for (dependent_expr const& f : m_fmls)
|
||||
result->m_fmls.push_back(dependent_expr(tr, f));
|
||||
if (m_mc)
|
||||
result->m_mc = dynamic_cast<generic_model_converter*>(m_mc->translate(tr));
|
||||
result->m_mc = m_mc->translate(tr);
|
||||
|
||||
// copy m_preprocess_state?
|
||||
return result;
|
||||
|
|
|
@ -399,7 +399,7 @@ solver* solver_pool::mk_solver() {
|
|||
}
|
||||
else {
|
||||
solver* s = m_solvers[(m_current_pool++) % m_num_pools];
|
||||
base_solver = dynamic_cast<pool_solver*>(s)->base_solver();
|
||||
base_solver = static_cast<pool_solver*>(s)->base_solver();
|
||||
}
|
||||
std::stringstream name;
|
||||
name << "vsolver#" << m_solvers.size();
|
||||
|
@ -412,7 +412,7 @@ solver* solver_pool::mk_solver() {
|
|||
void solver_pool::reset_solver(solver* s) {
|
||||
pool_solver* ps = dynamic_cast<pool_solver*>(s);
|
||||
SASSERT(ps);
|
||||
if (ps) ps->reset();
|
||||
ps->reset();
|
||||
}
|
||||
|
||||
void solver_pool::refresh(solver* base_solver) {
|
||||
|
|
|
@ -406,8 +406,7 @@ public:
|
|||
}
|
||||
|
||||
void insert(const data & e) {
|
||||
data tmp(e);
|
||||
insert(std::move(tmp));
|
||||
insert(data(e));
|
||||
}
|
||||
|
||||
#define INSERT_LOOP_CORE_BODY() { \
|
||||
|
@ -463,8 +462,7 @@ public:
|
|||
}
|
||||
|
||||
bool insert_if_not_there_core(const data & e, entry * & et) {
|
||||
data temp(e);
|
||||
return insert_if_not_there_core(std::move(temp), et);
|
||||
return insert_if_not_there_core(data(e), et);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,19 +57,7 @@ class obj_map {
|
|||
public:
|
||||
struct key_data {
|
||||
Key * m_key = nullptr;
|
||||
Value m_value{};
|
||||
key_data() = default;
|
||||
key_data(Key * k):
|
||||
m_key(k) {
|
||||
}
|
||||
key_data(Key * k, Value const & v):
|
||||
m_key(k),
|
||||
m_value(v) {
|
||||
}
|
||||
key_data(Key * k, Value && v) :
|
||||
m_key(k),
|
||||
m_value(std::move(v)) {
|
||||
}
|
||||
Value m_value;
|
||||
Value const & get_value() const { return m_value; }
|
||||
Key & get_key () const { return *m_key; }
|
||||
unsigned hash() const { return m_key->hash(); }
|
||||
|
@ -97,8 +85,8 @@ public:
|
|||
table m_table;
|
||||
|
||||
public:
|
||||
obj_map():
|
||||
m_table(DEFAULT_HASHTABLE_INITIAL_CAPACITY) {}
|
||||
obj_map(unsigned initial_capacity = DEFAULT_HASHTABLE_INITIAL_CAPACITY):
|
||||
m_table(initial_capacity) {}
|
||||
|
||||
typedef typename table::iterator iterator;
|
||||
typedef typename table::data data;
|
||||
|
@ -146,6 +134,10 @@ public:
|
|||
return m_table.insert_if_not_there2(key_data(k, v))->get_data().m_value;
|
||||
}
|
||||
|
||||
bool insert_if_not_there_core(Key * k, Value const & v, obj_map_entry * & et) {
|
||||
return m_table.insert_if_not_there_core({k, v}, et);
|
||||
}
|
||||
|
||||
obj_map_entry * insert_if_not_there3(Key * k, Value const & v) {
|
||||
return m_table.insert_if_not_there2(key_data(k, v));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue