3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-08 00:05:46 +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

@ -56,7 +56,7 @@ public:
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override { return CPK_SYMBOL; }
void set_next_arg(cmd_context & ctx, symbol const & s) override {
cmd * c = ctx.find_cmd(s);
if (c == 0) {
if (c == nullptr) {
std::string err_msg("unknown command '");
err_msg = err_msg + s.bare_str() + "'";
throw cmd_exception(err_msg);
@ -109,7 +109,7 @@ public:
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override { return CPK_UINT; }
void set_next_arg(cmd_context & ctx, unsigned index) override { m_index = index; }
void execute(cmd_context & ctx) override {
if (!ctx.is_model_available() || ctx.get_check_sat_result() == 0)
if (!ctx.is_model_available() || ctx.get_check_sat_result() == nullptr)
throw cmd_exception("model is not available");
model_ref m;
if (m_index > 0 && ctx.get_opt()) {
@ -785,7 +785,7 @@ public:
}
void execute(cmd_context & ctx) override {
psort_decl * array_sort = ctx.find_psort_decl(m_array_sort);
if (array_sort == 0)
if (array_sort == nullptr)
throw cmd_exception("Array sort is not available");
ptr_vector<sort> & array_sort_args = m_domain;
sort_ref_buffer domain(ctx.m());
@ -892,7 +892,7 @@ void install_ext_basic_cmds(cmd_context & ctx) {
ctx.insert(alloc(echo_cmd));
ctx.insert(alloc(labels_cmd));
ctx.insert(alloc(declare_map_cmd));
ctx.insert(alloc(builtin_cmd, "reset", 0, "reset the shell (all declarations and assertions will be erased)"));
ctx.insert(alloc(builtin_cmd, "reset", nullptr, "reset the shell (all declarations and assertions will be erased)"));
install_simplify_cmd(ctx);
install_eval_cmd(ctx);
}

View file

@ -328,17 +328,17 @@ struct check_logic::imp {
bool is_offset(app * t) {
while (true) {
expr * non_numeral = 0;
expr * non_numeral = nullptr;
unsigned num_args = t->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
expr * arg = t->get_arg(i);
if (is_numeral(arg))
continue;
if (non_numeral != 0)
if (non_numeral != nullptr)
return false;
non_numeral = arg;
}
if (non_numeral == 0)
if (non_numeral == nullptr)
return true;
if (is_diff_var(non_numeral))
return true;
@ -501,7 +501,7 @@ struct check_logic::imp {
};
check_logic::check_logic() {
m_imp = 0;
m_imp = nullptr;
}
check_logic::~check_logic() {
@ -512,7 +512,7 @@ check_logic::~check_logic() {
void check_logic::reset() {
if (m_imp)
dealloc(m_imp);
m_imp = 0;
m_imp = nullptr;
}
void check_logic::set_logic(ast_manager & m, symbol const & logic) {

View file

@ -67,7 +67,7 @@ void func_decls::finalize(ast_manager & m) {
}
dealloc(fs);
}
m_decls = 0;
m_decls = nullptr;
}
bool func_decls::signatures_collide(func_decl* f, func_decl* g) const {
@ -116,7 +116,7 @@ bool func_decls::insert(ast_manager & m, func_decl * f) {
if (contains(f))
return false;
m.inc_ref(f);
if (m_decls == 0) {
if (m_decls == nullptr) {
m_decls = TAG(func_decl*, f, 0);
}
else if (GET_TAG(m_decls) == 0) {
@ -137,7 +137,7 @@ void func_decls::erase(ast_manager & m, func_decl * f) {
return;
if (GET_TAG(m_decls) == 0) {
m.dec_ref(f);
m_decls = 0;
m_decls = nullptr;
}
else {
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
@ -145,7 +145,7 @@ void func_decls::erase(ast_manager & m, func_decl * f) {
m.dec_ref(f);
if (fs->empty()) {
dealloc(fs);
m_decls = 0;
m_decls = nullptr;
}
}
}
@ -154,7 +154,7 @@ void func_decls::erase(ast_manager & m, func_decl * f) {
\brief Return true if func_decls contains a declaration different from f, but with the same domain.
*/
bool func_decls::clash(func_decl * f) const {
if (m_decls == 0)
if (m_decls == nullptr)
return false;
if (GET_TAG(m_decls) == 0)
return false;
@ -176,15 +176,15 @@ bool func_decls::clash(func_decl * f) const {
}
bool func_decls::more_than_one() const {
if (m_decls == 0 || GET_TAG(m_decls) == 0)
if (m_decls == nullptr || GET_TAG(m_decls) == 0)
return false;
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
return fs->size() > 1;
}
func_decl * func_decls::first() const {
if (m_decls == 0)
return 0;
if (m_decls == nullptr)
return nullptr;
if (GET_TAG(m_decls) == 0)
return UNTAG(func_decl*, m_decls);
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
@ -197,7 +197,7 @@ func_decl * func_decls::find(unsigned arity, sort * const * domain, sort * range
return first();
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
for (func_decl * f : *fs) {
if (range != 0 && f->get_range() != range)
if (range != nullptr && f->get_range() != range)
continue;
if (f->get_arity() != arity)
continue;
@ -209,7 +209,7 @@ func_decl * func_decls::find(unsigned arity, sort * const * domain, sort * range
if (i == arity)
return f;
}
return 0;
return nullptr;
}
func_decl * func_decls::find(ast_manager & m, unsigned num_args, expr * const * args, sort * range) const {
@ -257,7 +257,7 @@ bool macro_decls::insert(ast_manager& m, unsigned arity, sort *const* domain, ex
}
expr* macro_decls::find(unsigned arity, sort *const* domain) const {
if (!m_decls) return 0;
if (!m_decls) return nullptr;
for (auto v : *m_decls) {
if (v.m_domain.size() != arity) continue;
bool eq = true;
@ -266,7 +266,7 @@ expr* macro_decls::find(unsigned arity, sort *const* domain) const {
}
if (eq) return v.m_body;
}
return 0;
return nullptr;
}
void macro_decls::erase_last(ast_manager& m) {
@ -291,7 +291,7 @@ bool cmd_context::contains_macro(symbol const& s, func_decl* f) const {
bool cmd_context::contains_macro(symbol const& s, unsigned arity, sort *const* domain) const {
macro_decls decls;
return m_macros.find(s, decls) && 0 != decls.find(arity, domain);
return m_macros.find(s, decls) && nullptr != decls.find(arity, domain);
}
void cmd_context::insert_macro(symbol const& s, unsigned arity, sort*const* domain, expr* t) {
@ -472,11 +472,11 @@ cmd_context::cmd_context(bool main_ctx, ast_manager * m, symbol const & l):
m_processing_pareto(false),
m_exit_on_error(false),
m_manager(m),
m_own_manager(m == 0),
m_own_manager(m == nullptr),
m_manager_initialized(false),
m_rec_fun_declared(false),
m_pmanager(0),
m_sexpr_manager(0),
m_pmanager(nullptr),
m_sexpr_manager(nullptr),
m_regular("stdout", std::cout),
m_diagnostic("stderr", std::cerr) {
SASSERT(m != 0 || !has_manager());
@ -498,8 +498,8 @@ cmd_context::~cmd_context() {
finalize_tactic_cmds();
finalize_probes();
reset(true);
m_solver = 0;
m_check_sat_result = 0;
m_solver = nullptr;
m_check_sat_result = nullptr;
}
void cmd_context::set_cancel(bool f) {
@ -593,7 +593,7 @@ bool cmd_context::validate_model_enabled() const {
}
cmd_context::check_sat_state cmd_context::cs_state() const {
if (m_check_sat_result.get() == 0)
if (m_check_sat_result.get() == nullptr)
return css_clear;
switch (m_check_sat_result->status()) {
case l_true: return css_sat;
@ -741,7 +741,7 @@ void cmd_context::init_manager() {
else {
m_manager_initialized = true;
SASSERT(m_pmanager == 0);
m_check_sat_result = 0;
m_check_sat_result = nullptr;
m_manager = m_params.mk_ast_manager();
m_pmanager = alloc(pdecl_manager, *m_manager);
init_manager_core(true);
@ -771,7 +771,7 @@ bool cmd_context::set_logic(symbol const & s) {
}
std::string cmd_context::reason_unknown() const {
if (m_check_sat_result.get() == 0)
if (m_check_sat_result.get() == nullptr)
return "state of the most recent check-sat command is not known";
return m_check_sat_result->reason_unknown();
}
@ -861,7 +861,7 @@ void cmd_context::insert_user_tactic(symbol const & s, sexpr * d) {
void cmd_context::insert(symbol const & s, object_ref * r) {
r->inc_ref(*this);
object_ref * old_r = 0;
object_ref * old_r = nullptr;
if (m_object_refs.find(s, old_r)) {
old_r->dec_ref(*this);
}
@ -905,8 +905,8 @@ func_decl * cmd_context::find_func_decl(symbol const & s) const {
try {
// Remark: ignoring m_next of d. We do not allow two different theories to define the same constant name.
func_decl * f;
f = m().mk_func_decl(d.m_fid, d.m_decl, 0, 0, 0, static_cast<sort*const*>(0), 0);
if (f != 0)
f = m().mk_func_decl(d.m_fid, d.m_decl, 0, nullptr, 0, static_cast<sort*const*>(nullptr), nullptr);
if (f != nullptr)
return f;
}
catch (ast_exception &) {
@ -923,7 +923,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s) const {
return fs.first();
}
throw cmd_exception("invalid function declaration reference, unknown function ", s);
return 0;
return nullptr;
}
/**
@ -936,7 +936,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s) const {
*/
static builtin_decl const & peek_builtin_decl(builtin_decl const & first, family_id target_id) {
builtin_decl const * curr = &first;
while (curr != 0) {
while (curr != nullptr) {
if (curr->m_fid == target_id)
return *curr;
curr = curr->m_next;
@ -958,7 +958,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s, unsigned num_indices,
}
func_decl * f;
if (num_indices == 0) {
f = m().mk_func_decl(fid, k, 0, 0, arity, domain, range);
f = m().mk_func_decl(fid, k, 0, nullptr, arity, domain, range);
}
else {
buffer<parameter> ps;
@ -966,7 +966,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s, unsigned num_indices,
ps.push_back(parameter(indices[i]));
f = m().mk_func_decl(fid, k, num_indices, ps.c_ptr(), arity, domain, range);
}
if (f == 0)
if (f == nullptr)
throw cmd_exception("invalid function declaration reference, invalid builtin reference ", s);
return f;
}
@ -977,46 +977,46 @@ func_decl * cmd_context::find_func_decl(symbol const & s, unsigned num_indices,
if (num_indices > 0)
throw cmd_exception("invalid indexed function declaration reference, unknown builtin function ", s);
func_decl * f = 0;
func_decl * f = nullptr;
func_decls fs;
if (m_func_decls.find(s, fs)) {
f = fs.find(arity, domain, range);
}
if (f == 0)
if (f == nullptr)
throw cmd_exception("invalid function declaration reference, unknown function ", s);
return f;
}
psort_decl * cmd_context::find_psort_decl(symbol const & s) const {
psort_decl * p = 0;
psort_decl * p = nullptr;
m_psort_decls.find(s, p);
return p;
}
cmd * cmd_context::find_cmd(symbol const & s) const {
cmd * c = 0;
cmd * c = nullptr;
m_cmds.find(s, c);
return c;
}
sexpr * cmd_context::find_user_tactic(symbol const & s) const {
sexpr * n = 0;
sexpr * n = nullptr;
m_user_tactic_decls.find(s, n);
return n;
}
object_ref * cmd_context::find_object_ref(symbol const & s) const {
object_ref * r = 0;
object_ref * r = nullptr;
m_object_refs.find(s, r);
if (r == 0) throw cmd_exception("unknown global variable ", s);
if (r == nullptr) throw cmd_exception("unknown global variable ", s);
return r;
}
#define CHECK_SORT(T) if (well_sorted_check_enabled()) m().check_sorts_core(T)
void cmd_context::mk_const(symbol const & s, expr_ref & result) const {
mk_app(s, 0, 0, 0, 0, 0, result);
mk_app(s, 0, nullptr, 0, nullptr, nullptr, result);
}
void cmd_context::mk_app(symbol const & s, unsigned num_args, expr * const * args, unsigned num_indices, parameter const * indices, sort * range,
@ -1032,12 +1032,12 @@ void cmd_context::mk_app(symbol const & s, unsigned num_args, expr * const * arg
k = d2.m_decl;
}
if (num_indices == 0) {
result = m().mk_app(fid, k, 0, 0, num_args, args, range);
result = m().mk_app(fid, k, 0, nullptr, num_args, args, range);
}
else {
result = m().mk_app(fid, k, num_indices, indices, num_args, args, range);
}
if (result.get() == 0)
if (result.get() == nullptr)
throw cmd_exception("invalid builtin application ", s);
CHECK_SORT(result.get());
return;
@ -1066,11 +1066,11 @@ void cmd_context::mk_app(symbol const & s, unsigned num_args, expr * const * arg
throw cmd_exception("unknown function/constant ", s);
}
if (num_args == 0 && range == 0) {
if (num_args == 0 && range == nullptr) {
if (fs.more_than_one())
throw cmd_exception("ambiguous constant reference, more than one constant with the same sort, use a qualified expression (as <symbol> <sort>) to disumbiguate ", s);
func_decl * f = fs.first();
if (f == 0) {
if (f == nullptr) {
throw cmd_exception("unknown constant ", s);
}
if (f->get_arity() != 0)
@ -1079,7 +1079,7 @@ void cmd_context::mk_app(symbol const & s, unsigned num_args, expr * const * arg
}
else {
func_decl * f = fs.find(m(), num_args, args, range);
if (f == 0) {
if (f == nullptr) {
std::ostringstream buffer;
buffer << "unknown constant " << s << " ";
buffer << " (";
@ -1173,7 +1173,7 @@ void cmd_context::erase_user_tactic(symbol const & s) {
}
void cmd_context::erase_object_ref(symbol const & s) {
object_ref * r = 0;
object_ref * r = nullptr;
if (m_object_refs.find(s, r)) {
r->dec_ref(*this);
m_object_refs.erase(s);
@ -1242,7 +1242,7 @@ void cmd_context::insert_aux_pdecl(pdecl * p) {
void cmd_context::reset(bool finalize) {
m_processing_pareto = false;
m_logic = symbol::null;
m_check_sat_result = 0;
m_check_sat_result = nullptr;
m_numeral_as_real = false;
m_builtin_decls.reset();
m_extra_builtin_decls.reset();
@ -1255,17 +1255,17 @@ void cmd_context::reset(bool finalize) {
reset_func_decls();
restore_assertions(0);
if (m_solver)
m_solver = 0;
m_solver = nullptr;
m_scopes.reset();
m_opt = 0;
m_pp_env = 0;
m_dt_eh = 0;
m_opt = nullptr;
m_pp_env = nullptr;
m_dt_eh = nullptr;
if (m_manager) {
dealloc(m_pmanager);
m_pmanager = 0;
m_pmanager = nullptr;
if (m_own_manager) {
dealloc(m_manager);
m_manager = 0;
m_manager = nullptr;
m_manager_initialized = false;
}
else {
@ -1279,7 +1279,7 @@ void cmd_context::reset(bool finalize) {
}
if (m_sexpr_manager) {
dealloc(m_sexpr_manager);
m_sexpr_manager = 0;
m_sexpr_manager = nullptr;
}
SASSERT(!m_own_manager || !has_manager());
}
@ -1288,7 +1288,7 @@ void cmd_context::assert_expr(expr * t) {
m_processing_pareto = false;
if (!m_check_logic(t))
throw cmd_exception(m_check_logic.get_last_error());
m_check_sat_result = 0;
m_check_sat_result = nullptr;
m().inc_ref(t);
m_assertions.push_back(t);
if (produce_unsat_cores())
@ -1305,7 +1305,7 @@ void cmd_context::assert_expr(symbol const & name, expr * t) {
assert_expr(t);
return;
}
m_check_sat_result = 0;
m_check_sat_result = nullptr;
m().inc_ref(t);
m_assertions.push_back(t);
expr * ans = m().mk_const(name, m().mk_bool_sort());
@ -1316,7 +1316,7 @@ void cmd_context::assert_expr(symbol const & name, expr * t) {
}
void cmd_context::push() {
m_check_sat_result = 0;
m_check_sat_result = nullptr;
init_manager();
m_scopes.push_back(scope());
scope & s = m_scopes.back();
@ -1362,7 +1362,7 @@ void cmd_context::restore_psort_decls(unsigned old_sz) {
svector<symbol>::iterator end = m_psort_decls_stack.end();
for (; it != end; ++it) {
symbol const & s = *it;
psort_decl * d = 0;
psort_decl * d = nullptr;
VERIFY(m_psort_decls.find(s, d));
pm().dec_ref(d);
m_psort_decls.erase(s);
@ -1418,7 +1418,7 @@ void cmd_context::restore_assertions(unsigned old_sz) {
}
void cmd_context::pop(unsigned n) {
m_check_sat_result = 0;
m_check_sat_result = nullptr;
m_processing_pareto = false;
if (n == 0)
return;
@ -1556,10 +1556,10 @@ void cmd_context::reset_assertions() {
}
if (m_opt) {
m_opt = 0;
m_opt = nullptr;
}
if (m_solver) {
m_solver = 0;
m_solver = nullptr;
mk_solver();
}
restore_assertions(0);
@ -1778,7 +1778,7 @@ void cmd_context::validate_model() {
for (; it != end; ++it) {
expr * a = *it;
if (is_ground(a)) {
r = 0;
r = nullptr;
evaluator(a, r);
TRACE("model_validate", tout << "checking\n" << mk_ismt2_pp(a, m()) << "\nresult:\n" << mk_ismt2_pp(r, m()) << "\n";);
if (m().is_true(r))
@ -1830,8 +1830,8 @@ void cmd_context::set_interpolating_solver_factory(solver_factory * f) {
void cmd_context::set_solver_factory(solver_factory * f) {
m_solver_factory = f;
m_check_sat_result = 0;
if (has_manager() && f != 0) {
m_check_sat_result = nullptr;
if (has_manager() && f != nullptr) {
mk_solver();
// assert formulas and create scopes in the new solver.
unsigned lim = 0;
@ -1890,7 +1890,7 @@ bool cmd_context::is_model_available() const {
(cs_state() == css_sat || cs_state() == css_unknown)) {
model_ref md;
get_check_sat_result()->get_model(md);
return md.get() != 0;
return md.get() != nullptr;
}
return false;
}
@ -1901,7 +1901,7 @@ format_ns::format * cmd_context::pp(sort * s) const {
}
cmd_context::pp_env & cmd_context::get_pp_env() const {
if (m_pp_env.get() == 0) {
if (m_pp_env.get() == nullptr) {
const_cast<cmd_context*>(this)->m_pp_env = alloc(pp_env, *const_cast<cmd_context*>(this));
}
return *(m_pp_env.get());
@ -1913,7 +1913,7 @@ void cmd_context::pp(expr * n, unsigned num_vars, char const * var_prefix, forma
void cmd_context::pp(expr * n, format_ns::format_ref & r) const {
sbuffer<symbol> buf;
pp(n, 0, 0, r, buf);
pp(n, 0, nullptr, r, buf);
}
void cmd_context::pp(func_decl * f, format_ns::format_ref & r) const {
@ -1938,7 +1938,7 @@ void cmd_context::display(std::ostream & out, expr * n, unsigned indent, unsigne
void cmd_context::display(std::ostream & out, expr * n, unsigned indent) const {
sbuffer<symbol> buf;
display(out, n, indent, 0, 0, buf);
display(out, n, indent, 0, nullptr, buf);
}
void cmd_context::display(std::ostream & out, func_decl * d, unsigned indent) const {

View file

@ -45,7 +45,7 @@ class func_decls {
bool signatures_collide(func_decl* f, func_decl* g) const;
bool signatures_collide(unsigned n, sort*const* domain, sort* range, func_decl* g) const;
public:
func_decls():m_decls(0) {}
func_decls():m_decls(nullptr) {}
func_decls(ast_manager & m, func_decl * f);
void finalize(ast_manager & m);
bool contains(func_decl * f) const;
@ -54,7 +54,7 @@ public:
void erase(ast_manager & m, func_decl * f);
bool more_than_one() const;
bool clash(func_decl * f) const;
bool empty() const { return m_decls == 0; }
bool empty() const { return m_decls == nullptr; }
func_decl * first() const;
func_decl * find(unsigned arity, sort * const * domain, sort * range) const;
func_decl * find(ast_manager & m, unsigned num_args, expr * const * args, sort * range) const;
@ -76,7 +76,7 @@ struct macro_decl {
class macro_decls {
vector<macro_decl>* m_decls;
public:
macro_decls() { m_decls = 0; }
macro_decls() { m_decls = nullptr; }
void finalize(ast_manager& m);
bool insert(ast_manager& m, unsigned arity, sort *const* domain, expr* body);
expr* find(unsigned arity, sort *const* domain) const;
@ -138,8 +138,8 @@ struct builtin_decl {
family_id m_fid;
decl_kind m_decl;
builtin_decl * m_next;
builtin_decl():m_fid(null_family_id), m_decl(0), m_next(0) {}
builtin_decl(family_id fid, decl_kind k, builtin_decl * n = 0):m_fid(fid), m_decl(k), m_next(n) {}
builtin_decl():m_fid(null_family_id), m_decl(0), m_next(nullptr) {}
builtin_decl(family_id fid, decl_kind k, builtin_decl * n = nullptr):m_fid(fid), m_decl(k), m_next(n) {}
};
class opt_wrapper : public check_sat_result {
@ -306,7 +306,7 @@ protected:
public:
cmd_context(bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
cmd_context(bool main_ctx = true, ast_manager * m = nullptr, symbol const & l = symbol::null);
~cmd_context() override;
void set_cancel(bool f);
context_params & params() { return m_params; }
@ -352,7 +352,7 @@ public:
status get_status() const { return m_status; }
std::string reason_unknown() const;
bool has_manager() const { return m_manager != 0; }
bool has_manager() const { return m_manager != nullptr; }
ast_manager & m() const { const_cast<cmd_context*>(this)->init_manager(); return *m_manager; }
ast_manager & get_ast_manager() override { return m(); }
pdecl_manager & pm() const { if (!m_pmanager) const_cast<cmd_context*>(this)->init_manager(); return *m_pmanager; }

View file

@ -33,14 +33,14 @@ void assert_exprs_from(cmd_context const & ctx, goal & t) {
ptr_vector<expr>::const_iterator it2 = ctx.begin_assertion_names();
SASSERT(end - it == ctx.end_assertion_names() - it2);
for (; it != end; ++it, ++it2) {
t.assert_expr(*it, proofs_enabled ? m.mk_asserted(*it) : 0, m.mk_leaf(*it2));
t.assert_expr(*it, proofs_enabled ? m.mk_asserted(*it) : nullptr, m.mk_leaf(*it2));
}
}
else {
ptr_vector<expr>::const_iterator it = ctx.begin_assertions();
ptr_vector<expr>::const_iterator end = ctx.end_assertions();
for (; it != end; ++it) {
t.assert_expr(*it, proofs_enabled ? m.mk_asserted(*it) : 0, 0);
t.assert_expr(*it, proofs_enabled ? m.mk_asserted(*it) : nullptr, nullptr);
}
SASSERT(ctx.begin_assertion_names() == ctx.end_assertion_names());
}

View file

@ -62,7 +62,7 @@ void context_params::set_uint(unsigned & opt, char const * param, char const * v
}
if (is_uint) {
long val = strtol(value, 0, 10);
long val = strtol(value, nullptr, 10);
opt = static_cast<unsigned>(val);
}
else {
@ -198,7 +198,7 @@ void context_params::get_solver_params(ast_manager const & m, params_ref & p, bo
ast_manager * context_params::mk_ast_manager() {
ast_manager * r = alloc(ast_manager,
m_proof ? PGM_ENABLED : PGM_DISABLED,
m_trace ? m_trace_file_name.c_str() : 0);
m_trace ? m_trace_file_name.c_str() : nullptr);
if (m_smtlib2_compliant)
r->enable_int_real_coercions(false);
if (m_debug_ref_count)

View file

@ -43,11 +43,11 @@ public:
void prepare(cmd_context & ctx) override {
parametric_cmd::prepare(ctx);
m_target = 0;
m_target = nullptr;
}
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_target == 0) return CPK_EXPR;
if (m_target == nullptr) return CPK_EXPR;
return parametric_cmd::next_arg_kind(ctx);
}

View file

@ -107,7 +107,7 @@ public:
char const * get_usage() const override { return "<symbol> (<symbol>*) <symbol>"; }
char const * get_descr(cmd_context & ctx) const override { return "substitute the free variables in the AST referenced by <symbol> using the ASTs referenced by <symbol>*"; }
unsigned get_arity() const override { return 3; }
void prepare(cmd_context & ctx) override { m_idx = 0; m_source = 0; }
void prepare(cmd_context & ctx) override { m_idx = 0; m_source = nullptr; }
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_idx == 1) return CPK_SYMBOL_LIST;
return CPK_SYMBOL;
@ -182,10 +182,10 @@ public:
char const * get_usage() const override { return "<term> <term>"; }
char const * get_descr(cmd_context & ctx) const override { return "return true if the first term is smaller than the second one in the internal Z3 total order on terms."; }
unsigned get_arity() const override { return 2; }
void prepare(cmd_context & ctx) override { m_t1 = 0; }
void prepare(cmd_context & ctx) override { m_t1 = nullptr; }
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override { return CPK_EXPR; }
void set_next_arg(cmd_context & ctx, expr * arg) override {
if (m_t1 == 0)
if (m_t1 == nullptr)
m_t1 = arg;
else
m_t2 = arg;
@ -286,10 +286,10 @@ public:
char const * get_usage() const override { return "<quantifier> (<symbol>*)"; }
char const * get_descr(cmd_context & ctx) const override { return "instantiate the quantifier using the given expressions."; }
unsigned get_arity() const override { return 2; }
void prepare(cmd_context & ctx) override { m_q = 0; m_args.reset(); }
void prepare(cmd_context & ctx) override { m_q = nullptr; m_args.reset(); }
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_q == 0) return CPK_EXPR;
if (m_q == nullptr) return CPK_EXPR;
else return CPK_EXPR_LIST;
}

View file

@ -104,7 +104,7 @@ class poly_isolate_roots_cmd : public cmd {
}
void set_next_arg(cmd_context & ctx, expr * arg) {
if (m_p.get() == 0) {
if (m_p.get() == nullptr) {
scoped_mpz d(m_qm);
if (!m_expr2poly.to_polynomial(arg, m_p, d))
throw cmd_exception("expression is not a polynomial");
@ -132,7 +132,7 @@ class poly_isolate_roots_cmd : public cmd {
}
void execute(cmd_context & ctx) {
if (m_p.get() == 0)
if (m_p.get() == nullptr)
throw cmd_exception("polynomial expected");
polynomial::var_vector xs;
m_pm.vars(m_p, xs);
@ -162,7 +162,7 @@ class poly_isolate_roots_cmd : public cmd {
scoped_ptr<context> m_ctx;
public:
poly_isolate_roots_cmd(char const * name = "poly/isolate-roots"):cmd(name), m_ctx(0) {}
poly_isolate_roots_cmd(char const * name = "poly/isolate-roots"):cmd(name), m_ctx(nullptr) {}
char const * get_usage() const override { return "<term> (<term> <value>)*"; }
@ -175,11 +175,11 @@ public:
}
void finalize(cmd_context & ctx) override {
m_ctx = 0;
m_ctx = nullptr;
}
void failure_cleanup(cmd_context & ctx) override {
m_ctx = 0;
m_ctx = nullptr;
}
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
@ -192,7 +192,7 @@ public:
void execute(cmd_context & ctx) override {
m_ctx->execute(ctx);
m_ctx = 0;
m_ctx = nullptr;
}
};
@ -216,11 +216,11 @@ public:
void prepare(cmd_context & ctx) override {
parametric_cmd::prepare(ctx);
m_target = 0;
m_target = nullptr;
}
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_target == 0) return CPK_EXPR;
if (m_target == nullptr) return CPK_EXPR;
return parametric_cmd::next_arg_kind(ctx);
}

View file

@ -117,7 +117,7 @@ static void get_interpolant_and_maybe_check(cmd_context & ctx, expr * t, params_
ptr_vector<ast> interps;
try {
iz3interpolate(ctx.m(),pr.get(),cnsts,t,interps,0);
iz3interpolate(ctx.m(),pr.get(),cnsts,t,interps,nullptr);
}
catch (iz3_bad_tree &) {
throw cmd_exception("interpolation pattern contains non-asserted formula");
@ -160,7 +160,7 @@ static void compute_interpolant_and_maybe_check(cmd_context & ctx, expr * t, par
lbool res;
try {
res = iz3interpolate(_m, *sp.get(), t, cnsts, interps, m, 0);
res = iz3interpolate(_m, *sp.get(), t, cnsts, interps, m, nullptr);
}
catch (iz3_incompleteness &) {
throw cmd_exception("incompleteness in interpolator");

View file

@ -20,7 +20,7 @@ Notes:
#include "cmd_context/parametric_cmd.h"
char const * parametric_cmd::get_descr(cmd_context & ctx) const {
if (m_descr == 0) {
if (m_descr == nullptr) {
const_cast<parametric_cmd*>(this)->m_descr = alloc(string_buffer<>);
m_descr->append(get_main_descr());
m_descr->append("\nThe following options are available:\n");

View file

@ -30,7 +30,7 @@ public:
params_ref m_params;
scoped_ptr<param_descrs> m_pdescrs;
public:
parametric_cmd(char const * name):cmd(name), m_descr(0) {}
parametric_cmd(char const * name):cmd(name), m_descr(nullptr) {}
~parametric_cmd() override { if (m_descr) dealloc(m_descr); }
virtual void init_pdescrs(cmd_context & ctx, param_descrs & d) = 0;
param_descrs const & pdescrs(cmd_context & ctx) const;

View file

@ -25,7 +25,7 @@ class psort_inst_cache {
sort * m_const;
obj_map<sort, void *> m_map; // if m_num_params == 1 value is a sort, otherwise it is a reference to another inst_cache
public:
psort_inst_cache(unsigned num_params):m_num_params(num_params), m_const(0) {
psort_inst_cache(unsigned num_params):m_num_params(num_params), m_const(nullptr) {
}
~psort_inst_cache() { SASSERT(m_map.empty()); SASSERT(m_const == 0); }
@ -35,7 +35,7 @@ public:
SASSERT(m_map.empty());
if (m_const)
m.m().dec_ref(m_const);
m_const = 0;
m_const = nullptr;
}
else {
SASSERT(m_const == 0);
@ -71,7 +71,7 @@ public:
m.m().inc_ref(r);
return;
}
void * next = 0;
void * next = nullptr;
if (!curr->m_map.find(*s, next)) {
next = new (m.a().allocate(sizeof(psort_inst_cache))) psort_inst_cache(curr->m_num_params-1);
curr->m_map.insert(*s, next);
@ -90,22 +90,22 @@ public:
psort_inst_cache const * curr = this;
while (true) {
if (curr->m_num_params == 1) {
void * r = 0;
void * r = nullptr;
curr->m_map.find(*s, r);
return static_cast<sort*>(r);
}
else {
void * next = 0;
void * next = nullptr;
curr->m_map.find(*s, next);
if (next == 0)
return 0;
if (next == nullptr)
return nullptr;
s++;
curr = static_cast<psort_inst_cache*>(next);
}
}
}
bool empty() const { return m_num_params == 0 ? m_const == 0 : m_map.empty(); }
bool empty() const { return m_num_params == 0 ? m_const == nullptr : m_map.empty(); }
};
void psort::cache(pdecl_manager & m, sort * const * s, sort * r) {
@ -116,7 +116,7 @@ void psort::cache(pdecl_manager & m, sort * const * s, sort * r) {
sort * psort::find(sort * const * s) const {
if (!m_inst_cache)
return 0;
return nullptr;
return m_inst_cache->find(s);
}
@ -126,7 +126,7 @@ void psort::finalize(pdecl_manager & m) {
void psort::reset_cache(pdecl_manager& m) {
m.del_inst_cache(m_inst_cache);
m_inst_cache = 0;
m_inst_cache = nullptr;
}
/**
@ -269,7 +269,7 @@ psort_decl::psort_decl(unsigned id, unsigned num_params, pdecl_manager & m, symb
pdecl(id, num_params),
m_name(n),
m_psort_kind(PSORT_BASE),
m_inst_cache(0) {
m_inst_cache(nullptr) {
}
void psort_decl::finalize(pdecl_manager & m) {
@ -278,7 +278,7 @@ void psort_decl::finalize(pdecl_manager & m) {
void psort_decl::reset_cache(pdecl_manager& m) {
m.del_inst_cache(m_inst_cache);
m_inst_cache = 0;
m_inst_cache = nullptr;
}
void psort_decl::cache(pdecl_manager & m, sort * const * s, sort * r) {
@ -289,7 +289,7 @@ void psort_decl::cache(pdecl_manager & m, sort * const * s, sort * r) {
sort * psort_decl::find(sort * const * s) {
if (!m_inst_cache)
return 0;
return nullptr;
return m_inst_cache->find(s);
}
@ -303,7 +303,7 @@ psort_user_decl::psort_user_decl(unsigned id, unsigned num_params, pdecl_manager
void psort_user_decl::finalize(pdecl_manager & m) {
m.dec_ref(m_def);
m_def = 0;
m_def = nullptr;
psort_decl::finalize(m);
}
@ -312,7 +312,7 @@ sort * psort_user_decl::instantiate(pdecl_manager & m, unsigned n, sort * const
sort * r = find(s);
if (r)
return r;
if (m_def == 0) {
if (m_def == nullptr) {
buffer<parameter> ps;
for (unsigned i = 0; i < n; i++)
ps.push_back(parameter(s[i]));
@ -462,7 +462,7 @@ accessor_decl * paccessor_decl::instantiate_decl(pdecl_manager & m, sort * const
default:
// missing refs must have been eliminated.
UNREACHABLE();
return 0;
return nullptr;
}
}
@ -522,7 +522,7 @@ pdatatype_decl::pdatatype_decl(unsigned id, unsigned num_params, pdecl_manager &
symbol const & n, unsigned num_constructors, pconstructor_decl * const * constructors):
psort_decl(id, num_params, m, n),
m_constructors(num_constructors, constructors),
m_parent(0) {
m_parent(nullptr) {
m.inc_ref(num_constructors, constructors);
}
@ -633,7 +633,7 @@ bool pdatatype_decl::commit(pdecl_manager& m) {
TRACE("datatype", tout << m_name << "\n";);
sort_ref_vector ps(m.m());
for (unsigned i = 0; i < m_num_params; ++i) {
ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, 0));
ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, nullptr));
}
datatype_decl_buffer dts;
dts.m_buffer.push_back(instantiate_decl(m, ps.c_ptr()));
@ -712,7 +712,7 @@ bool pdatatypes_decl::commit(pdecl_manager& m) {
for (pdatatype_decl* d : m_datatypes) {
sort_ref_vector ps(m.m());
for (unsigned i = 0; i < d->get_num_params(); ++i) {
ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, 0));
ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, nullptr));
}
dts.m_buffer.push_back(d->instantiate_decl(m, ps.c_ptr()));
}
@ -834,7 +834,7 @@ void pdecl_manager::init_list() {
ptype ListT(0);
paccessor_decl * as[2] = { mk_paccessor_decl(1, symbol("head"), T),
mk_paccessor_decl(1, symbol("tail"), ListT) };
pconstructor_decl * cs[2] = { mk_pconstructor_decl(1, symbol("nil"), symbol("is-nil"), 0, 0),
pconstructor_decl * cs[2] = { mk_pconstructor_decl(1, symbol("nil"), symbol("is-nil"), 0, nullptr),
mk_pconstructor_decl(1, symbol("insert"), symbol("is-insert"), 2, as) };
m_list = mk_pdatatype_decl(1, symbol("List"), 2, cs);
inc_ref(m_list);
@ -844,8 +844,8 @@ void pdecl_manager::init_list() {
pdecl_manager::pdecl_manager(ast_manager & m):
m_manager(m),
m_allocator(m.get_allocator()),
m_new_dt_eh(0) {
m_list = 0;
m_new_dt_eh(nullptr) {
m_list = nullptr;
m_datatype_fid = m.mk_family_id("datatype");
}
@ -857,7 +857,7 @@ pdecl_manager::~pdecl_manager() {
}
psort * pdecl_manager::mk_psort_cnst(sort * s) {
psort * r = 0;
psort * r = nullptr;
if (m_sort2psort.find(s, r))
return r;
r = new (a().allocate(sizeof(psort_sort))) psort_sort(m_id_gen.mk(), *this, s);
@ -907,9 +907,9 @@ psort * pdecl_manager::mk_psort_app(unsigned num_params, psort_decl * d, unsigne
psort * pdecl_manager::mk_psort_app(psort_decl * d) {
SASSERT(d->get_num_params() == 0 || d->get_num_params() == PSORT_DECL_VAR_PARAMS);
sort * s = d->instantiate(*this, 0, static_cast<sort*const*>(0));
if (s == 0)
return 0;
sort * s = d->instantiate(*this, 0, static_cast<sort*const*>(nullptr));
if (s == nullptr)
return nullptr;
return mk_psort_cnst(s);
}
@ -1010,7 +1010,7 @@ void pdecl_manager::reset_sort_info() {
}
void pdecl_manager::display(std::ostream & out, sort * s) const {
sort_info * info = 0;
sort_info * info = nullptr;
if (m_sort2info.find(s, info)) {
info->display(out, *this);
return;
@ -1019,7 +1019,7 @@ void pdecl_manager::display(std::ostream & out, sort * s) const {
}
format * pdecl_manager::pp(sort * s) const {
sort_info * info = 0;
sort_info * info = nullptr;
if (m_sort2info.find(s, info)) {
return info->pp(*this);
}

View file

@ -64,7 +64,7 @@ class psort : public pdecl {
protected:
psort_inst_cache * m_inst_cache;
friend class pdecl_manager;
psort(unsigned id, unsigned num_params):pdecl(id, num_params), m_inst_cache(0) {}
psort(unsigned id, unsigned num_params):pdecl(id, num_params), m_inst_cache(nullptr) {}
bool is_psort() const override { return true; }
void finalize(pdecl_manager & m) override;
~psort() override {}
@ -72,7 +72,7 @@ protected:
virtual sort * find(sort * const * s) const;
public:
virtual bool is_sort_wrapper() const { return false; }
virtual sort * instantiate(pdecl_manager & m, sort * const * s) { return 0; }
virtual sort * instantiate(pdecl_manager & m, sort * const * s) { return nullptr; }
// we use hash-consing for psorts.
virtual char const * hcons_kind() const = 0;
virtual unsigned hcons_hash() const = 0;
@ -102,8 +102,8 @@ protected:
~psort_decl() override {}
public:
virtual sort * instantiate(pdecl_manager & m, unsigned n, sort * const * s) = 0;
virtual sort * instantiate(pdecl_manager & m, unsigned n, unsigned const * s) { return 0; }
virtual sort * instantiate(pdecl_manager & m) { return instantiate(m, 0, static_cast<sort*const*>(0)); }
virtual sort * instantiate(pdecl_manager & m, unsigned n, unsigned const * s) { return nullptr; }
virtual sort * instantiate(pdecl_manager & m) { return instantiate(m, 0, static_cast<sort*const*>(nullptr)); }
// return true if the declaration accepts a variable number of parameters.
// Only builtin declarations can have a variable number of parameters.
bool has_var_params() const { return m_num_params == PSORT_DECL_VAR_PARAMS; }
@ -172,7 +172,7 @@ class ptype {
};
symbol m_missing_ref;
public:
ptype():m_kind(PTR_PSORT), m_sort(0) {}
ptype():m_kind(PTR_PSORT), m_sort(nullptr) {}
ptype(int idx):m_kind(PTR_REC_REF), m_idx(idx) {}
ptype(psort * s):m_kind(PTR_PSORT), m_sort(s) {}
ptype(symbol const & s):m_kind(PTR_MISSING_REF), m_missing_ref(s) {}

View file

@ -42,7 +42,7 @@ class simplify_cmd : public parametric_cmd {
}
m_solver->push();
m_solver->assert_expr(e);
lbool r = m_solver->check_sat(0,0);
lbool r = m_solver->check_sat(0,nullptr);
m_solver->pop(1);
return r;
}
@ -71,11 +71,11 @@ public:
void prepare(cmd_context & ctx) override {
parametric_cmd::prepare(ctx);
m_target = 0;
m_target = nullptr;
}
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_target == 0) return CPK_EXPR;
if (m_target == nullptr) return CPK_EXPR;
return parametric_cmd::next_arg_kind(ctx);
}
@ -84,7 +84,7 @@ public:
}
void execute(cmd_context & ctx) override {
if (m_target == 0)
if (m_target == nullptr)
throw cmd_exception("invalid simplify command, argument expected");
expr_ref r(ctx.m());
proof_ref pr(ctx.m());

View file

@ -55,13 +55,13 @@ class declare_tactic_cmd : public cmd {
public:
declare_tactic_cmd():
cmd("declare-tactic"),
m_decl(0) {
m_decl(nullptr) {
}
char const * get_usage() const override { return "<symbol> <tactic>"; }
char const * get_descr(cmd_context & ctx) const override { return "declare a new tactic, use (help-tactic) for the tactic language syntax."; }
unsigned get_arity() const override { return 2; }
void prepare(cmd_context & ctx) override { m_name = symbol::null; m_decl = 0; }
void prepare(cmd_context & ctx) override { m_name = symbol::null; m_decl = nullptr; }
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_name == symbol::null) return CPK_SYMBOL;
return CPK_SEXPR;
@ -137,11 +137,11 @@ public:
void prepare(cmd_context & ctx) override {
parametric_cmd::prepare(ctx);
m_tactic = 0;
m_tactic = nullptr;
}
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_tactic == 0) return CPK_SEXPR;
if (m_tactic == nullptr) return CPK_SEXPR;
return parametric_cmd::next_arg_kind(ctx);
}
@ -597,9 +597,9 @@ static tactic * mk_echo(cmd_context & ctx, sexpr * n) {
if (curr->is_string())
t = mk_echo_tactic(ctx, curr->get_string().c_str(), last);
else
t = mk_probe_value_tactic(ctx, 0, sexpr2probe(ctx, curr), last);
t = mk_probe_value_tactic(ctx, nullptr, sexpr2probe(ctx, curr), last);
tactic * new_res;
if (res.get() == 0)
if (res.get() == nullptr)
new_res = t;
else
new_res = and_then(res.get(), t);
@ -608,7 +608,7 @@ static tactic * mk_echo(cmd_context & ctx, sexpr * n) {
res = new_res;
}
UNREACHABLE();
return 0;
return nullptr;
}
static tactic * mk_fail_if_branching(cmd_context & ctx, sexpr * n) {
@ -665,10 +665,10 @@ static tactic * mk_skip_if_failed(cmd_context & ctx, sexpr * n) {
tactic * sexpr2tactic(cmd_context & ctx, sexpr * n) {
if (n->is_symbol()) {
tactic_cmd * cmd = ctx.find_tactic_cmd(n->get_symbol());
if (cmd != 0)
if (cmd != nullptr)
return cmd->mk(ctx.m());
sexpr * decl = ctx.find_user_tactic(n->get_symbol());
if (decl != 0)
if (decl != nullptr)
return sexpr2tactic(ctx, decl);
throw cmd_exception("invalid tactic, unknown tactic ", n->get_symbol(), n->get_line(), n->get_pos());
}
@ -778,7 +778,7 @@ MK_NARY_PROBE(mk_mul);
probe * sexpr2probe(cmd_context & ctx, sexpr * n) {
if (n->is_symbol()) {
probe_info * pinfo = ctx.find_probe(n->get_symbol());
if (pinfo != 0)
if (pinfo != nullptr)
return pinfo->get();
throw cmd_exception("invalid probe, unknown builtin probe ", n->get_symbol(), n->get_line(), n->get_pos());
}

View file

@ -38,13 +38,13 @@ void tactic_manager::insert(probe_info * p) {
}
tactic_cmd * tactic_manager::find_tactic_cmd(symbol const & s) const {
tactic_cmd * c = 0;
tactic_cmd * c = nullptr;
m_name2tactic.find(s, c);
return c;
}
probe_info * tactic_manager::find_probe(symbol const & s) const {
probe_info * p = 0;
probe_info * p = nullptr;
m_name2probe.find(s, p);
return p;
}