3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-08 08:51:55 +00:00

Use nullptr.

This commit is contained in:
Bruce Mitchener 2018-02-12 14:05:55 +07:00
parent f01328c65f
commit 76eb7b9ede
625 changed files with 4639 additions and 4639 deletions

View file

@ -105,7 +105,7 @@ namespace sat {
void tmp_clause::set(unsigned num_lits, literal const * lits, bool learned) {
if (m_clause && m_clause->m_capacity < num_lits) {
dealloc_svect(m_clause);
m_clause = 0;
m_clause = nullptr;
}
if (!m_clause) {
void * mem = alloc_svect(char, clause::get_obj_size(num_lits));

View file

@ -115,7 +115,7 @@ namespace sat {
class tmp_clause {
clause * m_clause;
public:
tmp_clause():m_clause(0) {}
tmp_clause():m_clause(nullptr) {}
~tmp_clause() { if (m_clause) dealloc_svect(m_clause); }
clause * get() const { return m_clause; }
void set(unsigned num_lits, literal const * lits, bool learned);

View file

@ -60,7 +60,7 @@ namespace sat {
bool probing::try_lit(literal l, bool updt_cache) {
SASSERT(s.m_qhead == s.m_trail.size());
SASSERT(s.value(l.var()) == l_undef);
literal_vector * implied_lits = updt_cache ? 0 : cached_implied_lits(l);
literal_vector * implied_lits = updt_cache ? nullptr : cached_implied_lits(l);
if (implied_lits) {
literal_vector::iterator it = implied_lits->begin();
literal_vector::iterator end = implied_lits->end();

View file

@ -77,10 +77,10 @@ namespace sat {
// return the literals implied by l.
// return 0, if the cache is not available
literal_vector * cached_implied_lits(literal l) {
if (!m_probing_cache) return 0;
if (l.index() >= m_cached_bins.size()) return 0;
if (!m_probing_cache) return nullptr;
if (l.index() >= m_cached_bins.size()) return nullptr;
cache_entry & e = m_cached_bins[l.index()];
if (!e.m_available) return 0;
if (!e.m_available) return nullptr;
return &(e.m_lits);
}

View file

@ -949,7 +949,7 @@ namespace sat {
void process(literal l) {
TRACE("blocked_clause", tout << "processing: " << l << "\n";);
model_converter::entry * new_entry = 0;
model_converter::entry * new_entry = nullptr;
if (!process_var(l.var())) {
return;
}
@ -965,7 +965,7 @@ namespace sat {
s.mark_all_but(c, l);
if (all_tautology(l)) {
TRACE("blocked_clause", tout << "new blocked clause: " << c << "\n";);
if (new_entry == 0)
if (new_entry == nullptr)
new_entry = &(mc.mk(model_converter::BLOCK_LIT, l.var()));
m_to_remove.push_back(&c);
s.m_num_blocked_clauses++;
@ -1003,7 +1003,7 @@ namespace sat {
literal l2 = it->get_literal();
s.mark_visited(l2);
if (all_tautology(l)) {
if (new_entry == 0)
if (new_entry == nullptr)
new_entry = &(mc.mk(model_converter::BLOCK_LIT, l.var()));
TRACE("blocked_clause", tout << "new blocked clause: " << l2 << " " << l << "\n";);
s.remove_bin_clause_half(l2, l, it->is_learned());

View file

@ -36,7 +36,7 @@ namespace sat {
m_checkpoint_enabled(true),
m_config(p),
m_ext(ext),
m_par(0),
m_par(nullptr),
m_cleaner(*this),
m_simplifier(*this, p),
m_scc(*this, p),
@ -198,7 +198,7 @@ namespace sat {
bool keep = simplify_clause(num_lits, lits);
TRACE("sat_mk_clause", tout << "mk_clause (after simp), keep: " << keep << "\n" << mk_lits_pp(num_lits, lits) << "\n";);
if (!keep) {
return 0; // clause is equivalent to true.
return nullptr; // clause is equivalent to true.
}
++m_stats.m_non_learned_generation;
}
@ -206,13 +206,13 @@ namespace sat {
switch (num_lits) {
case 0:
set_conflict(justification());
return 0;
return nullptr;
case 1:
assign(lits[0], justification());
return 0;
return nullptr;
case 2:
mk_bin_clause(lits[0], lits[1], learned);
return 0;
return nullptr;
case 3:
return mk_ter_clause(lits, learned);
default:
@ -815,7 +815,7 @@ namespace sat {
if (i == 1 + num_threads/2) {
m_params.set_sym("phase", symbol("random"));
}
solvers[i] = alloc(sat::solver, m_params, rlims[i], 0);
solvers[i] = alloc(sat::solver, m_params, rlims[i], nullptr);
solvers[i]->copy(*this);
solvers[i]->set_par(&par);
scoped_rlimit.push_child(&solvers[i]->rlimit());
@ -874,7 +874,7 @@ namespace sat {
}
}
}
set_par(0);
set_par(nullptr);
if (finished_id != -1 && finished_id < num_extra_solvers) {
m_stats = solvers[finished_id]->m_stats;
}

View file

@ -315,7 +315,7 @@ namespace sat {
//
// -----------------------
public:
lbool check(unsigned num_lits = 0, literal const* lits = 0);
lbool check(unsigned num_lits = 0, literal const* lits = nullptr);
model const & get_model() const { return m_model; }
bool model_is_current() const { return m_model_is_current; }

View file

@ -68,7 +68,7 @@ class inc_sat_solver : public solver {
typedef obj_map<expr, sat::literal> dep2asm_t;
public:
inc_sat_solver(ast_manager& m, params_ref const& p):
m(m), m_solver(p, m.limit(), 0),
m(m), m_solver(p, m.limit(), nullptr),
m_optimize_model(false),
m_fmls(m),
m_asmsf(m),
@ -106,7 +106,7 @@ public:
void set_progress_callback(progress_callback * callback) override {}
void display_weighted(std::ostream& out, unsigned sz, expr * const * assumptions, unsigned const* weights) {
if (weights != 0) {
if (weights != nullptr) {
for (unsigned i = 0; i < sz; ++i) m_weights.push_back(weights[i]);
}
init_preprocess();
@ -155,7 +155,7 @@ public:
TRACE("sat", tout << _assumptions << "\n";);
dep2asm_t dep2asm;
m_model = 0;
m_model = nullptr;
lbool r = internalize_formulas();
if (r != l_true) return r;
r = internalize_assumptions(sz, _assumptions.c_ptr(), dep2asm);
@ -258,7 +258,7 @@ public:
}
proof * get_proof() override {
UNREACHABLE();
return 0;
return nullptr;
}
lbool get_consequences_core(expr_ref_vector const& assumptions, expr_ref_vector const& vars, expr_ref_vector& conseq) override {
@ -403,8 +403,8 @@ private:
catch (tactic_exception & ex) {
IF_VERBOSE(0, verbose_stream() << "exception in tactic " << ex.msg() << "\n";);
TRACE("sat", tout << "exception: " << ex.msg() << "\n";);
m_preprocess = 0;
m_bb_rewriter = 0;
m_preprocess = nullptr;
m_bb_rewriter = nullptr;
return l_undef;
}
if (m_subgoals.size() != 1) {
@ -515,7 +515,7 @@ private:
expr_ref_vector conj(m);
internalize_value(value, v, val);
while (!premises.empty()) {
expr* e = 0;
expr* e = nullptr;
VERIFY(asm2dep.find(premises.pop().index(), e));
conj.push_back(e);
}
@ -616,7 +616,7 @@ private:
m_core.reset();
for (unsigned i = 0; i < core.size(); ++i) {
expr* e = 0;
expr* e = nullptr;
VERIFY(asm2dep.find(core[i].index(), e));
if (asm2fml.contains(e)) {
e = asm2fml.find(e);
@ -643,7 +643,7 @@ private:
void extract_model() {
TRACE("sat", tout << "retrieve model " << (m_solver.model_is_current()?"present":"absent") << "\n";);
if (!m_solver.model_is_current()) {
m_model = 0;
m_model = nullptr;
return;
}
sat::model const & ll_m = m_solver.get_model();

View file

@ -525,7 +525,7 @@ bool goal2sat::has_unsupported_bool(goal const & g) {
return test<unsupported_bool_proc>(g);
}
goal2sat::goal2sat():m_imp(0), m_interpreted_atoms(0) {
goal2sat::goal2sat():m_imp(nullptr), m_interpreted_atoms(nullptr) {
}
void goal2sat::collect_param_descrs(param_descrs & r) {
@ -539,7 +539,7 @@ struct goal2sat::scoped_set_imp {
m_owner->m_imp = i;
}
~scoped_set_imp() {
m_owner->m_imp = 0;
m_owner->m_imp = nullptr;
}
};
@ -703,9 +703,9 @@ struct sat2goal::imp {
for (sat::bool_var v = 0; v < num_vars; v++) {
checkpoint();
sat::literal l(v, false);
if (m_lit2expr.get(l.index()) == 0) {
if (m_lit2expr.get(l.index()) == nullptr) {
SASSERT(m_lit2expr.get((~l).index()) == 0);
app * aux = m.mk_fresh_const(0, b);
app * aux = m.mk_fresh_const(nullptr, b);
if (_mc)
_mc->insert(aux, true);
m_lit2expr.set(l.index(), aux);
@ -776,7 +776,7 @@ struct sat2goal::imp {
};
sat2goal::sat2goal():m_imp(0) {
sat2goal::sat2goal():m_imp(nullptr) {
}
void sat2goal::collect_param_descrs(param_descrs & r) {
@ -790,7 +790,7 @@ struct sat2goal::scoped_set_imp {
m_owner->m_imp = i;
}
~scoped_set_imp() {
m_owner->m_imp = 0;
m_owner->m_imp = nullptr;
}
};

View file

@ -34,7 +34,7 @@ class sat_tactic : public tactic {
imp(ast_manager & _m, params_ref const & p):
m(_m),
m_solver(p, m.limit(), 0),
m_solver(p, m.limit(), nullptr),
m_params(p) {
SASSERT(!m.proofs_enabled());
}
@ -44,7 +44,7 @@ class sat_tactic : public tactic {
model_converter_ref & mc,
proof_converter_ref & pc,
expr_dependency_ref & core) {
mc = 0; pc = 0; core = 0;
mc = nullptr; pc = nullptr; core = nullptr;
fail_if_proof_generation("sat", g);
bool produce_models = g->models_enabled();
bool produce_core = g->unsat_core_enabled();
@ -74,7 +74,7 @@ class sat_tactic : public tactic {
}
}
if (r == l_false) {
expr_dependency * lcore = 0;
expr_dependency * lcore = nullptr;
if (produce_core) {
sat::literal_vector const& ucore = m_solver.get_core();
u_map<expr*> asm2dep;
@ -85,7 +85,7 @@ class sat_tactic : public tactic {
lcore = m.mk_join(lcore, m.mk_leaf(dep));
}
}
g->assert_expr(m.mk_false(), 0, lcore);
g->assert_expr(m.mk_false(), nullptr, lcore);
}
else if (r == l_true && !map.interpreted_atoms()) {
// register model
@ -148,7 +148,7 @@ class sat_tactic : public tactic {
}
~scoped_set_imp() {
m_owner->m_imp = 0;
m_owner->m_imp = nullptr;
}
};
@ -158,7 +158,7 @@ class sat_tactic : public tactic {
public:
sat_tactic(ast_manager & m, params_ref const & p):
m_imp(0),
m_imp(nullptr),
m_params(p) {
}