3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +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

@ -71,9 +71,9 @@ void func_entry::deallocate(ast_manager & m, unsigned arity) {
func_interp::func_interp(ast_manager & m, unsigned arity):
m_manager(m),
m_arity(arity),
m_else(0),
m_else(nullptr),
m_args_are_values(true),
m_interp(0) {
m_interp(nullptr) {
}
func_interp::~func_interp() {
@ -102,7 +102,7 @@ func_interp * func_interp::copy() const {
void func_interp::reset_interp_cache() {
m_manager.dec_ref(m_interp);
m_interp = 0;
m_interp = nullptr;
}
bool func_interp::is_fi_entry_expr(expr * e, ptr_vector<expr> & args) {
@ -183,13 +183,13 @@ func_entry * func_interp::get_entry(expr * const * args) const {
if (curr->eq_args(m(), m_arity, args))
return curr;
}
return 0;
return nullptr;
}
void func_interp::insert_entry(expr * const * args, expr * r) {
reset_interp_cache();
func_entry * entry = get_entry(args);
if (entry != 0) {
if (entry != nullptr) {
entry->set_result(m_manager, r);
return;
}
@ -219,7 +219,7 @@ void func_interp::insert_new_entry(expr * const * args, expr * r) {
}
bool func_interp::eval_else(expr * const * args, expr_ref & result) const {
if (m_else == 0)
if (m_else == nullptr)
return false;
var_subst s(m_manager, false);
SASSERT(!s.std_order()); // (VAR 0) <- args[0], (VAR 1) <- args[1], ...
@ -232,9 +232,9 @@ bool func_interp::eval_else(expr * const * args, expr_ref & result) const {
*/
expr * func_interp::get_max_occ_result() const {
if (m_entries.empty())
return 0;
return nullptr;
obj_map<expr, unsigned> num_occs;
expr * r_max = 0;
expr * r_max = nullptr;
unsigned max = 0;
ptr_vector<func_entry>::const_iterator it = m_entries.begin();
ptr_vector<func_entry>::const_iterator end = m_entries.end();
@ -257,7 +257,7 @@ expr * func_interp::get_max_occ_result() const {
\brief Remove entries e such that e.get_result() == m_else.
*/
void func_interp::compress() {
if (m_else == 0 || m_entries.empty())
if (m_else == nullptr || m_entries.empty())
return; // nothing to be done
if (!is_ground(m_else))
return; // forall entries e in m_entries e.get_result() is ground
@ -284,8 +284,8 @@ void func_interp::compress() {
}
expr * func_interp::get_interp_core() const {
if (m_else == 0)
return 0;
if (m_else == nullptr)
return nullptr;
expr * r = m_else;
ptr_buffer<expr> vars;
ptr_vector<func_entry>::const_iterator it = m_entries.begin();
@ -313,10 +313,10 @@ expr * func_interp::get_interp_core() const {
}
expr * func_interp::get_interp() const {
if (m_interp != 0)
if (m_interp != nullptr)
return m_interp;
expr * r = get_interp_core();
if (r != 0) {
if (r != nullptr) {
const_cast<func_interp*>(this)->m_interp = r;
m_manager.inc_ref(m_interp);
}

View file

@ -86,7 +86,7 @@ public:
unsigned get_arity() const { return m_arity; }
bool is_partial() const { return m_else == 0; }
bool is_partial() const { return m_else == nullptr; }
// A function interpretation is said to be simple if m_else is ground.
bool is_simple() const { return is_partial() || is_ground(m_else); }
bool is_constant() const;

View file

@ -94,12 +94,12 @@ struct model::value_proc : public some_value_proc {
model & m_model;
value_proc(model & m):m_model(m) {}
expr * operator()(sort * s) override {
ptr_vector<expr> * u = 0;
ptr_vector<expr> * u = nullptr;
if (m_model.m_usort2universe.find(s, u)) {
if (u->size() > 0)
return u->get(0);
}
return 0;
return nullptr;
}
};
@ -109,16 +109,16 @@ expr * model::get_some_value(sort * s) {
}
ptr_vector<expr> const & model::get_universe(sort * s) const {
ptr_vector<expr> * u = 0;
ptr_vector<expr> * u = nullptr;
m_usort2universe.find(s, u);
SASSERT(u != 0);
return *u;
}
bool model::has_uninterpreted_sort(sort * s) const {
ptr_vector<expr> * u = 0;
ptr_vector<expr> * u = nullptr;
m_usort2universe.find(s, u);
return u != 0;
return u != nullptr;
}
unsigned model::get_num_uninterpreted_sorts() const {

View file

@ -37,7 +37,7 @@ bool model_core::eval(func_decl* f, expr_ref & r) const {
}
else {
func_interp * fi = get_func_interp(f);
if (fi != 0) {
if (fi != nullptr) {
r = fi->get_interp();
return r != 0;
}

View file

@ -44,8 +44,8 @@ public:
unsigned get_num_decls() const { return m_decls.size(); }
func_decl * get_decl(unsigned i) const { return m_decls[i]; }
bool has_interpretation(func_decl * d) const { return m_interp.contains(d) || m_finterp.contains(d); }
expr * get_const_interp(func_decl * d) const { expr * v; return m_interp.find(d, v) ? v : 0; }
func_interp * get_func_interp(func_decl * d) const { func_interp * fi; return m_finterp.find(d, fi) ? fi : 0; }
expr * get_const_interp(func_decl * d) const { expr * v; return m_interp.find(d, v) ? v : nullptr; }
func_interp * get_func_interp(func_decl * d) const { func_interp * fi; return m_finterp.find(d, fi) ? fi : nullptr; }
bool eval(func_decl * f, expr_ref & r) const;

View file

@ -91,7 +91,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
bool evaluate(func_decl * f, unsigned num, expr * const * args, expr_ref & result) {
func_interp * fi = m_model.get_func_interp(f);
return (fi != 0) && eval_fi(fi, num, args, result);
return (fi != nullptr) && eval_fi(fi, num, args, result);
}
// Try to use the entries to quickly evaluate the fi
@ -110,7 +110,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
return false; // let get_macro handle it
func_entry * entry = fi->get_entry(args);
if (entry != 0) {
if (entry != nullptr) {
result = entry->get_result();
return true;
}
@ -119,12 +119,12 @@ struct evaluator_cfg : public default_rewriter_cfg {
}
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
result_pr = 0;
result_pr = nullptr;
family_id fid = f->get_family_id();
bool is_uninterp = fid != null_family_id && m.get_plugin(fid)->is_considered_uninterpreted(f);
if (num == 0 && (fid == null_family_id || is_uninterp)) {
expr * val = m_model.get_const_interp(f);
if (val != 0) {
if (val != nullptr) {
result = val;
return BR_DONE;
}
@ -224,7 +224,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
func_interp * fi = m_model.get_func_interp(f);
if (fi != 0) {
if (fi != nullptr) {
TRACE_MACRO;
if (fi->is_partial()) {
if (m_model_completion) {
@ -262,8 +262,8 @@ struct evaluator_cfg : public default_rewriter_cfg {
expr_ref & result, proof_ref & result_pr) {
SASSERT(f != 0);
SASSERT(!m.is_builtin_family_id(f->get_family_id()));
result = 0;
result_pr = 0;
result = nullptr;
result_pr = nullptr;
func_interp * fi = m_model.get_func_interp(f);
if (fi) {
@ -382,7 +382,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
continue;
}
table2.insert(stores2[i].c_ptr());
expr * const* args = 0;
expr * const* args = nullptr;
expr* val = stores2[i][arity];
if (table1.find(stores2[i].c_ptr(), args)) {
switch (compare(args[arity], val)) {

View file

@ -90,7 +90,7 @@ void model_implicant::reset() {
m_visited.reset();
m_numbers.reset();
m_refs.reset();
m_model = 0;
m_model = nullptr;
}
expr_ref_vector model_implicant::minimize_model(ptr_vector<expr> const & formulas, model_ref& mdl) {
@ -666,8 +666,8 @@ void model_implicant::eval_eq(app* e, expr* arg1, expr* arg2) {
}
void model_implicant::eval_basic(app* e) {
expr* arg1 = 0, *arg2 = 0;
expr *argCond = 0, *argThen = 0, *argElse = 0, *arg = 0;
expr* arg1 = nullptr, *arg2 = nullptr;
expr *argCond = nullptr, *argThen = nullptr, *argElse = nullptr, *arg = nullptr;
bool has_x = false;
unsigned arity = e->get_num_args();
switch(e->get_decl_kind()) {