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

@ -34,7 +34,7 @@ public:
model_converter_ref & mc,
proof_converter_ref & pc,
expr_dependency_ref & core) override {
mc = 0;
mc = nullptr;
tactic_report report("ackermannize", *g);
fail_if_unsat_core_generation("ackermannize", g);
fail_if_proof_generation("ackermannize", g);
@ -43,7 +43,7 @@ public:
expr_ref_vector flas(m);
const unsigned sz = g->size();
for (unsigned i = 0; i < sz; i++) flas.push_back(g->form(i));
lackr lackr(m, m_p, m_st, flas, NULL);
lackr lackr(m, m_p, m_st, flas, nullptr);
// mk result
goal_ref resg(alloc(goal, *g, true));
@ -52,9 +52,9 @@ public:
TRACE("ackermannize", tout << "ackermannize not run due to limit" << std::endl;);
result.reset();
result.push_back(g.get());
mc = 0;
pc = 0;
core = 0;
mc = nullptr;
pc = nullptr;
core = nullptr;
return;
}
result.push_back(resg.get());

View file

@ -45,7 +45,7 @@ class ackr_bound_probe : public probe {
if (a->get_num_args() == 0) return;
if (!m_ackr_helper.should_ackermannize(a)) return;
func_decl* const fd = a->get_decl();
app_set* ts = 0;
app_set* ts = nullptr;
if (!m_fun2terms.find(fd, ts)) {
ts = alloc(app_set);
m_fun2terms.insert(fd, ts);

View file

@ -65,7 +65,7 @@ class ackr_info {
}
inline app* find_term(func_decl* c) const {
app * rv = 0;
app * rv = nullptr;
m_c2t.find(c,rv);
return rv;
}

View file

@ -116,7 +116,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator,
<< mk_ismt2_pp(value, m, 2) << "\n";
);
func_interp * fi = 0;
func_interp * fi = nullptr;
func_decl * const declaration = term->get_decl();
const unsigned sz = declaration->get_arity();
SASSERT(sz == term->get_num_args());
@ -133,7 +133,7 @@ void ackr_model_converter::add_entry(model_evaluator & evaluator,
evaluator(aarg, arg_value);
args.push_back(arg_value);
}
if (fi->get_entry(args.c_ptr()) == 0) {
if (fi->get_entry(args.c_ptr()) == nullptr) {
TRACE("ackr_model",
tout << mk_ismt2_pp(declaration, m) << " args: " << std::endl;
for (unsigned i = 0; i < args.size(); i++)

View file

@ -185,7 +185,7 @@ void lackr::add_term(app* a) {
if (a->get_num_args() == 0) return;
if (!m_ackr_helper.should_ackermannize(a)) return;
func_decl* const fd = a->get_decl();
app_set* ts = 0;
app_set* ts = nullptr;
if (!m_fun2terms.find(fd, ts)) {
ts = alloc(app_set);
m_fun2terms.insert(fd, ts);
@ -205,7 +205,7 @@ lbool lackr::eager() {
SASSERT(m_is_init);
push_abstraction();
TRACE("lackr", tout << "run sat 0\n"; );
const lbool rv0 = m_sat->check_sat(0, 0);
const lbool rv0 = m_sat->check_sat(0, nullptr);
if (rv0 == l_false) return l_false;
eager_enc();
expr_ref all(m_m);
@ -213,7 +213,7 @@ lbool lackr::eager() {
m_simp(all);
m_sat->assert_expr(all);
TRACE("lackr", tout << "run sat all\n"; );
return m_sat->check_sat(0, 0);
return m_sat->check_sat(0, nullptr);
}
lbool lackr::lazy() {
@ -225,7 +225,7 @@ lbool lackr::lazy() {
m_st.m_it++;
checkpoint();
TRACE("lackr", tout << "lazy check: " << m_st.m_it << "\n";);
const lbool r = m_sat->check_sat(0, 0);
const lbool r = m_sat->check_sat(0, nullptr);
if (r == l_undef) return l_undef; // give up
if (r == l_false) return l_false; // abstraction unsat
// reconstruct model

View file

@ -34,7 +34,7 @@ struct lackr_model_constructor::imp {
, m_conflicts(conflicts)
, m_b_rw(m)
, m_bv_rw(m)
, m_evaluator(NULL)
, m_evaluator(nullptr)
, m_empty_model(m)
, m_ackr_helper(m)
{}
@ -121,7 +121,7 @@ struct lackr_model_constructor::imp {
void add_entry(app* term, expr* value,
obj_map<func_decl, func_interp*>& interpretations) {
func_interp* fi = 0;
func_interp* fi = nullptr;
func_decl * const declaration = term->get_decl();
const unsigned sz = declaration->get_arity();
SASSERT(sz == term->get_num_args());
@ -169,7 +169,7 @@ struct lackr_model_constructor::imp {
// Stops upon the first failure.
// Returns true if and only if all congruence checks succeeded.
bool _check_stack() {
if (m_evaluator == NULL) m_evaluator = alloc(model_evaluator, m_empty_model);
if (m_evaluator == nullptr) m_evaluator = alloc(model_evaluator, m_empty_model);
expr * curr;
while (!m_stack.empty()) {
curr = m_stack.back();
@ -276,7 +276,7 @@ struct lackr_model_constructor::imp {
SASSERT(a->get_num_args() == 0);
func_decl * const fd = a->get_decl();
expr * val = m_abstr_model->get_const_interp(fd);
if (val == 0) { // TODO: avoid model completetion?
if (val == nullptr) { // TODO: avoid model completetion?
sort * s = fd->get_range();
val = m_abstr_model->get_some_value(s);
}
@ -295,7 +295,7 @@ struct lackr_model_constructor::imp {
expr_ref value(m_m);
value = m_abstr_model->get_const_interp(ac->get_decl());
// get ackermann constant's interpretation
if (value.get() == 0) { // TODO: avoid model completion?
if (value.get() == nullptr) { // TODO: avoid model completion?
sort * s = a_fd->get_range();
value = m_abstr_model->get_some_value(s);
}
@ -362,7 +362,7 @@ struct lackr_model_constructor::imp {
};
lackr_model_constructor::lackr_model_constructor(ast_manager& m, ackr_info_ref info)
: m_imp(0)
: m_imp(nullptr)
, m_m(m)
, m_state(UNKNOWN)
, m_info(info)
@ -377,7 +377,7 @@ bool lackr_model_constructor::check(model_ref& abstr_model) {
m_conflicts.reset();
if (m_imp) {
dealloc(m_imp);
m_imp = 0;
m_imp = nullptr;
}
m_imp = alloc(lackr_model_constructor::imp, m_m, m_info, abstr_model, m_conflicts);
const bool rv = m_imp->check();

View file

@ -162,57 +162,57 @@ extern "C" {
Z3_TRY;
LOG_Z3_algebraic_add(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
BIN_OP(+,add);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_sub(Z3_context c, Z3_ast a, Z3_ast b) {
Z3_TRY;
LOG_Z3_algebraic_sub(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
BIN_OP(-,sub);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_mul(Z3_context c, Z3_ast a, Z3_ast b) {
Z3_TRY;
LOG_Z3_algebraic_mul(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
BIN_OP(*,mul);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_div(Z3_context c, Z3_ast a, Z3_ast b) {
Z3_TRY;
LOG_Z3_algebraic_div(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
if ((is_rational(c, b) && get_rational(c, b).is_zero()) ||
(!is_rational(c, b) && am(c).is_zero(get_irrational(c, b)))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
BIN_OP(/,div);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_root(Z3_context c, Z3_ast a, unsigned k) {
Z3_TRY;
LOG_Z3_algebraic_root(c, a, k);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
if (k % 2 == 0) {
if ((is_rational(c, a) && get_rational(c, a).is_neg()) ||
(!is_rational(c, a) && am(c).is_neg(get_irrational(c, a)))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
algebraic_numbers::manager & _am = am(c);
@ -229,14 +229,14 @@ extern "C" {
expr * r = au(c).mk_numeral(_r, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_power(Z3_context c, Z3_ast a, unsigned k) {
Z3_TRY;
LOG_Z3_algebraic_power(c, a, k);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
algebraic_numbers::manager & _am = am(c);
scoped_anum _r(_am);
if (is_rational(c, a)) {
@ -251,7 +251,7 @@ extern "C" {
expr * r = au(c).mk_numeral(_r, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
#define BIN_PRED(RAT_PRED, IRAT_PRED) \
@ -357,17 +357,17 @@ extern "C" {
polynomial::manager & pm = mk_c(c)->pm();
polynomial_ref _p(pm);
polynomial::scoped_numeral d(pm.m());
expr2polynomial converter(mk_c(c)->m(), pm, 0, true);
expr2polynomial converter(mk_c(c)->m(), pm, nullptr, true);
if (!converter.to_polynomial(to_expr(p), _p, d) ||
static_cast<unsigned>(max_var(_p)) >= n + 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
algebraic_numbers::manager & _am = am(c);
scoped_anum_vector as(_am);
if (!to_anum_vector(c, n, a, as)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
scoped_anum_vector roots(_am);
{
@ -383,7 +383,7 @@ extern "C" {
result->m_ast_vector.push_back(au(c).mk_numeral(roots.get(i), false));
}
RETURN_Z3(of_ast_vector(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
int Z3_API Z3_algebraic_eval(Z3_context c, Z3_ast p, unsigned n, Z3_ast a[]) {
@ -393,7 +393,7 @@ extern "C" {
polynomial::manager & pm = mk_c(c)->pm();
polynomial_ref _p(pm);
polynomial::scoped_numeral d(pm.m());
expr2polynomial converter(mk_c(c)->m(), pm, 0, true);
expr2polynomial converter(mk_c(c)->m(), pm, nullptr, true);
if (!converter.to_polynomial(to_expr(p), _p, d) ||
static_cast<unsigned>(max_var(_p)) >= n) {
SET_ERROR_CODE(Z3_INVALID_ARG);

View file

@ -34,7 +34,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->get_arith_fid(), INT_SORT));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_real_sort(Z3_context c) {
@ -43,7 +43,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->get_arith_fid(), REAL_SORT));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_real(Z3_context c, int num, int den) {
@ -52,12 +52,12 @@ extern "C" {
RESET_ERROR_CODE();
if (den == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort* s = mk_c(c)->m().mk_sort(mk_c(c)->get_arith_fid(), REAL_SORT);
ast* a = mk_c(c)->mk_numeral_core(rational(num, den), s);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_ARITH_OP(Z3_mk_add, OP_ADD);
@ -77,11 +77,11 @@ extern "C" {
k = OP_DIV;
}
expr * args[2] = { to_expr(n1), to_expr(n2) };
ast* a = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), k, 0, 0, 2, args);
ast* a = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), k, 0, nullptr, 2, args);
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_ARITH_PRED(Z3_mk_lt, OP_LT);
@ -98,17 +98,17 @@ extern "C" {
RESET_ERROR_CODE();
if (num_args == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr* r = to_expr(args[0]);
for (unsigned i = 1; i < num_args; ++i) {
expr* args1[2] = { r, to_expr(args[i]) };
r = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), OP_SUB, 0, 0, 2, args1);
r = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), OP_SUB, 0, nullptr, 2, args1);
check_sorts(c, r);
}
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_unary_minus(Z3_context c, Z3_ast n) {
@ -116,7 +116,7 @@ extern "C" {
LOG_Z3_mk_unary_minus(c, n);
RESET_ERROR_CODE();
MK_UNARY_BODY(Z3_mk_unary_minus, mk_c(c)->get_arith_fid(), OP_UMINUS, SKIP);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_algebraic_number(Z3_context c, Z3_ast a) {
@ -134,7 +134,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!Z3_is_algebraic_number(c, a)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * e = to_expr(a);
algebraic_numbers::anum const & val = mk_c(c)->autil().to_irrational_algebraic_numeral(e);
@ -143,7 +143,7 @@ extern "C" {
expr * r = mk_c(c)->autil().mk_numeral(l, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_algebraic_number_upper(Z3_context c, Z3_ast a, unsigned precision) {
@ -152,7 +152,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!Z3_is_algebraic_number(c, a)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * e = to_expr(a);
algebraic_numbers::anum const & val = mk_c(c)->autil().to_irrational_algebraic_numeral(e);
@ -161,7 +161,7 @@ extern "C" {
expr * r = mk_c(c)->autil().mk_numeral(l, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_numerator(Z3_context c, Z3_ast a) {
@ -172,12 +172,12 @@ extern "C" {
ast * _a = to_ast(a);
if (!is_expr(_a) || !mk_c(c)->autil().is_numeral(to_expr(_a), val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * r = mk_c(c)->autil().mk_numeral(numerator(val), true);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_denominator(Z3_context c, Z3_ast a) {
@ -188,12 +188,12 @@ extern "C" {
ast * _a = to_ast(a);
if (!is_expr(_a) || !mk_c(c)->autil().is_numeral(to_expr(_a), val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * r = mk_c(c)->autil().mk_numeral(denominator(val), true);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -31,7 +31,7 @@ extern "C" {
sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, 2, params);
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_array_sort_n(Z3_context c, unsigned n, Z3_sort const* domain, Z3_sort range) {
@ -44,7 +44,7 @@ extern "C" {
sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, params.size(), params.c_ptr());
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_select(Z3_context c, Z3_ast a, Z3_ast i) {
@ -58,7 +58,7 @@ extern "C" {
sort * i_ty = m.get_sort(_i);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * domain[2] = {a_ty, i_ty};
func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_SELECT, 2, a_ty->get_parameters(), 2, domain);
@ -67,7 +67,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_select_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs) {
@ -81,7 +81,7 @@ extern "C" {
// sort * i_ty = m.get_sort(_i);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<sort> domain;
ptr_vector<expr> args;
@ -96,7 +96,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_store(Z3_context c, Z3_ast a, Z3_ast i, Z3_ast v) {
@ -112,7 +112,7 @@ extern "C" {
sort * v_ty = m.get_sort(_v);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * domain[3] = {a_ty, i_ty, v_ty};
func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_STORE, 2, a_ty->get_parameters(), 3, domain);
@ -121,7 +121,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_store_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs, Z3_ast v) {
@ -135,7 +135,7 @@ extern "C" {
sort * v_ty = m.get_sort(_v);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<sort> domain;
ptr_vector<expr> args;
@ -152,7 +152,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_map(Z3_context c, Z3_func_decl f, unsigned n, Z3_ast const* args) {
@ -161,7 +161,7 @@ extern "C" {
RESET_ERROR_CODE();
if (n == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast_manager & m = mk_c(c)->m();
func_decl* _f = to_func_decl(f);
@ -177,7 +177,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_const_array(Z3_context c, Z3_sort domain, Z3_ast v) {
@ -196,7 +196,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_array_default(Z3_context c, Z3_ast array) {
@ -206,12 +206,12 @@ extern "C" {
ast_manager & m = mk_c(c)->m();
expr * _a = to_expr(array);
func_decl * f = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_ARRAY_DEFAULT, 0, 0, 1, &_a);
func_decl * f = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_ARRAY_DEFAULT, 0, nullptr, 1, &_a);
app * r = m.mk_app(f, 1, &_a);
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast mk_app_array_core(Z3_context c, Z3_sort domain, Z3_ast v) {
@ -233,7 +233,7 @@ extern "C" {
Z3_sort Z3_API Z3_mk_set_sort(Z3_context c, Z3_sort ty) {
Z3_TRY;
return Z3_mk_array_sort(c, ty, Z3_mk_bool_sort(c));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_empty_set(Z3_context c, Z3_sort domain) {
@ -242,7 +242,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_app_array_core(c, domain, Z3_mk_false(c));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_full_set(Z3_context c, Z3_sort domain) {
@ -251,7 +251,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_app_array_core(c, domain, Z3_mk_true(c));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_NARY(Z3_mk_set_union, mk_c(c)->get_array_fid(), OP_SET_UNION, SKIP);
@ -270,7 +270,7 @@ extern "C" {
app * r = a.mk_as_array(to_func_decl(f));
mk_c(c)->save_ast_trail(r);
return of_ast(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_mk_set_member(Z3_context c, Z3_ast elem, Z3_ast set) {
@ -289,22 +289,22 @@ extern "C" {
Z3_TRY;
LOG_Z3_get_array_sort_domain(c, t);
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
CHECK_VALID_AST(t, nullptr);
if (to_sort(t)->get_family_id() == mk_c(c)->get_array_fid() &&
to_sort(t)->get_decl_kind() == ARRAY_SORT) {
Z3_sort r = reinterpret_cast<Z3_sort>(to_sort(t)->get_parameter(0).get_ast());
RETURN_Z3(r);
}
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
Z3_CATCH_RETURN(0);
RETURN_Z3(nullptr);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_array_sort_range(Z3_context c, Z3_sort t) {
Z3_TRY;
LOG_Z3_get_array_sort_range(c, t);
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
CHECK_VALID_AST(t, nullptr);
if (to_sort(t)->get_family_id() == mk_c(c)->get_array_fid() &&
to_sort(t)->get_decl_kind() == ARRAY_SORT) {
unsigned n = to_sort(t)->get_num_parameters();
@ -312,8 +312,8 @@ extern "C" {
RETURN_Z3(r);
}
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
Z3_CATCH_RETURN(0);
RETURN_Z3(nullptr);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -49,11 +49,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i < 0 || (size_t)i >= (SIZE_MAX >> PTR_ALIGNMENT)) {
SET_ERROR_CODE(Z3_IOB);
return 0;
return nullptr;
}
Z3_symbol result = of_symbol(symbol(i));
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_symbol Z3_API Z3_mk_string_symbol(Z3_context c, char const * str) {
@ -61,13 +61,13 @@ extern "C" {
LOG_Z3_mk_string_symbol(c, str);
RESET_ERROR_CODE();
symbol s;
if (str == 0 || *str == 0)
if (str == nullptr || *str == 0)
s = symbol::null;
else
s = symbol(str);
Z3_symbol result = of_symbol(s);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_eq_sort(Z3_context c, Z3_sort s1, Z3_sort s2) {
@ -82,7 +82,7 @@ extern "C" {
sort* ty = mk_c(c)->m().mk_uninterpreted_sort(to_symbol(name));
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_eq_ast(Z3_context c, Z3_ast s1, Z3_ast s2) {
@ -107,7 +107,7 @@ extern "C" {
mk_c(c)->save_ast_trail(d);
RETURN_Z3(of_func_decl(d));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const * args) {
@ -123,7 +123,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_const(Z3_context c, Z3_symbol s, Z3_sort ty) {
@ -133,7 +133,7 @@ extern "C" {
app* a = mk_c(c)->m().mk_const(mk_c(c)->m().mk_const_decl(to_symbol(s), to_sort(ty)));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -142,7 +142,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_mk_fresh_func_decl(c, prefix, domain_size, domain, range);
RESET_ERROR_CODE();
if (prefix == 0) {
if (prefix == nullptr) {
prefix = "";
}
@ -153,20 +153,20 @@ extern "C" {
mk_c(c)->save_ast_trail(d);
RETURN_Z3(of_func_decl(d));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fresh_const(Z3_context c, const char * prefix, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fresh_const(c, prefix, ty);
RESET_ERROR_CODE();
if (prefix == 0) {
if (prefix == nullptr) {
prefix = "";
}
app* a = mk_c(c)->m().mk_fresh_const(prefix, to_sort(ty));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_true(Z3_context c) {
@ -175,7 +175,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = of_ast(mk_c(c)->m().mk_true());
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_false(Z3_context c) {
@ -184,7 +184,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = of_ast(mk_c(c)->m().mk_false());
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_UNARY(Z3_mk_not, mk_c(c)->get_basic_fid(), OP_NOT, SKIP);
@ -210,7 +210,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_ite_core(c, t1, t2, t3);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_bool_sort(Z3_context c) {
@ -219,7 +219,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->m().get_basic_family_id(), BOOL_SORT));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_app_to_ast(Z3_context c, Z3_app a) {
@ -335,7 +335,7 @@ extern "C" {
Z3_bool Z3_API Z3_is_app(Z3_context c, Z3_ast a) {
LOG_Z3_is_app(c, a);
RESET_ERROR_CODE();
return a != 0 && is_app(reinterpret_cast<ast*>(a));
return a != nullptr && is_app(reinterpret_cast<ast*>(a));
}
Z3_app Z3_API Z3_to_app(Z3_context c, Z3_ast a) {
@ -357,7 +357,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_app(reinterpret_cast<ast*>(a))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_func_decl(to_app(a)->get_decl()));
}
@ -373,11 +373,11 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_app(reinterpret_cast<ast*>(a))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (i >= to_app(a)->get_num_args()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_ast(to_app(a)->get_arg(i)));
}
@ -466,15 +466,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
return 0;
return nullptr;
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_symbol()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
return of_symbol(p.get_symbol());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_decl_sort_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -483,15 +483,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_ast() || !is_sort(p.get_ast())) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_sort(to_sort(p.get_ast())));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_decl_ast_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -500,15 +500,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_ast()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_ast(p.get_ast()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_decl_func_decl_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -517,15 +517,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_ast() || !is_func_decl(p.get_ast())) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_func_decl(to_func_decl(p.get_ast())));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_get_decl_rational_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -551,17 +551,17 @@ extern "C" {
LOG_Z3_get_sort_name(c, t);
RESET_ERROR_CODE();
return of_symbol(to_sort(t)->get_name());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a) {
Z3_TRY;
LOG_Z3_get_sort(c, a);
RESET_ERROR_CODE();
CHECK_IS_EXPR(a, 0);
CHECK_IS_EXPR(a, nullptr);
Z3_sort r = of_sort(mk_c(c)->m().get_sort(to_expr(a)));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_arity(Z3_context c, Z3_func_decl d) {
@ -586,21 +586,21 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_func_decl(d)->get_arity()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_sort r = of_sort(to_func_decl(d)->get_domain(i));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_range(Z3_context c, Z3_func_decl d) {
Z3_TRY;
LOG_Z3_get_range(c, d);
RESET_ERROR_CODE();
CHECK_VALID_AST(d, 0);
CHECK_VALID_AST(d, nullptr);
Z3_sort r = of_sort(to_func_decl(d)->get_range());
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort_kind Z3_get_sort_kind(Z3_context c, Z3_sort t) {
@ -688,17 +688,17 @@ extern "C" {
}
catch (z3_exception & ex) {
mk_c(c)->handle_exception(ex);
return 0;
return nullptr;
}
}
mk_c(c)->save_ast_trail(result);
return of_ast(result.get());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_simplify(Z3_context c, Z3_ast _a) {
LOG_Z3_simplify(c, _a);
RETURN_Z3(simplify(c, _a, 0));
RETURN_Z3(simplify(c, _a, nullptr));
}
Z3_ast Z3_API Z3_simplify_ex(Z3_context c, Z3_ast _a, Z3_params p) {
@ -727,7 +727,7 @@ extern "C" {
th_rewriter::get_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_update_term(Z3_context c, Z3_ast _a, unsigned num_args, Z3_ast const _args[]) {
@ -762,7 +762,7 @@ extern "C" {
}
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_substitute(Z3_context c,
@ -777,11 +777,11 @@ extern "C" {
expr * a = to_expr(_a);
expr * const * from = to_exprs(_from);
expr * const * to = to_exprs(_to);
expr * r = 0;
expr * r = nullptr;
for (unsigned i = 0; i < num_exprs; i++) {
if (m.get_sort(from[i]) != m.get_sort(to[i])) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(of_expr(0));
RETURN_Z3(of_expr(nullptr));
}
SASSERT(from[i]->get_ref_count() > 0);
SASSERT(to[i]->get_ref_count() > 0);
@ -795,7 +795,7 @@ extern "C" {
mk_c(c)->save_ast_trail(new_a);
r = new_a.get();
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_substitute_vars(Z3_context c,
@ -813,7 +813,7 @@ extern "C" {
subst(a, num_exprs, to, new_a);
mk_c(c)->save_ast_trail(new_a);
RETURN_Z3(of_expr(new_a.get()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_API char const * Z3_ast_to_string(Z3_context c, Z3_ast a) {
@ -839,7 +839,7 @@ extern "C" {
UNREACHABLE();
}
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_API char const * Z3_sort_to_string(Z3_context c, Z3_sort s) {
@ -1233,17 +1233,17 @@ extern "C" {
Z3_TRY;
LOG_Z3_translate(c, a, target);
RESET_ERROR_CODE();
CHECK_VALID_AST(a, 0);
CHECK_VALID_AST(a, nullptr);
if (c == target) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
SASSERT(mk_c(c)->m().contains(to_ast(a)));
ast_translation translator(mk_c(c)->m(), mk_c(target)->m());
ast * _result = translator(to_ast(a));
mk_c(target)->save_ast_trail(_result);
RETURN_Z3(of_ast(_result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -38,7 +38,7 @@ extern "C" {
mk_c(c)->save_object(m);
Z3_ast_map r = of_ast_map(m);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_map_inc_ref(Z3_context c, Z3_ast_map m) {
@ -70,15 +70,15 @@ extern "C" {
LOG_Z3_ast_map_find(c, m, k);
RESET_ERROR_CODE();
obj_map<ast, ast*>::obj_map_entry * entry = to_ast_map_ref(m).find_core(to_ast(k));
if (entry == 0) {
if (entry == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
else {
ast * r = entry->get_data().m_value;
RETURN_Z3(of_ast(r));
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_map_insert(Z3_context c, Z3_ast_map m, Z3_ast k, Z3_ast v) {
@ -115,7 +115,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_ast_map_erase(c, m, k);
RESET_ERROR_CODE();
ast * v = 0;
ast * v = nullptr;
if (to_ast_map_ref(m).find(to_ast(k), v)) {
to_ast_map_ref(m).erase(to_ast(k));
ast_manager & mng = to_ast_map(m)->m;
@ -146,7 +146,7 @@ extern "C" {
}
Z3_ast_vector r = of_ast_vector(v);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_ast_map_to_string(Z3_context c, Z3_ast_map m) {
@ -163,7 +163,7 @@ extern "C" {
}
buffer << ")";
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -33,7 +33,7 @@ extern "C" {
mk_c(c)->save_object(v);
Z3_ast_vector r = of_ast_vector(v);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_vector_inc_ref(Z3_context c, Z3_ast_vector v) {
@ -66,12 +66,12 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_ast_vector_ref(v).size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
// Remark: Don't need to invoke save_object.
ast * r = to_ast_vector_ref(v).get(i);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_vector_set(Z3_context c, Z3_ast_vector v, unsigned i, Z3_ast a) {
@ -108,7 +108,7 @@ extern "C" {
RESET_ERROR_CODE();
if (c == t) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast_translation translator(mk_c(c)->m(), mk_c(t)->m());
Z3_ast_vector_ref * new_v = alloc(Z3_ast_vector_ref, *mk_c(t), mk_c(t)->m());
@ -119,7 +119,7 @@ extern "C" {
new_v->m_ast_vector.push_back(new_ast);
}
RETURN_Z3(of_ast_vector(new_v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_ast_vector_to_string(Z3_context c, Z3_ast_vector v) {
@ -134,7 +134,7 @@ extern "C" {
}
buffer << ")";
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -33,7 +33,7 @@ extern "C" {
parameter p(sz);
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->get_bv_fid(), BV_SORT, 1, &p));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
#define MK_BV_UNARY(NAME, OP) MK_UNARY(NAME, mk_c(c)->get_bv_fid(), OP, SKIP)
@ -85,7 +85,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_extract_core(c, high, low, n);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
#define MK_BV_PUNARY(NAME, OP) \
@ -146,7 +146,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
check_sorts(c, a);
RETURN_Z3(of_ast(a));
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
/**
@ -164,7 +164,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
unsigned sz = Z3_get_bv_sort_size(c, s);
if (sz == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
Z3_ast x = Z3_mk_int64(c, 1, s);
Z3_inc_ref(c, x);
@ -174,7 +174,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, x);
Z3_dec_ref(c, y);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_mk_bvsmin(Z3_context c, Z3_sort s) {
@ -229,7 +229,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, r);
return result;
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// only for signed machine integers
@ -257,7 +257,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, args_neg);
Z3_dec_ref(c, zero);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// only for signed machine integers
@ -286,7 +286,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, z);
Z3_dec_ref(c, zero);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvsub_no_underflow(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_bool is_signed) {
@ -311,7 +311,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
else {
return Z3_mk_bvule(c, t2, t1);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvmul_no_overflow(Z3_context c, Z3_ast n1, Z3_ast n2, Z3_bool is_signed) {
@ -336,11 +336,11 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_TRY;
RESET_ERROR_CODE();
Z3_ast min = Z3_mk_bvsmin(c, Z3_get_sort(c, t));
if (Z3_get_error_code(c) != Z3_OK) return 0;
if (Z3_get_error_code(c) != Z3_OK) return nullptr;
Z3_ast eq = Z3_mk_eq(c, t, min);
if (Z3_get_error_code(c) != Z3_OK) return 0;
if (Z3_get_error_code(c) != Z3_OK) return nullptr;
return Z3_mk_not(c, eq);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// only for signed machine integers
@ -366,7 +366,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, z);
Z3_dec_ref(c, u);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvsub(Z3_context c, Z3_ast n1, Z3_ast n2) {
@ -374,7 +374,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
LOG_Z3_mk_bvsub(c, n1, n2);
RESET_ERROR_CODE();
MK_BINARY_BODY(Z3_mk_bvsub, mk_c(c)->get_bv_fid(), OP_BSUB, SKIP);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvneg(Z3_context c, Z3_ast n) {
@ -382,7 +382,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
LOG_Z3_mk_bvneg(c, n);
RESET_ERROR_CODE();
MK_UNARY_BODY(Z3_mk_bvneg, mk_c(c)->get_bv_fid(), OP_BNEG, SKIP);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_bv_sort_size(Z3_context c, Z3_sort t) {

View file

@ -53,7 +53,7 @@ extern "C" {
Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) {
memory::initialize(UINT_MAX);
LOG_Z3_global_param_get(param_id, param_value);
*param_value = 0;
*param_value = nullptr;
try {
g_Z3_global_param_get_buffer = gparams::get_value(param_id);
*param_value = g_Z3_global_param_get_buffer.c_str();

View file

@ -70,7 +70,7 @@ namespace api {
// ------------------------
context::context(context_params * p, bool user_ref_count):
m_params(p != 0 ? *p : context_params()),
m_params(p != nullptr ? *p : context_params()),
m_user_ref_count(user_ref_count),
m_manager(m_params.mk_ast_manager()),
m_plugins(m()),
@ -89,7 +89,7 @@ namespace api {
m_searching = false;
m_interruptable = 0;
m_interruptable = nullptr;
m_error_handler = &default_error_handler;
m_basic_fid = m().get_basic_family_id();
@ -108,7 +108,7 @@ namespace api {
context::~context() {
m_last_obj = 0;
m_last_obj = nullptr;
u_map<api::object*>::iterator it = m_allocated_objects.begin();
while (it != m_allocated_objects.end()) {
api::object* val = it->m_value;
@ -131,7 +131,7 @@ namespace api {
context::set_interruptable::~set_interruptable() {
#pragma omp critical (set_interruptable)
{
m_ctx.m_interruptable = 0;
m_ctx.m_interruptable = nullptr;
}
}
@ -175,7 +175,7 @@ namespace api {
}
expr * context::mk_numeral_core(rational const & n, sort * s) {
expr* e = 0;
expr* e = nullptr;
family_id fid = s->get_family_id();
if (fid == m_arith_fid) {
e = m_arith_util.mk_numeral(n, s);
@ -239,7 +239,7 @@ namespace api {
void context::reset_last_result() {
if (m_user_ref_count)
m_last_result.reset();
m_last_obj = 0;
m_last_obj = nullptr;
}
void context::save_object(object * r) {
@ -313,7 +313,7 @@ namespace api {
//
// -----------------------
realclosure::manager & context::rcfm() {
if (m_rcf_manager.get() == 0) {
if (m_rcf_manager.get() == nullptr) {
m_rcf_manager = alloc(realclosure::manager, m_limit, m_rcf_qm);
}
return *(m_rcf_manager.get());
@ -336,7 +336,7 @@ extern "C" {
memory::initialize(UINT_MAX);
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), false));
RETURN_Z3(r);
Z3_CATCH_RETURN_NO_HANDLE(0);
Z3_CATCH_RETURN_NO_HANDLE(nullptr);
}
Z3_context Z3_API Z3_mk_context_rc(Z3_config c) {
@ -345,7 +345,7 @@ extern "C" {
memory::initialize(UINT_MAX);
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), true));
RETURN_Z3(r);
Z3_CATCH_RETURN_NO_HANDLE(0);
Z3_CATCH_RETURN_NO_HANDLE(nullptr);
}
void Z3_API Z3_del_context(Z3_context c) {
@ -459,7 +459,7 @@ extern "C" {
case Z3_INTERNAL_FATAL: return "internal error";
case Z3_INVALID_USAGE: return "invalid usage";
case Z3_DEC_REF_ERROR: return "invalid dec_ref command";
case Z3_EXCEPTION: return c == 0 ? "Z3 exception" : mk_c(c)->get_exception_msg();
case Z3_EXCEPTION: return c == nullptr ? "Z3 exception" : mk_c(c)->get_exception_msg();
default: return "unknown";
}
}

View file

@ -45,9 +45,9 @@ namespace api {
ast_ref_vector m_trail;
public:
fixedpoint_context(ast_manager& m, smt_params& p):
m_state(0),
m_reduce_app(0),
m_reduce_assign(0),
m_state(nullptr),
m_reduce_app(nullptr),
m_reduce_assign(nullptr),
m_context(m, m_register_engine, p),
m_trail(m) {}
@ -74,7 +74,7 @@ namespace api {
m_reduce_assign = f;
}
void reduce(func_decl* f, unsigned num_args, expr * const* args, expr_ref& result) override {
expr* r = 0;
expr* r = nullptr;
if (m_reduce_app) {
m_reduce_app(m_state, f, num_args, args, &r);
result = r;
@ -85,7 +85,7 @@ namespace api {
m_trail.push_back(r);
}
// allow fallthrough.
if (r == 0) {
if (r == nullptr) {
ast_manager& m = m_context.get_manager();
result = m.mk_app(f, num_args, args);
}
@ -171,22 +171,22 @@ extern "C" {
sort * r = to_sort(s);
if (Z3_get_sort_kind(c, s) != Z3_RELATION_SORT) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (col >= r->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = r->get_parameter(col);
if (!p.is_ast() || !is_sort(p.get_ast())) {
UNREACHABLE();
warning_msg("Sort parameter expected at %d", col);
SET_ERROR_CODE(Z3_INTERNAL_FATAL);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_sort res = of_sort(to_sort(p.get_ast()));
RETURN_Z3(res);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_finite_domain_sort(Z3_context c, Z3_symbol name, __uint64 size) {
@ -196,7 +196,7 @@ extern "C" {
sort* s = mk_c(c)->datalog_util().mk_sort(to_symbol(name), size);
mk_c(c)->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, __uint64 * out) {
@ -228,7 +228,7 @@ extern "C" {
mk_c(c)->save_object(d);
Z3_fixedpoint r = of_datalog(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_inc_ref(Z3_context c, Z3_fixedpoint s) {
@ -331,7 +331,7 @@ extern "C" {
expr* e = to_fixedpoint_ref(d)->ctx().get_answer_as_formula();
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_fixedpoint_get_reason_unknown(Z3_context c,Z3_fixedpoint d) {
@ -366,7 +366,7 @@ extern "C" {
ctx.set_ignore_check(true);
if (!parse_smt2_commands(ctx, s)) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
return 0;
return nullptr;
}
Z3_ast_vector_ref* v = alloc(Z3_ast_vector_ref, *mk_c(c), m);
@ -398,7 +398,7 @@ extern "C" {
std::string str(s);
std::istringstream is(str);
RETURN_Z3(Z3_fixedpoint_from_stream(c, d, is));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_fixedpoint_from_file(
@ -410,10 +410,10 @@ extern "C" {
std::ifstream is(s);
if (!is) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(Z3_fixedpoint_from_stream(c, d, is));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -426,7 +426,7 @@ extern "C" {
mk_c(c)->save_object(st);
Z3_stats r = of_stats(st);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_register_relation(Z3_context c,Z3_fixedpoint d, Z3_func_decl f) {
@ -473,7 +473,7 @@ extern "C" {
v->m_ast_vector.push_back(m.mk_not(queries[i].get()));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_fixedpoint_get_assertions(
@ -490,7 +490,7 @@ extern "C" {
v->m_ast_vector.push_back(to_fixedpoint_ref(d)->ctx().get_assertion(i));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_set_reduce_assign_callback(
@ -541,7 +541,7 @@ extern "C" {
expr_ref r = to_fixedpoint_ref(d)->get_cover_delta(level, to_func_decl(pred));
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r.get()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_add_cover(Z3_context c, Z3_fixedpoint d, int level, Z3_func_decl pred, Z3_ast property) {
@ -573,7 +573,7 @@ extern "C" {
to_fixedpoint_ref(f)->collect_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_set_params(Z3_context c, Z3_fixedpoint d, Z3_params p) {

View file

@ -37,7 +37,7 @@ namespace api {
struct Z3_fixedpoint_ref : public api::object {
api::fixedpoint_context * m_datalog;
params_ref m_params;
Z3_fixedpoint_ref(api::context& c): api::object(c), m_datalog(0) {}
Z3_fixedpoint_ref(api::context& c): api::object(c), m_datalog(nullptr) {}
~Z3_fixedpoint_ref() override { dealloc(m_datalog); }
};

View file

@ -49,7 +49,7 @@ Notes:
expr* e = to_fixedpoint_ref(d)->ctx().get_ground_sat_answer();
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_fixedpoint_get_rules_along_trace(
@ -69,7 +69,7 @@ Notes:
v->m_ast_vector.push_back(rules[i].get());
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_symbol Z3_API Z3_fixedpoint_get_rule_names_along_trace(
@ -90,7 +90,7 @@ Notes:
ss << ";" << names[i].str();
}
RETURN_Z3(of_symbol(symbol(ss.str().substr(1).c_str())));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_add_invariant(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred, Z3_ast property) {
@ -108,6 +108,6 @@ Notes:
expr_ref r = to_fixedpoint_ref(d)->ctx().get_reachable(to_func_decl(pred));
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r.get()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -52,12 +52,12 @@ extern "C" {
{
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 1, constrs);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, 0, tuples);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, nullptr, tuples);
del_datatype_decl(dt);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
@ -82,7 +82,7 @@ extern "C" {
proj_decls[i] = of_func_decl(_accs[i]);
}
RETURN_Z3_mk_tuple_sort(of_sort(tuple));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_enumeration_sort(Z3_context c,
@ -108,18 +108,18 @@ extern "C" {
recognizer_s += e_name.str();
symbol recognizer(recognizer_s.c_str());
constrs.push_back(mk_constructor_decl(e_name, recognizer, 0, 0));
constrs.push_back(mk_constructor_decl(e_name, recognizer, 0, nullptr));
}
{
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, 0, n, constrs.c_ptr());
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, 0, sorts);
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, n, constrs.c_ptr());
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, nullptr, sorts);
del_datatype_decl(dt);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
@ -143,7 +143,7 @@ extern "C" {
}
RETURN_Z3_mk_enumeration_sort(of_sort(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_list_sort(Z3_context c,
@ -168,7 +168,7 @@ extern "C" {
mk_accessor_decl(m, symbol("tail"), type_ref(0))
};
constructor_decl* constrs[2] = {
mk_constructor_decl(symbol("nil"), symbol("is_nil"), 0, 0),
mk_constructor_decl(symbol("nil"), symbol("is_nil"), 0, nullptr),
// Leo: SMT 2.0 document uses 'insert' instead of cons
mk_constructor_decl(symbol("cons"), symbol("is_cons"), 2, head_tail)
};
@ -176,12 +176,12 @@ extern "C" {
sort_ref_vector sorts(m);
{
datatype_decl * decl = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 2, constrs);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &decl, 0, 0, sorts);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &decl, 0, nullptr, sorts);
del_datatype_decl(decl);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
sort * s = sorts.get(0);
@ -225,7 +225,7 @@ extern "C" {
*tail_decl = of_func_decl(f);
}
RETURN_Z3_mk_list_sort(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
struct constructor {
@ -259,7 +259,7 @@ extern "C" {
cnstr->m_sort_refs.push_back(sort_refs[i]);
}
RETURN_Z3(reinterpret_cast<Z3_constructor>(cnstr));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -349,12 +349,12 @@ extern "C" {
sort_ref_vector sorts(m);
{
datatype_decl * data = mk_datatype_decl(c, name, num_constructors, constructors);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &data, 0, 0, sorts);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &data, 0, nullptr, sorts);
del_datatype_decl(data);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
sort * s = sorts.get(0);
@ -367,7 +367,7 @@ extern "C" {
cn->m_constructor = cnstrs[i];
}
RETURN_Z3_mk_datatype(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
typedef ptr_vector<constructor> constructor_list;
@ -383,7 +383,7 @@ extern "C" {
result->push_back(reinterpret_cast<constructor*>(constructors[i]));
}
RETURN_Z3(reinterpret_cast<Z3_constructor_list>(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_del_constructor_list(Z3_context c, Z3_constructor_list clist) {
@ -412,7 +412,7 @@ extern "C" {
datas.push_back(mk_datatype_decl(c, sort_names[i], cl->size(), reinterpret_cast<Z3_constructor*>(cl->c_ptr())));
}
sort_ref_vector _sorts(m);
bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.c_ptr(), 0, 0, _sorts);
bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.c_ptr(), 0, nullptr, _sorts);
del_datatype_decls(datas.size(), datas.c_ptr());
if (!ok) {
@ -454,17 +454,17 @@ extern "C" {
Z3_func_decl get_datatype_sort_constructor_core(Z3_context c, Z3_sort t, unsigned idx) {
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
CHECK_VALID_AST(t, nullptr);
sort * _t = to_sort(t);
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
if (idx >= decls.size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
func_decl* decl = (decls)[idx];
mk_c(c)->save_ast_trail(decl);
@ -477,7 +477,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_func_decl r = get_datatype_sort_constructor_core(c, t, idx);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_datatype_sort_recognizer(Z3_context c, Z3_sort t, unsigned idx) {
@ -489,18 +489,18 @@ extern "C" {
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
if (idx >= decls.size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
func_decl* decl = (decls)[idx];
decl = dt_util.get_constructor_recognizer(decl);
mk_c(c)->save_ast_trail(decl);
RETURN_Z3(of_func_decl(decl));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_datatype_sort_constructor_accessor(Z3_context c, Z3_sort t, unsigned idx_c, unsigned idx_a) {
@ -512,28 +512,28 @@ extern "C" {
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
if (idx_c >= decls.size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
func_decl* decl = (decls)[idx_c];
if (decl->get_arity() <= idx_a) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors(decl);
SASSERT(accs.size() == decl->get_arity());
if (accs.size() <= idx_a) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
decl = (accs)[idx_a];
mk_c(c)->save_ast_trail(decl);
RETURN_Z3(of_func_decl(decl));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_tuple_sort_mk_decl(Z3_context c, Z3_sort t) {
@ -544,11 +544,11 @@ extern "C" {
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_func_decl r = get_datatype_sort_constructor_core(c, t, 0);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_tuple_sort_num_fields(Z3_context c, Z3_sort t) {
@ -579,22 +579,22 @@ extern "C" {
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(tuple);
if (decls.size() != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors((decls)[0]);
if (accs.size() <= i) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
func_decl* acc = (accs)[i];
mk_c(c)->save_ast_trail(acc);
RETURN_Z3(of_func_decl(acc));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_datatype_update_field(
@ -614,7 +614,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -56,7 +56,7 @@ extern "C" {
sort * s = ctx->fpautil().mk_rm_sort();
mk_c(c)->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_nearest_ties_to_even(Z3_context c) {
@ -67,7 +67,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_even();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rne(Z3_context c) {
@ -78,7 +78,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_even();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_nearest_ties_to_away(Z3_context c) {
@ -89,7 +89,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_away();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rna(Z3_context c) {
@ -100,7 +100,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_away();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_positive(Z3_context c) {
@ -111,7 +111,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_positive();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rtp(Z3_context c) {
@ -122,7 +122,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_positive();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_negative(Z3_context c) {
@ -133,7 +133,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_negative();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rtn(Z3_context c) {
@ -144,7 +144,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_negative();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_zero(Z3_context c) {
@ -155,7 +155,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_zero();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rtz(Z3_context c) {
@ -166,7 +166,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_zero();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -181,7 +181,7 @@ extern "C" {
sort * s = ctx->fpautil().mk_float_sort(ebits, sbits);
ctx->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_fpa_sort_half(Z3_context c) {
@ -220,50 +220,50 @@ extern "C" {
Z3_TRY;
LOG_Z3_mk_fpa_nan(c, s);
RESET_ERROR_CODE();
CHECK_VALID_AST(s, 0);
CHECK_VALID_AST(s, nullptr);
if (!is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_nan(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_inf(Z3_context c, Z3_sort s, Z3_bool negative) {
Z3_TRY;
LOG_Z3_mk_fpa_inf(c, s, negative);
RESET_ERROR_CODE();
CHECK_VALID_AST(s, 0);
CHECK_VALID_AST(s, nullptr);
if (!is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = negative != 0 ? ctx->fpautil().mk_ninf(to_sort(s)) :
ctx->fpautil().mk_pinf(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_zero(Z3_context c, Z3_sort s, Z3_bool negative) {
Z3_TRY;
LOG_Z3_mk_fpa_inf(c, s, negative);
RESET_ERROR_CODE();
CHECK_VALID_AST(s, 0);
CHECK_VALID_AST(s, nullptr);
if (!is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = negative != 0 ? ctx->fpautil().mk_nzero(to_sort(s)) :
ctx->fpautil().mk_pzero(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_fp(Z3_context c, Z3_ast sgn, Z3_ast exp, Z3_ast sig) {
@ -272,13 +272,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_bv(c, sgn) || !is_bv(c, exp) || !is_bv(c, sig)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_fp(to_expr(sgn), to_expr(exp), to_expr(sig));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_float(Z3_context c, float v, Z3_sort ty) {
@ -287,7 +287,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -298,7 +298,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_double(Z3_context c, double v, Z3_sort ty) {
@ -307,7 +307,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -315,7 +315,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int(Z3_context c, signed v, Z3_sort ty) {
@ -324,7 +324,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -335,7 +335,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int_uint(Z3_context c, Z3_bool sgn, signed exp, unsigned sig, Z3_sort ty) {
@ -344,7 +344,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -355,7 +355,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, __int64 exp, __uint64 sig, Z3_sort ty) {
@ -364,7 +364,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -375,7 +375,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_abs(Z3_context c, Z3_ast t) {
@ -384,13 +384,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_abs(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_neg(Z3_context c, Z3_ast t) {
@ -399,13 +399,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_neg(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_add(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -414,13 +414,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_add(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_sub(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -429,13 +429,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_sub(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_mul(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -444,13 +444,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_mul(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_div(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -459,13 +459,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_div(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_fma(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2, Z3_ast t3) {
@ -474,13 +474,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2) || !is_fp(c, t3)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_fma(to_expr(rm), to_expr(t1), to_expr(t2), to_expr(t3));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_sqrt(Z3_context c, Z3_ast rm, Z3_ast t) {
@ -489,13 +489,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_sqrt(to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rem(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -504,13 +504,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_rem(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_to_integral(Z3_context c, Z3_ast rm, Z3_ast t) {
@ -519,13 +519,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_to_integral(to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_min(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -534,13 +534,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_min(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_max(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -549,13 +549,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_max(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_leq(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -564,13 +564,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_le(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_lt(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -579,13 +579,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_lt(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_geq(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -594,13 +594,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_ge(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_gt(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -609,13 +609,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_gt(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_eq(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -624,13 +624,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_float_eq(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_normal(Z3_context c, Z3_ast t) {
@ -639,13 +639,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_normal(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_subnormal(Z3_context c, Z3_ast t) {
@ -654,13 +654,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_subnormal(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_zero(Z3_context c, Z3_ast t) {
@ -669,13 +669,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_zero(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_infinite(Z3_context c, Z3_ast t) {
@ -684,13 +684,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_inf(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_nan(Z3_context c, Z3_ast t) {
@ -699,13 +699,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_nan(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_negative(Z3_context c, Z3_ast t) {
@ -714,13 +714,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_negative(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_positive(Z3_context c, Z3_ast t) {
@ -729,13 +729,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_positive(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -745,19 +745,19 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_bv(c, bv) || !is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!ctx->bvutil().is_bv(to_expr(bv)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(bv));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_float(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -770,12 +770,12 @@ extern "C" {
!fu.is_float(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_real(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -788,12 +788,12 @@ extern "C" {
!ctx->autil().is_real(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_signed(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -806,12 +806,12 @@ extern "C" {
!ctx->bvutil().is_bv(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_unsigned(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -824,12 +824,12 @@ extern "C" {
!ctx->bvutil().is_bv(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp_unsigned(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_ubv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz) {
@ -838,13 +838,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_ubv(to_expr(rm), to_expr(t), sz);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_sbv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz) {
@ -853,13 +853,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_sbv(to_expr(rm), to_expr(t), sz);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_real(Z3_context c, Z3_ast t) {
@ -868,13 +868,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_real(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_fpa_get_ebits(Z3_context c, Z3_sort s) {
@ -911,7 +911,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
if (sgn == 0) {
if (sgn == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
@ -939,8 +939,8 @@ extern "C" {
Z3_TRY;
LOG_Z3_fpa_get_numeral_sign_bv(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
family_id fid = mk_c(c)->get_fpa_fid();
@ -949,13 +949,13 @@ extern "C" {
expr * e = to_expr(t);
if (!is_app(e) || is_app_of(e, fid, OP_FPA_NAN) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(to_expr(t), val);
if (!r || mpfm.is_nan(val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
app * a;
if (mpfm.is_pos(val))
@ -964,15 +964,15 @@ extern "C" {
a = ctx->bvutil().mk_numeral(1, 1);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_fpa_get_numeral_significand_bv(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_significand_bv(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
@ -982,13 +982,13 @@ extern "C" {
expr * e = to_expr(t);
if (!is_app(e) || is_app_of(e, fid, OP_FPA_NAN) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(e, val);
if (!r || !(mpfm.is_normal(val) || mpfm.is_denormal(val) || mpfm.is_zero(val) || mpfm.is_inf(val))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
unsigned sbits = val.get().get_sbits();
scoped_mpq q(mpqm);
@ -997,15 +997,15 @@ extern "C" {
app * a = mk_c(c)->bvutil().mk_numeral(q.get(), sbits-1);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_fpa_get_numeral_significand_string(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_significand_string(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
@ -1041,7 +1041,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
if (n == 0) {
if (n == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
@ -1076,8 +1076,8 @@ extern "C" {
Z3_TRY;
LOG_Z3_fpa_get_numeral_exponent_string(c, t, biased);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
family_id fid = mk_c(c)->get_fpa_fid();
@ -1119,7 +1119,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
if (n == 0) {
if (n == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
@ -1161,8 +1161,8 @@ extern "C" {
Z3_TRY;
LOG_Z3_fpa_get_numeral_exponent_bv(c, t, biased);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
family_id fid = mk_c(c)->get_fpa_fid();
@ -1170,13 +1170,13 @@ extern "C" {
expr * e = to_expr(t);
if (!is_app(e) || is_app_of(e, fid, OP_FPA_NAN) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(e, val);
if (!r || !(mpfm.is_normal(val) || mpfm.is_denormal(val) || mpfm.is_zero(val) || mpfm.is_inf(val))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
unsigned ebits = val.get().get_ebits();
mpf_exp_t exp;
@ -1194,23 +1194,23 @@ extern "C" {
app * a = mk_c(c)->bvutil().mk_numeral(exp, ebits);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_ieee_bv(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_to_ieee_bv(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
Z3_ast r = of_ast(ctx->fpautil().mk_to_ieee_bv(to_expr(t)));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_int_real(Z3_context c, Z3_ast rm, Z3_ast exp, Z3_ast sig, Z3_sort s) {
@ -1224,12 +1224,12 @@ extern "C" {
!ctx->autil().is_real(to_expr(sig)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(exp), to_expr(sig));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_fpa_is_numeral_nan(Z3_context c, Z3_ast t) {

View file

@ -30,14 +30,14 @@ extern "C" {
RESET_ERROR_CODE();
if (proofs != 0 && !mk_c(c)->m().proofs_enabled()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_goal_ref * g = alloc(Z3_goal_ref, *mk_c(c));
g->m_goal = alloc(goal, mk_c(c)->m(), proofs != 0, models != 0, unsat_cores != 0);
mk_c(c)->save_object(g);
Z3_goal r = of_goal(g);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_goal_inc_ref(Z3_context c, Z3_goal g) {
@ -119,12 +119,12 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_goal_ref(g)->size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * result = to_goal_ref(g)->form(idx);
mk_c(c)->save_ast_trail(result);
RETURN_Z3(of_ast(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_goal_num_exprs(Z3_context c, Z3_goal g) {
@ -161,7 +161,7 @@ extern "C" {
mk_c(target)->save_object(_r);
Z3_goal r = of_goal(_r);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_goal_to_string(Z3_context c, Z3_goal g) {

View file

@ -29,6 +29,6 @@ struct Z3_goal_ref : public api::object {
inline Z3_goal_ref * to_goal(Z3_goal g) { return reinterpret_cast<Z3_goal_ref *>(g); }
inline Z3_goal of_goal(Z3_goal_ref * g) { return reinterpret_cast<Z3_goal>(g); }
inline goal_ref to_goal_ref(Z3_goal g) { return g == 0 ? goal_ref() : to_goal(g)->m_goal; }
inline goal_ref to_goal_ref(Z3_goal g) { return g == nullptr ? goal_ref() : to_goal(g)->m_goal; }
#endif

View file

@ -110,7 +110,7 @@ extern "C" {
pre_parents_vec,
interpolants,
theory_vec,
0); // ignore params for now FIXME
nullptr); // ignore params for now FIXME
// copy result back
for (unsigned i = 0; i < interpolants.size(); i++){
@ -174,7 +174,7 @@ extern "C" {
itp_vec,
theory_vec);
*error = res ? 0 : itp_err.str().c_str();
*error = res ? nullptr : itp_err.str().c_str();
return res;
}
@ -227,7 +227,7 @@ extern "C" {
cnsts,
_pat,
interp,
(interpolation_options_struct *)0 // ignore params for now
(interpolation_options_struct *)nullptr // ignore params for now
);
// copy result back
@ -236,7 +236,7 @@ extern "C" {
_m.dec_ref(interp[i]);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_lbool Z3_API Z3_compute_interpolant(Z3_context c, Z3_ast pat, Z3_params p, Z3_ast_vector *out_interp, Z3_model *model){
@ -283,7 +283,7 @@ extern "C" {
cnsts,
interp,
m,
0 // ignore params for now
nullptr // ignore params for now
);
}
catch (z3_exception & ex) {
@ -297,8 +297,8 @@ extern "C" {
Z3_lbool status = of_lbool(_status);
Z3_ast_vector_ref *v = 0;
*model = 0;
Z3_ast_vector_ref *v = nullptr;
*model = nullptr;
if (_status == l_false){
// copy result back
@ -510,7 +510,7 @@ extern "C" {
read_error.clear();
try {
std::string foo(filename);
Z3_ast assrts = Z3_parse_smtlib2_file(ctx, filename, 0, 0, 0, 0, 0, 0);
Z3_ast assrts = Z3_parse_smtlib2_file(ctx, filename, 0, nullptr, nullptr, 0, nullptr, nullptr);
Z3_app app = Z3_to_app(ctx, assrts);
int nconjs = Z3_get_app_num_args(ctx, app);
assertions.resize(nconjs);
@ -523,7 +523,7 @@ extern "C" {
*error = read_msg.c_str();
return false;
}
Z3_set_error_handler(ctx, 0);
Z3_set_error_handler(ctx, nullptr);
return true;
}
@ -571,7 +571,7 @@ extern "C" {
hash_map<Z3_ast, int> pred_map;
for (unsigned j = 0; j < num; j++){
Z3_ast lhs = 0, rhs = read_cnsts[j];
Z3_ast lhs = nullptr, rhs = read_cnsts[j];
if (Z3_get_decl_kind(ctx, Z3_get_app_decl(ctx, Z3_to_app(ctx, rhs))) == Z3_OP_IMPLIES){
Z3_app app1 = Z3_to_app(ctx, rhs);

View file

@ -21,15 +21,15 @@ Revision History:
#include "util/util.h"
#include "util/version.h"
std::ostream * g_z3_log = 0;
std::ostream * g_z3_log = nullptr;
bool g_z3_log_enabled = false;
extern "C" {
void Z3_close_log_unsafe(void) {
if (g_z3_log != 0) {
if (g_z3_log != nullptr) {
dealloc(g_z3_log);
g_z3_log_enabled = false;
g_z3_log = 0;
g_z3_log = nullptr;
}
}
@ -40,12 +40,12 @@ extern "C" {
#pragma omp critical (z3_log)
{
#endif
if (g_z3_log != 0)
if (g_z3_log != nullptr)
Z3_close_log_unsafe();
g_z3_log = alloc(std::ofstream, filename);
if (g_z3_log->bad() || g_z3_log->fail()) {
dealloc(g_z3_log);
g_z3_log = 0;
g_z3_log = nullptr;
res = Z3_FALSE;
}
else {
@ -61,13 +61,13 @@ extern "C" {
}
void Z3_API Z3_append_log(Z3_string str) {
if (g_z3_log == 0)
if (g_z3_log == nullptr)
return;
#ifdef Z3_LOG_SYNC
#pragma omp critical (z3_log)
{
#endif
if (g_z3_log != 0)
if (g_z3_log != nullptr)
_Z3_append_log(static_cast<char const *>(str));
#ifdef Z3_LOG_SYNC
}
@ -75,7 +75,7 @@ extern "C" {
}
void Z3_API Z3_close_log(void) {
if (g_z3_log != 0) {
if (g_z3_log != nullptr) {
#ifdef Z3_LOG_SYNC
#pragma omp critical (z3_log)
{

View file

@ -38,7 +38,7 @@ extern "C" {
m_ref->m_model = alloc(model, mk_c(c)->m());
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_model_inc_ref(Z3_context c, Z3_model m) {
@ -65,14 +65,14 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_get_const_interp(c, m, a);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
expr * r = to_model_ref(m)->get_const_interp(to_func_decl(a));
if (!r) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_model_has_interp(Z3_context c, Z3_model m, Z3_func_decl a) {
@ -91,17 +91,17 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_get_func_interp(c, m, f);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
func_interp * _fi = to_model_ref(m)->get_func_interp(to_func_decl(f));
if (!_fi) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_func_interp_ref * fi = alloc(Z3_func_interp_ref, *mk_c(c), to_model_ref(m));
fi->m_func_interp = _fi;
mk_c(c)->save_object(fi);
RETURN_Z3(of_func_interp(fi));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_model_get_num_consts(Z3_context c, Z3_model m) {
@ -117,16 +117,16 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_get_const_decl(c, m, i);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
model * _m = to_model_ref(m);
if (i < _m->get_num_constants()) {
RETURN_Z3(of_func_decl(_m->get_constant(i)));
}
else {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_model_get_num_funcs(Z3_context c, Z3_model m) {
@ -139,11 +139,11 @@ extern "C" {
}
Z3_func_decl get_model_func_decl_core(Z3_context c, Z3_model m, unsigned i) {
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
model * _m = to_model_ref(m);
if (i >= _m->get_num_functions()) {
SET_ERROR_CODE(Z3_IOB);
return 0;
return nullptr;
}
return of_func_decl(_m->get_function(i));
}
@ -154,13 +154,13 @@ extern "C" {
RESET_ERROR_CODE();
Z3_func_decl r = get_model_func_decl_core(c, m, i);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_model_eval(Z3_context c, Z3_model m, Z3_ast t, Z3_bool model_completion, Z3_ast * v) {
Z3_TRY;
LOG_Z3_model_eval(c, m, t, model_completion, v);
if (v) *v = 0;
if (v) *v = nullptr;
RESET_ERROR_CODE();
CHECK_NON_NULL(m, Z3_FALSE);
CHECK_IS_EXPR(t, Z3_FALSE);
@ -187,11 +187,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_model_ref(m)->get_num_uninterpreted_sorts()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * s = to_model_ref(m)->get_uninterpreted_sort(i);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_model_get_sort_universe(Z3_context c, Z3_model m, Z3_sort s) {
@ -200,7 +200,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!to_model_ref(m)->has_uninterpreted_sort(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<expr> const & universe = to_model_ref(m)->get_universe(to_sort(s));
Z3_ast_vector_ref * v = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m());
@ -210,7 +210,7 @@ extern "C" {
v->m_ast_vector.push_back(universe[i]);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_model Z3_API Z3_model_translate(Z3_context c, Z3_model m, Z3_context target) {
@ -222,7 +222,7 @@ extern "C" {
dst->m_model = to_model_ref(m)->translate(tr);
mk_c(target)->save_object(dst);
RETURN_Z3(of_model(dst));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_as_array(Z3_context c, Z3_ast a) {
@ -242,9 +242,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_interp Z3_API Z3_add_func_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast else_val) {
@ -259,7 +259,7 @@ extern "C" {
mdl->register_decl(d, f_ref->m_func_interp);
f_ref->m_func_interp->set_else(to_expr(else_val));
RETURN_Z3(of_func_interp(f_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_add_const_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast a) {
@ -310,30 +310,30 @@ extern "C" {
Z3_TRY;
LOG_Z3_func_interp_get_entry(c, f, i);
RESET_ERROR_CODE();
CHECK_NON_NULL(f, 0);
CHECK_NON_NULL(f, nullptr);
if (i >= to_func_interp_ref(f)->num_entries()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_func_entry_ref * e = alloc(Z3_func_entry_ref, *mk_c(c), to_func_interp(f)->m_model.get());
e->m_func_interp = to_func_interp_ref(f);
e->m_func_entry = to_func_interp_ref(f)->get_entry(i);
mk_c(c)->save_object(e);
RETURN_Z3(of_func_entry(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_func_interp_get_else(Z3_context c, Z3_func_interp f) {
Z3_TRY;
LOG_Z3_func_interp_get_else(c, f);
RESET_ERROR_CODE();
CHECK_NON_NULL(f, 0);
CHECK_NON_NULL(f, nullptr);
expr * e = to_func_interp_ref(f)->get_else();
if (e) {
mk_c(c)->save_ast_trail(e);
}
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_func_interp_set_else(Z3_context c, Z3_func_interp f, Z3_ast else_value) {
@ -399,7 +399,7 @@ extern "C" {
expr * v = to_func_entry_ref(e)->get_result();
mk_c(c)->save_ast_trail(v);
RETURN_Z3(of_expr(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_func_entry_get_num_args(Z3_context c, Z3_func_entry e) {
@ -416,11 +416,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_func_entry(e)->m_func_interp->get_arity()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * r = to_func_entry(e)->m_func_entry->get_arg(i);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// ----------------------------
@ -491,7 +491,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_to_string(c, m);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
std::ostringstream buffer;
std::string result;
if (mk_c(c)->get_print_mode() == Z3_PRINT_SMTLIB2_COMPLIANT) {
@ -507,7 +507,7 @@ extern "C" {
result = buffer.str();
}
return mk_c(c)->mk_external_string(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -34,7 +34,7 @@ inline model * to_model_ref(Z3_model s) { return to_model(s)->m_model.get(); }
struct Z3_func_interp_ref : public api::object {
model_ref m_model; // must have it to prevent reference to m_func_interp to be killed.
func_interp * m_func_interp;
Z3_func_interp_ref(api::context& c, model * m): api::object(c), m_model(m), m_func_interp(0) {}
Z3_func_interp_ref(api::context& c, model * m): api::object(c), m_model(m), m_func_interp(nullptr) {}
~Z3_func_interp_ref() override {}
};
@ -46,7 +46,7 @@ struct Z3_func_entry_ref : public api::object {
model_ref m_model; // must have it to prevent reference to m_func_entry to be killed.
func_interp * m_func_interp;
func_entry const * m_func_entry;
Z3_func_entry_ref(api::context& c, model * m):api::object(c), m_model(m), m_func_interp(0), m_func_entry(0) {}
Z3_func_entry_ref(api::context& c, model * m):api::object(c), m_model(m), m_func_interp(nullptr), m_func_entry(nullptr) {}
~Z3_func_entry_ref() override {}
};

View file

@ -52,11 +52,11 @@ extern "C" {
LOG_Z3_mk_numeral(c, n, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (!n) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * _ty = to_sort(ty);
bool is_float = mk_c(c)->fpautil().is_float(_ty);
@ -73,11 +73,11 @@ extern "C" {
('P' == *m) ||
('+' == *m))))) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
++m;
}
ast * a = 0;
ast * a = nullptr;
if (_ty->get_family_id() == mk_c(c)->get_fpa_fid()) {
// avoid expanding floats into huge rationals.
fpa_util & fu = mk_c(c)->fpautil();
@ -89,7 +89,7 @@ extern "C" {
else
a = mk_c(c)->mk_numeral_core(rational(n), _ty);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_int(Z3_context c, int value, Z3_sort ty) {
@ -97,11 +97,11 @@ extern "C" {
LOG_Z3_mk_int(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast * a = mk_c(c)->mk_numeral_core(rational(value), to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned value, Z3_sort ty) {
@ -109,11 +109,11 @@ extern "C" {
LOG_Z3_mk_unsigned_int(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast * a = mk_c(c)->mk_numeral_core(rational(value), to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_int64(Z3_context c, long long value, Z3_sort ty) {
@ -121,12 +121,12 @@ extern "C" {
LOG_Z3_mk_int64(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
rational n(value, rational::i64());
ast* a = mk_c(c)->mk_numeral_core(n, to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, unsigned long long value, Z3_sort ty) {
@ -134,12 +134,12 @@ extern "C" {
LOG_Z3_mk_unsigned_int64(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
rational n(value, rational::ui64());
ast * a = mk_c(c)->mk_numeral_core(n, to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_numeral_ast(Z3_context c, Z3_ast a) {
@ -397,7 +397,7 @@ extern "C" {
}
ast * a = mk_c(c)->mk_numeral_core(r, mk_c(c)->bvutil().mk_sort(sz));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -35,7 +35,7 @@ extern "C" {
struct Z3_optimize_ref : public api::object {
opt::context* m_opt;
Z3_optimize_ref(api::context& c): api::object(c), m_opt(0) {}
Z3_optimize_ref(api::context& c): api::object(c), m_opt(nullptr) {}
~Z3_optimize_ref() override { dealloc(m_opt); }
};
inline Z3_optimize_ref * to_optimize(Z3_optimize o) { return reinterpret_cast<Z3_optimize_ref *>(o); }
@ -50,7 +50,7 @@ extern "C" {
o->m_opt = alloc(opt::context,mk_c(c)->m());
mk_c(c)->save_object(o);
RETURN_Z3(of_optimize(o));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_optimize_inc_ref(Z3_context c, Z3_optimize o) {
@ -171,7 +171,7 @@ extern "C" {
}
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_optimize_set_params(Z3_context c, Z3_optimize o, Z3_params p) {
@ -195,7 +195,7 @@ extern "C" {
to_optimize_ptr(o)->collect_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get lower value or current approximation
@ -206,7 +206,7 @@ extern "C" {
expr_ref e = to_optimize_ptr(o)->get_lower(idx);
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get upper or current approximation
@ -217,7 +217,7 @@ extern "C" {
expr_ref e = to_optimize_ptr(o)->get_upper(idx);
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get lower value or current approximation
@ -231,7 +231,7 @@ extern "C" {
mk_c(c)->save_object(v);
v->m_ast_vector.append(es.size(), (ast*const*)es.c_ptr());
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get upper or current approximation
@ -245,7 +245,7 @@ extern "C" {
mk_c(c)->save_object(v);
v->m_ast_vector.append(es.size(), (ast*const*)es.c_ptr());
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_optimize_to_string(Z3_context c, Z3_optimize o) {
@ -277,7 +277,7 @@ extern "C" {
mk_c(c)->save_object(st);
Z3_stats r = of_stats(st);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
static void Z3_optimize_from_stream(
@ -367,7 +367,7 @@ extern "C" {
v->m_ast_vector.push_back(h);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_optimize_get_objectives(Z3_context c, Z3_optimize o) {
@ -381,7 +381,7 @@ extern "C" {
v->m_ast_vector.push_back(to_optimize_ptr(o)->get_objective(i));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -34,7 +34,7 @@ extern "C" {
mk_c(c)->save_object(p);
Z3_params r = of_params(p);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
/**
@ -172,11 +172,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_param_descrs_ptr(p)->size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_symbol result = of_symbol(to_param_descrs_ptr(p)->get_param_name(i));
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_param_descrs_get_documentation(Z3_context c, Z3_param_descrs p, Z3_symbol s) {
@ -184,12 +184,12 @@ extern "C" {
LOG_Z3_param_descrs_get_documentation(c, p, s);
RESET_ERROR_CODE();
char const* result = to_param_descrs_ptr(p)->get_descr(to_symbol(s));
if (result == 0) {
if (result == nullptr) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
return mk_c(c)->mk_external_string(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_param_descrs_to_string(Z3_context c, Z3_param_descrs p) {

View file

@ -80,7 +80,7 @@ extern "C" {
ptr_vector<expr>::const_iterator end = ctx->end_assertions();
unsigned size = static_cast<unsigned>(end - it);
return of_ast(mk_c(c)->mk_and(size, it));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_parse_smtlib2_string(Z3_context c, Z3_string str,
@ -96,7 +96,7 @@ extern "C" {
std::istringstream is(s);
Z3_ast r = parse_smtlib2_stream(false, c, is, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_parse_smtlib2_file(Z3_context c, Z3_string file_name,
@ -111,10 +111,10 @@ extern "C" {
std::ifstream is(file_name);
if (!is) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
return 0;
return nullptr;
}
Z3_ast r = parse_smtlib2_stream(false, c, is, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -34,7 +34,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_atleast(Z3_context c, unsigned num_args,
@ -48,7 +48,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_pble(Z3_context c, unsigned num_args,
@ -66,7 +66,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_pbge(Z3_context c, unsigned num_args,
@ -84,7 +84,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_pbeq(Z3_context c, unsigned num_args,
@ -102,7 +102,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -50,7 +50,7 @@ extern "C" {
if (!converter.to_polynomial(to_expr(p), _p, d) ||
!converter.to_polynomial(to_expr(q), _q, d)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
Z3_ast_vector_ref* result = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m());
mk_c(c)->save_object(result);
@ -74,7 +74,7 @@ extern "C" {
}
}
RETURN_Z3(of_ast_vector(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -56,7 +56,7 @@ extern "C"
app_ref_vector vars(mk_c(c)->m ());
if (!to_apps(num_bounds, bound, vars)) {
SET_ERROR_CODE (Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr_ref result (mk_c(c)->m ());
@ -66,7 +66,7 @@ extern "C"
mk_c(c)->save_ast_trail (result.get ());
return of_expr (result.get ());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_qe_model_project_skolem (Z3_context c,
@ -83,7 +83,7 @@ extern "C"
ast_manager& man = mk_c(c)->m ();
app_ref_vector vars(man);
if (!to_apps(num_bounds, bound, vars)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr_ref result (mk_c(c)->m ());
@ -103,7 +103,7 @@ extern "C"
}
return of_expr (result.get ());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_model_extrapolate (Z3_context c,
@ -130,7 +130,7 @@ extern "C"
mk_c(c)->save_ast_trail (result.get ());
return of_expr (result.get ());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_qe_lite (Z3_context c, Z3_ast_vector vars, Z3_ast body)
@ -145,7 +145,7 @@ extern "C"
app *a = to_app (vVars.get (i));
if (a->get_kind () != AST_APP) {
SET_ERROR_CODE (Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
vApps.push_back (a);
}
@ -167,7 +167,7 @@ extern "C"
mk_c(c)->save_ast_trail (result.get ());
return of_expr (result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
}

View file

@ -37,10 +37,10 @@ extern "C" {
c,
is_forall,
weight,
0,
0,
nullptr,
nullptr,
num_patterns, patterns,
0, 0,
0, nullptr,
num_decls, sorts,
decl_names,
body
@ -104,7 +104,7 @@ extern "C" {
}
mk_c(c)->save_ast_trail(result.get());
return of_ast(result.get());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_quantifier_ex(
@ -166,17 +166,17 @@ extern "C" {
ptr_vector<expr> bound_asts;
if (num_patterns > 0 && num_no_patterns > 0) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (num_bound == 0) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
for (unsigned i = 0; i < num_bound; ++i) {
app* a = to_app(bound[i]);
if (a->get_kind() != AST_APP) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
symbol s(to_app(a)->get_decl()->get_name());
names.push_back(of_symbol(s));
@ -184,7 +184,7 @@ extern "C" {
bound_asts.push_back(a);
if (a->get_family_id() != null_family_id || a->get_num_args() != 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
// Abstract patterns
@ -205,7 +205,7 @@ extern "C" {
expr_ref result(mk_c(c)->m());
if (!is_app(to_expr(no_patterns[i]))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
app* pat = to_app(to_expr(no_patterns[i]));
expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), pat, result);
@ -224,7 +224,7 @@ extern "C" {
names.size(), types.c_ptr(), names.c_ptr(),
of_ast(abs_body.get()));
RETURN_Z3(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_quantifier_const(Z3_context c,
@ -235,10 +235,10 @@ extern "C" {
unsigned num_patterns,
Z3_pattern const patterns[],
Z3_ast body) {
return Z3_mk_quantifier_const_ex(c, is_forall, weight, 0, 0,
return Z3_mk_quantifier_const_ex(c, is_forall, weight, nullptr, nullptr,
num_bound, bound,
num_patterns, patterns,
0, 0,
0, nullptr,
body);
}
@ -269,13 +269,13 @@ extern "C" {
for (unsigned i = 0; i < num_patterns; ++i) {
if (!is_app(to_expr(terms[i]))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
app* a = mk_c(c)->m().mk_pattern(num_patterns, reinterpret_cast<app*const*>(to_exprs(terms)));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_pattern(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bound(Z3_context c, unsigned index, Z3_sort ty) {
@ -285,7 +285,7 @@ extern "C" {
ast* a = mk_c(c)->m().mk_var(index, to_sort(ty));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_quantifier_forall(Z3_context c, Z3_ast a) {
@ -344,9 +344,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -376,9 +376,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_symbol Z3_API Z3_get_quantifier_bound_name(Z3_context c, Z3_ast a, unsigned i) {
@ -391,9 +391,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
return 0;
return nullptr;
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_quantifier_bound_sort(Z3_context c, Z3_ast a, unsigned i) {
@ -407,9 +407,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_quantifier_body(Z3_context c, Z3_ast a) {
@ -423,9 +423,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_quantifier_num_bound(Z3_context c, Z3_ast a) {
@ -470,9 +470,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_pattern_to_ast(Z3_context c, Z3_pattern p) {

View file

@ -62,7 +62,7 @@ extern "C" {
rcnumeral r;
rcfm(c).set(r, q);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_small_int(Z3_context c, int val) {
@ -73,7 +73,7 @@ extern "C" {
rcnumeral r;
rcfm(c).set(r, val);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_pi(Z3_context c) {
@ -84,7 +84,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mk_pi(r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_e(Z3_context c) {
@ -95,7 +95,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mk_e(r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_infinitesimal(Z3_context c) {
@ -106,7 +106,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mk_infinitesimal(r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_rcf_mk_roots(Z3_context c, unsigned n, Z3_rcf_num const a[], Z3_rcf_num roots[]) {
@ -145,7 +145,7 @@ extern "C" {
rcnumeral r;
rcfm(c).add(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_sub(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {
@ -156,7 +156,7 @@ extern "C" {
rcnumeral r;
rcfm(c).sub(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mul(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {
@ -167,7 +167,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mul(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_div(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {
@ -178,7 +178,7 @@ extern "C" {
rcnumeral r;
rcfm(c).div(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_neg(Z3_context c, Z3_rcf_num a) {
@ -189,7 +189,7 @@ extern "C" {
rcnumeral r;
rcfm(c).neg(to_rcnumeral(a), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_inv(Z3_context c, Z3_rcf_num a) {
@ -200,7 +200,7 @@ extern "C" {
rcnumeral r;
rcfm(c).inv(to_rcnumeral(a), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_power(Z3_context c, Z3_rcf_num a, unsigned k) {
@ -211,7 +211,7 @@ extern "C" {
rcnumeral r;
rcfm(c).power(to_rcnumeral(a), k, r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_rcf_lt(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {

View file

@ -31,7 +31,7 @@ extern "C" {
sort * ty = mk_c(c)->sutil().str.mk_seq(to_sort(domain));
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_re_sort(Z3_context c, Z3_sort domain) {
@ -41,7 +41,7 @@ extern "C" {
sort * ty = mk_c(c)->sutil().re.mk_re(to_sort(domain));
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_string(Z3_context c, Z3_string str) {
@ -52,7 +52,7 @@ extern "C" {
app* a = mk_c(c)->sutil().str.mk_string(s);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_string_sort(Z3_context c) {
@ -62,7 +62,7 @@ extern "C" {
sort* ty = mk_c(c)->sutil().str.mk_string_sort();
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_seq_sort(Z3_context c, Z3_sort s) {
@ -152,7 +152,7 @@ extern "C" {
app* a = hi == 0 ? mk_c(c)->sutil().re.mk_loop(to_expr(r), lo) : mk_c(c)->sutil().re.mk_loop(to_expr(r), lo, hi);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_UNARY(Z3_mk_re_plus, mk_c(c)->get_seq_fid(), OP_RE_PLUS, SKIP);

View file

@ -57,7 +57,7 @@ extern "C" {
}
static void init_solver(Z3_context c, Z3_solver s) {
if (to_solver(s)->m_solver.get() == 0)
if (to_solver(s)->m_solver.get() == nullptr)
init_solver_core(c, s);
}
@ -69,7 +69,7 @@ extern "C" {
mk_c(c)->save_object(s);
Z3_solver r = of_solver(s);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_mk_solver(Z3_context c) {
@ -80,7 +80,7 @@ extern "C" {
mk_c(c)->save_object(s);
Z3_solver r = of_solver(s);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_mk_solver_for_logic(Z3_context c, Z3_symbol logic) {
@ -91,7 +91,7 @@ extern "C" {
std::ostringstream strm;
strm << "logic '" << to_symbol(logic) << "' is not recognized";
throw default_exception(strm.str());
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
else {
Z3_solver_ref * s = alloc(Z3_solver_ref, *mk_c(c), mk_smt_strategic_solver_factory(to_symbol(logic)));
@ -99,7 +99,7 @@ extern "C" {
Z3_solver r = of_solver(s);
RETURN_Z3(r);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_mk_solver_from_tactic(Z3_context c, Z3_tactic t) {
@ -110,7 +110,7 @@ extern "C" {
mk_c(c)->save_object(s);
Z3_solver r = of_solver(s);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_solver_translate(Z3_context c, Z3_solver s, Z3_context target) {
@ -118,13 +118,13 @@ extern "C" {
LOG_Z3_solver_translate(c, s, target);
RESET_ERROR_CODE();
params_ref const& p = to_solver(s)->m_params;
Z3_solver_ref * sr = alloc(Z3_solver_ref, *mk_c(target), 0);
Z3_solver_ref * sr = alloc(Z3_solver_ref, *mk_c(target), nullptr);
init_solver(c, s);
sr->m_solver = to_solver(s)->m_solver->translate(mk_c(target)->m(), p);
mk_c(target)->save_object(sr);
Z3_solver r = of_solver(sr);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void solver_from_stream(Z3_context c, Z3_solver s, std::istream& is) {
@ -137,7 +137,7 @@ extern "C" {
return;
}
bool initialized = to_solver(s)->m_solver.get() != 0;
bool initialized = to_solver(s)->m_solver.get() != nullptr;
if (!initialized)
init_solver(c, s);
ptr_vector<expr>::const_iterator it = ctx->begin_assertions();
@ -190,13 +190,13 @@ extern "C" {
RESET_ERROR_CODE();
std::ostringstream buffer;
param_descrs descrs;
bool initialized = to_solver(s)->m_solver.get() != 0;
bool initialized = to_solver(s)->m_solver.get() != nullptr;
if (!initialized)
init_solver(c, s);
to_solver_ref(s)->collect_param_descrs(descrs);
context_params::collect_solver_param_descrs(descrs);
if (!initialized)
to_solver(s)->m_solver = 0;
to_solver(s)->m_solver = nullptr;
descrs.display(buffer);
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN("");
@ -208,16 +208,16 @@ extern "C" {
RESET_ERROR_CODE();
Z3_param_descrs_ref * d = alloc(Z3_param_descrs_ref, *mk_c(c));
mk_c(c)->save_object(d);
bool initialized = to_solver(s)->m_solver.get() != 0;
bool initialized = to_solver(s)->m_solver.get() != nullptr;
if (!initialized)
init_solver(c, s);
to_solver_ref(s)->collect_param_descrs(d->m_descrs);
context_params::collect_solver_param_descrs(d->m_descrs);
if (!initialized)
to_solver(s)->m_solver = 0;
to_solver(s)->m_solver = nullptr;
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_solver_set_params(Z3_context c, Z3_solver s, Z3_params p) {
@ -288,7 +288,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_solver_reset(c, s);
RESET_ERROR_CODE();
to_solver(s)->m_solver = 0;
to_solver(s)->m_solver = nullptr;
Z3_CATCH;
}
@ -334,7 +334,7 @@ extern "C" {
v->m_ast_vector.push_back(to_solver_ref(s)->get_assertion(i));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
static Z3_lbool _solver_check(Z3_context c, Z3_solver s, unsigned num_assumptions, Z3_ast const assumptions[]) {
@ -375,7 +375,7 @@ extern "C" {
LOG_Z3_solver_check(c, s);
RESET_ERROR_CODE();
init_solver(c, s);
return _solver_check(c, s, 0, 0);
return _solver_check(c, s, 0, nullptr);
Z3_CATCH_RETURN(Z3_L_UNDEF);
}
@ -397,13 +397,13 @@ extern "C" {
to_solver_ref(s)->get_model(_m);
if (!_m) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_model_ref * m_ref = alloc(Z3_model_ref, *mk_c(c));
m_ref->m_model = _m;
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_solver_get_proof(Z3_context c, Z3_solver s) {
@ -414,11 +414,11 @@ extern "C" {
proof * p = to_solver_ref(s)->get_proof();
if (!p) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
mk_c(c)->save_ast_trail(p);
RETURN_Z3(of_ast(p));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_solver_get_unsat_core(Z3_context c, Z3_solver s) {
@ -434,7 +434,7 @@ extern "C" {
v->m_ast_vector.push_back(core[i]);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_solver_get_reason_unknown(Z3_context c, Z3_solver s) {
@ -458,7 +458,7 @@ extern "C" {
mk_c(c)->save_object(st);
Z3_stats r = of_stats(st);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_solver_to_string(Z3_context c, Z3_solver s) {

View file

@ -26,7 +26,7 @@ struct Z3_solver_ref : public api::object {
ref<solver> m_solver;
params_ref m_params;
symbol m_logic;
Z3_solver_ref(api::context& c, solver_factory * f): api::object(c), m_solver_factory(f), m_solver(0), m_logic(symbol::null) {}
Z3_solver_ref(api::context& c, solver_factory * f): api::object(c), m_solver_factory(f), m_solver(nullptr), m_logic(symbol::null) {}
~Z3_solver_ref() override {}
};

View file

@ -51,13 +51,13 @@ extern "C" {
LOG_Z3_mk_tactic(c, name);
RESET_ERROR_CODE();
tactic_cmd * t = mk_c(c)->find_tactic_cmd(symbol(name));
if (t == 0) {
if (t == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
tactic * new_t = t->mk(mk_c(c)->m());
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_tactic_inc_ref(Z3_context c, Z3_tactic t) {
@ -81,13 +81,13 @@ extern "C" {
LOG_Z3_mk_probe(c, name);
RESET_ERROR_CODE();
probe_info * p = mk_c(c)->find_probe(symbol(name));
if (p == 0) {
if (p == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
probe * new_p = p->get();
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_probe_inc_ref(Z3_context c, Z3_probe p) {
@ -112,7 +112,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = and_then(to_tactic_ref(t1), to_tactic_ref(t2));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_or_else(Z3_context c, Z3_tactic t1, Z3_tactic t2) {
@ -121,7 +121,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = or_else(to_tactic_ref(t1), to_tactic_ref(t2));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_par_or(Z3_context c, unsigned num, Z3_tactic const ts[]) {
@ -134,7 +134,7 @@ extern "C" {
}
tactic * new_t = par(num, _ts.c_ptr());
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_par_and_then(Z3_context c, Z3_tactic t1, Z3_tactic t2) {
@ -143,7 +143,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = par_and_then(to_tactic_ref(t1), to_tactic_ref(t2));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_try_for(Z3_context c, Z3_tactic t, unsigned ms) {
@ -152,7 +152,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = try_for(to_tactic_ref(t), ms);
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_when(Z3_context c, Z3_probe p, Z3_tactic t) {
@ -161,7 +161,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = when(to_probe_ref(p), to_tactic_ref(t));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_cond(Z3_context c, Z3_probe p, Z3_tactic t1, Z3_tactic t2) {
@ -170,7 +170,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = cond(to_probe_ref(p), to_tactic_ref(t1), to_tactic_ref(t2));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_repeat(Z3_context c, Z3_tactic t, unsigned max) {
@ -179,7 +179,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = repeat(to_tactic_ref(t), max);
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_skip(Z3_context c) {
@ -188,7 +188,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = mk_skip_tactic();
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_fail(Z3_context c) {
@ -197,7 +197,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = mk_fail_tactic();
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_fail_if(Z3_context c, Z3_probe p) {
@ -206,7 +206,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = fail_if(to_probe_ref(p));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_fail_if_not_decided(Z3_context c) {
@ -215,7 +215,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = mk_fail_if_undecided_tactic();
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_using_params(Z3_context c, Z3_tactic t, Z3_params p) {
@ -227,7 +227,7 @@ extern "C" {
to_param_ref(p).validate(r);
tactic * new_t = using_params(to_tactic_ref(t), to_param_ref(p));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_const(Z3_context c, double val) {
@ -236,7 +236,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_const_probe(val);
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_lt(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -245,7 +245,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_lt(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_gt(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -254,7 +254,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_gt(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_le(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -263,7 +263,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_le(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_ge(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -272,7 +272,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_ge(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_eq(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -281,7 +281,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_eq(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_and(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -290,7 +290,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_and(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_or(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -299,7 +299,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_or(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_not(Z3_context c, Z3_probe p) {
@ -308,7 +308,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_not(to_probe_ref(p));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_num_tactics(Z3_context c) {
@ -372,7 +372,7 @@ extern "C" {
to_tactic_ref(t)->collect_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_tactic_get_descr(Z3_context c, Z3_string name) {
@ -380,7 +380,7 @@ extern "C" {
LOG_Z3_tactic_get_descr(c, name);
RESET_ERROR_CODE();
tactic_cmd * t = mk_c(c)->find_tactic_cmd(symbol(name));
if (t == 0) {
if (t == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
@ -393,7 +393,7 @@ extern "C" {
LOG_Z3_probe_get_descr(c, name);
RESET_ERROR_CODE();
probe_info * p = mk_c(c)->find_probe(symbol(name));
if (p == 0) {
if (p == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
@ -423,7 +423,7 @@ extern "C" {
}
catch (z3_exception & ex) {
mk_c(c)->handle_exception(ex);
return 0;
return nullptr;
}
}
}
@ -443,7 +443,7 @@ extern "C" {
params_ref p;
Z3_apply_result r = _tactic_apply(c, t, g, p);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_apply_result Z3_API Z3_tactic_apply_ex(Z3_context c, Z3_tactic t, Z3_goal g, Z3_params p) {
@ -455,7 +455,7 @@ extern "C" {
to_param_ref(p).validate(pd);
Z3_apply_result r = _tactic_apply(c, t, g, to_param_ref(p));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_apply_result_inc_ref(Z3_context c, Z3_apply_result r) {
@ -503,14 +503,14 @@ extern "C" {
RESET_ERROR_CODE();
if (i > to_apply_result(r)->m_subgoals.size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_goal_ref * g = alloc(Z3_goal_ref, *mk_c(c));
g->m_goal = to_apply_result(r)->m_subgoals[i];
mk_c(c)->save_object(g);
Z3_goal result = of_goal(g);
RETURN_Z3(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_model Z3_API Z3_apply_result_convert_model(Z3_context c, Z3_apply_result r, unsigned i, Z3_model m) {
@ -519,7 +519,7 @@ extern "C" {
RESET_ERROR_CODE();
if (i > to_apply_result(r)->m_subgoals.size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
model_ref new_m = to_model_ref(m)->copy();
if (to_apply_result(r)->m_mc)
@ -528,7 +528,7 @@ extern "C" {
m_ref->m_model = new_m;
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -40,11 +40,11 @@ struct Z3_probe_ref : public api::object {
inline Z3_tactic_ref * to_tactic(Z3_tactic g) { return reinterpret_cast<Z3_tactic_ref *>(g); }
inline Z3_tactic of_tactic(Z3_tactic_ref * g) { return reinterpret_cast<Z3_tactic>(g); }
inline tactic * to_tactic_ref(Z3_tactic g) { return g == 0 ? 0 : to_tactic(g)->m_tactic.get(); }
inline tactic * to_tactic_ref(Z3_tactic g) { return g == nullptr ? nullptr : to_tactic(g)->m_tactic.get(); }
inline Z3_probe_ref * to_probe(Z3_probe g) { return reinterpret_cast<Z3_probe_ref *>(g); }
inline Z3_probe of_probe(Z3_probe_ref * g) { return reinterpret_cast<Z3_probe>(g); }
inline probe * to_probe_ref(Z3_probe g) { return g == 0 ? 0 : to_probe(g)->m_probe.get(); }
inline probe * to_probe_ref(Z3_probe g) { return g == nullptr ? nullptr : to_probe(g)->m_probe.get(); }
struct Z3_apply_result_ref : public api::object {
goal_ref_buffer m_subgoals;

View file

@ -93,7 +93,7 @@ struct Z3_params_ref : public api::object {
inline Z3_params_ref * to_params(Z3_params p) { return reinterpret_cast<Z3_params_ref *>(p); }
inline Z3_params of_params(Z3_params_ref * p) { return reinterpret_cast<Z3_params>(p); }
inline params_ref to_param_ref(Z3_params p) { return p == 0 ? params_ref() : to_params(p)->m_params; }
inline params_ref to_param_ref(Z3_params p) { return p == nullptr ? params_ref() : to_params(p)->m_params; }
struct Z3_param_descrs_ref : public api::object {
param_descrs m_descrs;
@ -103,7 +103,7 @@ struct Z3_param_descrs_ref : public api::object {
inline Z3_param_descrs_ref * to_param_descrs(Z3_param_descrs p) { return reinterpret_cast<Z3_param_descrs_ref *>(p); }
inline Z3_param_descrs of_param_descrs(Z3_param_descrs_ref * p) { return reinterpret_cast<Z3_param_descrs>(p); }
inline param_descrs * to_param_descrs_ptr(Z3_param_descrs p) { return p == 0 ? 0 : &(to_param_descrs(p)->m_descrs); }
inline param_descrs * to_param_descrs_ptr(Z3_param_descrs p) { return p == nullptr ? nullptr : &(to_param_descrs(p)->m_descrs); }
#define SKIP ((void) 0)

View file

@ -430,10 +430,10 @@ struct z3_replayer::imp {
next(); skip_blank(); read_ptr();
TRACE("z3_replayer", tout << "[" << m_line << "] " << "P " << m_ptr << "\n";);
if (m_ptr == 0) {
m_args.push_back(0);
m_args.push_back(nullptr);
}
else {
void * obj = 0;
void * obj = nullptr;
if (!m_heap.find(m_ptr, obj))
throw z3_replayer_exception("invalid pointer");
m_args.push_back(value(obj));
@ -453,7 +453,7 @@ struct z3_replayer::imp {
// push null symbol
next();
TRACE("z3_replayer", tout << "[" << m_line << "] " << "N\n";);
m_args.push_back(value(SYMBOL, static_cast<char const *>(0)));
m_args.push_back(value(SYMBOL, static_cast<char const *>(nullptr)));
break;
case '$': {
// push symbol
@ -689,7 +689,7 @@ struct z3_replayer::imp {
}
void reset() {
m_result = 0;
m_result = nullptr;
m_args.reset();
m_obj_arrays.reset();
m_sym_arrays.reset();

View file

@ -187,8 +187,8 @@ void act_cache::insert(expr * k, expr * v) {
*/
expr * act_cache::find(expr * k) {
map::key_value * entry = m_table.find_core(k);
if (entry == 0)
return 0;
if (entry == nullptr)
return nullptr;
if (GET_TAG(entry->m_value) == 0) {
entry->m_value = TAG(expr*, entry->m_value, 1);
SASSERT(GET_TAG(entry->m_value) == 1);

View file

@ -65,7 +65,7 @@ struct arith_decl_plugin::algebraic_numbers_wrapper {
};
arith_decl_plugin::algebraic_numbers_wrapper & arith_decl_plugin::aw() const {
if (m_aw == 0)
if (m_aw == nullptr)
const_cast<arith_decl_plugin*>(this)->m_aw = alloc(algebraic_numbers_wrapper, m_manager->limit());
return *m_aw;
}
@ -100,7 +100,7 @@ app * arith_decl_plugin::mk_numeral(sexpr const * p, unsigned i) {
void arith_decl_plugin::del(parameter const & p) {
SASSERT(p.is_external());
if (m_aw != 0) {
if (m_aw != nullptr) {
aw().recycle_id(p.get_ext_id());
}
}
@ -222,56 +222,56 @@ void arith_decl_plugin::set_manager(ast_manager * m, family_id id) {
}
arith_decl_plugin::arith_decl_plugin():
m_aw(0),
m_aw(nullptr),
m_intv_sym("Int"),
m_realv_sym("Real"),
m_rootv_sym("RootObject"),
m_real_decl(0),
m_int_decl(0),
m_r_le_decl(0),
m_r_ge_decl(0),
m_r_lt_decl(0),
m_r_gt_decl(0),
m_r_add_decl(0),
m_r_sub_decl(0),
m_r_uminus_decl(0),
m_r_mul_decl(0),
m_r_div_decl(0),
m_i_le_decl(0),
m_i_ge_decl(0),
m_i_lt_decl(0),
m_i_gt_decl(0),
m_i_add_decl(0),
m_i_sub_decl(0),
m_i_uminus_decl(0),
m_i_mul_decl(0),
m_i_div_decl(0),
m_i_mod_decl(0),
m_i_rem_decl(0),
m_to_real_decl(0),
m_to_int_decl(0),
m_is_int_decl(0),
m_r_power_decl(0),
m_i_power_decl(0),
m_r_abs_decl(0),
m_i_abs_decl(0),
m_sin_decl(0),
m_cos_decl(0),
m_tan_decl(0),
m_asin_decl(0),
m_acos_decl(0),
m_atan_decl(0),
m_sinh_decl(0),
m_cosh_decl(0),
m_tanh_decl(0),
m_asinh_decl(0),
m_acosh_decl(0),
m_atanh_decl(0),
m_pi(0),
m_e(0),
m_neg_root_decl(0),
m_u_asin_decl(0),
m_u_acos_decl(0),
m_real_decl(nullptr),
m_int_decl(nullptr),
m_r_le_decl(nullptr),
m_r_ge_decl(nullptr),
m_r_lt_decl(nullptr),
m_r_gt_decl(nullptr),
m_r_add_decl(nullptr),
m_r_sub_decl(nullptr),
m_r_uminus_decl(nullptr),
m_r_mul_decl(nullptr),
m_r_div_decl(nullptr),
m_i_le_decl(nullptr),
m_i_ge_decl(nullptr),
m_i_lt_decl(nullptr),
m_i_gt_decl(nullptr),
m_i_add_decl(nullptr),
m_i_sub_decl(nullptr),
m_i_uminus_decl(nullptr),
m_i_mul_decl(nullptr),
m_i_div_decl(nullptr),
m_i_mod_decl(nullptr),
m_i_rem_decl(nullptr),
m_to_real_decl(nullptr),
m_to_int_decl(nullptr),
m_is_int_decl(nullptr),
m_r_power_decl(nullptr),
m_i_power_decl(nullptr),
m_r_abs_decl(nullptr),
m_i_abs_decl(nullptr),
m_sin_decl(nullptr),
m_cos_decl(nullptr),
m_tan_decl(nullptr),
m_asin_decl(nullptr),
m_acos_decl(nullptr),
m_atan_decl(nullptr),
m_sinh_decl(nullptr),
m_cosh_decl(nullptr),
m_tanh_decl(nullptr),
m_asinh_decl(nullptr),
m_acosh_decl(nullptr),
m_atanh_decl(nullptr),
m_pi(nullptr),
m_e(nullptr),
m_neg_root_decl(nullptr),
m_u_asin_decl(nullptr),
m_u_acos_decl(nullptr),
m_convert_int_numerals_to_real(false) {
}
@ -335,7 +335,7 @@ sort * arith_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, paramete
switch (k) {
case REAL_SORT: return m_real_decl;
case INT_SORT: return m_int_decl;
default: return 0;
default: return nullptr;
}
}
@ -380,7 +380,7 @@ inline func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, bool is_real) {
//case OP_MOD_0: return m_mod_0_decl;
case OP_U_ASIN: return m_u_asin_decl;
case OP_U_ACOS: return m_u_acos_decl;
default: return 0;
default: return nullptr;
}
}
@ -408,7 +408,7 @@ app * arith_decl_plugin::mk_numeral(rational const & val, bool is_int) {
if (u_val < MAX_SMALL_NUM_TO_CACHE) {
if (is_int && !m_convert_int_numerals_to_real) {
app * r = m_small_ints.get(u_val, 0);
if (r == 0) {
if (r == nullptr) {
parameter p[2] = { parameter(val), parameter(1) };
r = m_manager->mk_const(m_manager->mk_const_decl(m_intv_sym, m_int_decl, func_decl_info(m_family_id, OP_NUM, 2, p)));
m_manager->inc_ref(r);
@ -418,7 +418,7 @@ app * arith_decl_plugin::mk_numeral(rational const & val, bool is_int) {
}
else {
app * r = m_small_reals.get(u_val, 0);
if (r == 0) {
if (r == nullptr) {
parameter p[2] = { parameter(val), parameter(0) };
r = m_manager->mk_const(m_manager->mk_const_decl(m_realv_sym, m_real_decl, func_decl_info(m_family_id, OP_NUM, 2, p)));
m_manager->inc_ref(r);
@ -440,7 +440,7 @@ app * arith_decl_plugin::mk_numeral(rational const & val, bool is_int) {
func_decl * arith_decl_plugin::mk_num_decl(unsigned num_parameters, parameter const * parameters, unsigned arity) {
if (!(num_parameters == 2 && arity == 0 && parameters[0].is_rational() && parameters[1].is_int())) {
m_manager->raise_exception("invalid numeral declaration");
return 0;
return nullptr;
}
if (parameters[1].get_int() != 0)
return m_manager->mk_const_decl(m_intv_sym, m_int_decl, func_decl_info(m_family_id, OP_NUM, num_parameters, parameters));
@ -480,7 +480,7 @@ func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
return mk_num_decl(num_parameters, parameters, arity);
if (arity == 0 && !is_const_op(k)) {
m_manager->raise_exception("no arguments supplied to arithmetical operator");
return 0;
return nullptr;
}
if (m_manager->int_real_coercions() && use_coercion(k)) {
return mk_func_decl(fix_kind(k, arity), has_real_arg(arity, domain, m_real_decl));
@ -497,7 +497,7 @@ func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
return mk_num_decl(num_parameters, parameters, num_args);
if (num_args == 0 && !is_const_op(k)) {
m_manager->raise_exception("no arguments supplied to arithmetical operator");
return 0;
return nullptr;
}
if (m_manager->int_real_coercions() && use_coercion(k)) {
return mk_func_decl(fix_kind(k, num_args), has_real_arg(m_manager, num_args, args, m_real_decl));
@ -641,7 +641,7 @@ bool arith_recognizers::is_numeral(expr const * n, rational & val, bool & is_int
arith_util::arith_util(ast_manager & m):
arith_recognizers(m.mk_family_id("arith")),
m_manager(m),
m_plugin(0) {
m_plugin(nullptr) {
}
void arith_util::init_plugin() {

View file

@ -44,7 +44,7 @@ sort * array_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, paramete
if (k == _SET_SORT) {
if (num_parameters != 1) {
m_manager->raise_exception("invalid array sort definition, invalid number of parameters");
return 0;
return nullptr;
}
parameter params[2] = { parameters[0], parameter(m_manager->mk_bool_sort()) };
return mk_sort(ARRAY_SORT, 2, params);
@ -52,13 +52,13 @@ sort * array_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, paramete
SASSERT(k == ARRAY_SORT);
if (num_parameters < 2) {
m_manager->raise_exception("invalid array sort definition, invalid number of parameters");
return 0;
return nullptr;
}
for (unsigned i = 0; i < num_parameters; i++) {
if (!parameters[i].is_ast() || !is_sort(parameters[i].get_ast())) {
m_manager->raise_exception("invalid array sort definition, parameter is not a sort");
return 0;
return nullptr;
}
}
sort * range = to_sort(parameters[num_parameters - 1].get_ast());
@ -120,15 +120,15 @@ bool array_decl_plugin::is_array_sort(sort* s) const {
func_decl * array_decl_plugin::mk_const(sort * s, unsigned arity, sort * const * domain) {
if (arity != 1) {
m_manager->raise_exception("invalid const array definition, invalid domain size");
return 0;
return nullptr;
}
if (!is_array_sort(s)) {
m_manager->raise_exception("invalid const array definition, parameter is not an array sort");
return 0;
return nullptr;
}
if (!m_manager->compatible_sorts(get_array_range(s), domain[0])) {
m_manager->raise_exception("invalid const array definition, sort mismatch between array range and argument");
return 0;
return nullptr;
}
parameter param(s);
func_decl_info info(m_family_id, OP_CONST_ARRAY, 1, &param);
@ -142,11 +142,11 @@ func_decl * array_decl_plugin::mk_map(func_decl* f, unsigned arity, sort* const*
buffer << "map expects to take as many arguments as the function being mapped, "
<< "it was given " << arity << " but expects " << f->get_arity();
m_manager->raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
if (arity == 0) {
m_manager->raise_exception("don't use map on constants");
return 0;
return nullptr;
}
//
// check that each domain[i] is an array sort
@ -159,14 +159,14 @@ func_decl * array_decl_plugin::mk_map(func_decl* f, unsigned arity, sort* const*
std::ostringstream buffer;
buffer << "map expects an array sort as argument at position " << i;
m_manager->raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
if (get_array_arity(domain[i]) != dom_arity) {
std::ostringstream buffer;
buffer << "map expects all arguments to have the same array domain, "
<< "this is not the case for argument " << i;
m_manager->raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
for (unsigned j = 0; j < dom_arity; ++j) {
if (get_array_domain(domain[i],j) != get_array_domain(domain[0],j)) {
@ -174,7 +174,7 @@ func_decl * array_decl_plugin::mk_map(func_decl* f, unsigned arity, sort* const*
buffer << "map expects all arguments to have the same array domain, "
<< "this is not the case for argument " << i;
m_manager->raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
}
if (get_array_range(domain[i]) != f->get_domain(i)) {
@ -182,7 +182,7 @@ func_decl * array_decl_plugin::mk_map(func_decl* f, unsigned arity, sort* const*
buffer << "map expects the argument at position " << i
<< " to have the array range the same as the function";
m_manager->raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
}
vector<parameter> parameters;
@ -211,19 +211,19 @@ func_decl * array_decl_plugin::mk_map(func_decl* f, unsigned arity, sort* const*
func_decl * array_decl_plugin::mk_default(unsigned domain_size, sort * const * domain) {
if (domain_size != 1) {
m_manager->raise_exception("invalid default array definition, invalid domain size");
return 0;
return nullptr;
}
// check that domain[0] is an array sort.
unsigned num_parameters = domain[0]->get_num_parameters();
if (num_parameters <= 1) {
m_manager->raise_exception("parameter mismatch. There should be more than one parameter to defaults");
return 0;
return nullptr;
}
parameter param(domain[0]->get_parameter(num_parameters-1));
if (!param.is_ast() || !is_sort(param.get_ast())) {
m_manager->raise_exception("last parameter should be a sort");
return 0;
return nullptr;
}
sort * s = to_sort(param.get_ast());
@ -235,7 +235,7 @@ func_decl * array_decl_plugin::mk_default(unsigned domain_size, sort * const * d
func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) {
if (arity <= 1) {
m_manager->raise_exception("select takes at least two arguments");
return 0;
return nullptr;
}
sort * s = domain[0];
unsigned num_parameters = s->get_num_parameters();
@ -245,7 +245,7 @@ func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) {
std::stringstream strm;
strm << "select requires " << num_parameters << " arguments, but was provided with " << arity << " arguments";
m_manager->raise_exception(strm.str().c_str());
return 0;
return nullptr;
}
ptr_buffer<sort> new_domain; // we need this because of coercions.
new_domain.push_back(s);
@ -255,7 +255,7 @@ func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) {
!m_manager->compatible_sorts(domain[i+1], to_sort(parameters[i].get_ast()))) {
m_manager->raise_exception("domain sort and parameter do not match");
UNREACHABLE();
return 0;
return nullptr;
}
new_domain.push_back(to_sort(parameters[i].get_ast()));
}
@ -267,7 +267,7 @@ func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) {
func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) {
if (arity < 3) {
m_manager->raise_exception("store takes at least 3 arguments");
return 0;
return nullptr;
}
sort * s = domain[0];
unsigned num_parameters = s->get_num_parameters();
@ -275,7 +275,7 @@ func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) {
if (!is_array_sort(s)) {
m_manager->raise_exception("store expects the first argument sort to be an array");
UNREACHABLE();
return 0;
return nullptr;
}
if (arity != num_parameters+1) {
std::ostringstream buffer;
@ -283,19 +283,19 @@ func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) {
<< ", instead it was passed " << (arity - 1) << "arguments";
m_manager->raise_exception(buffer.str().c_str());
UNREACHABLE();
return 0;
return nullptr;
}
ptr_buffer<sort> new_domain; // we need this because of coercions.
new_domain.push_back(s);
for (unsigned i = 0; i < num_parameters; ++i) {
if (!parameters[i].is_ast() || !is_sort(parameters[i].get_ast())) {
m_manager->raise_exception("expecting sort parameter");
return 0;
return nullptr;
}
if (!m_manager->compatible_sorts(to_sort(parameters[i].get_ast()), domain[i+1])) {
m_manager->raise_exception("domain sort and parameter do not match");
UNREACHABLE();
return 0;
return nullptr;
}
new_domain.push_back(to_sort(parameters[i].get_ast()));
}
@ -307,13 +307,13 @@ func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) {
func_decl * array_decl_plugin::mk_array_ext(unsigned arity, sort * const * domain, unsigned i) {
if (arity != 2 || domain[0] != domain[1]) {
UNREACHABLE();
return 0;
return nullptr;
}
sort * s = domain[0];
unsigned num_parameters = s->get_num_parameters();
if (num_parameters == 0 || i >= num_parameters - 1) {
UNREACHABLE();
return 0;
return nullptr;
}
sort * r = to_sort(s->get_parameter(i).get_ast());
parameter param(i);
@ -362,11 +362,11 @@ func_decl * array_decl_plugin::mk_set_union(unsigned arity, sort * const * domai
if (arity == 0) {
m_manager->raise_exception("union takes at least one argument");
return 0;
return nullptr;
}
sort * s = domain[0];
if (!check_set_arguments(arity, domain)) {
return 0;
return nullptr;
}
parameter param(s);
func_decl_info info(m_family_id, OP_SET_UNION, 1, &param);
@ -381,10 +381,10 @@ func_decl * array_decl_plugin::mk_set_intersect(unsigned arity, sort * const * d
if (arity == 0) {
m_manager->raise_exception("intersection takes at least one argument");
return 0;
return nullptr;
}
if (!check_set_arguments(arity, domain)) {
return 0;
return nullptr;
}
func_decl_info info(m_family_id, OP_SET_INTERSECT);
info.set_associative();
@ -397,10 +397,10 @@ func_decl * array_decl_plugin::mk_set_intersect(unsigned arity, sort * const * d
func_decl * array_decl_plugin::mk_set_difference(unsigned arity, sort * const * domain) {
if (arity != 2) {
m_manager->raise_exception("set difference takes precisely two arguments");
return 0;
return nullptr;
}
if (!check_set_arguments(arity, domain)) {
return 0;
return nullptr;
}
return m_manager->mk_func_decl(m_set_difference_sym, arity, domain, domain[0],
func_decl_info(m_family_id, OP_SET_DIFFERENCE));
@ -409,10 +409,10 @@ func_decl * array_decl_plugin::mk_set_difference(unsigned arity, sort * const *
func_decl * array_decl_plugin::mk_set_complement(unsigned arity, sort * const * domain) {
if (arity != 1) {
m_manager->raise_exception("set complement takes one argument");
return 0;
return nullptr;
}
if (!check_set_arguments(arity, domain)) {
return 0;
return nullptr;
}
return m_manager->mk_func_decl(m_set_complement_sym, arity, domain, domain[0],
func_decl_info(m_family_id, OP_SET_COMPLEMENT));
@ -421,10 +421,10 @@ func_decl * array_decl_plugin::mk_set_complement(unsigned arity, sort * const *
func_decl * array_decl_plugin::mk_set_subset(unsigned arity, sort * const * domain) {
if (arity != 2) {
m_manager->raise_exception("subset takes two arguments");
return 0;
return nullptr;
}
if (!check_set_arguments(arity, domain)) {
return 0;
return nullptr;
}
sort * bool_sort = m_manager->mk_bool_sort();
return m_manager->mk_func_decl(m_set_subset_sym, arity, domain, bool_sort,
@ -456,20 +456,20 @@ func_decl * array_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
sort * s = to_sort(parameters[0].get_ast());
return mk_const(s, arity, domain);
}
else if (range != 0) {
else if (range != nullptr) {
return mk_const(range, arity, domain);
}
else {
m_manager->raise_exception("array operation requires one sort parameter (the array sort)");
UNREACHABLE();
return 0;
return nullptr;
}
}
case OP_ARRAY_MAP: {
if (num_parameters != 1 || !parameters[0].is_ast() || !is_func_decl(parameters[0].get_ast())) {
m_manager->raise_exception("array operation requires one function declaration parameter (the function to be mapped)");
UNREACHABLE();
return 0;
return nullptr;
}
func_decl * f = to_func_decl(parameters[0].get_ast());
return mk_map(f, arity, domain);
@ -480,7 +480,7 @@ func_decl * array_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
}
if (num_parameters != 1 || !parameters[0].is_int()) {
UNREACHABLE();
return 0;
return nullptr;
}
return mk_array_ext(arity, domain, parameters[0].get_int());
case OP_ARRAY_DEFAULT:
@ -506,12 +506,12 @@ func_decl * array_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
tout << "as-array-bug: " << to_func_decl(parameters[0].get_ast())->get_name() << " " << to_func_decl(parameters[0].get_ast())->get_arity() << std::endl;);
m_manager->raise_exception("as-array takes one parameter, a function declaration with arity greater than zero");
UNREACHABLE();
return 0;
return nullptr;
}
func_decl * f = to_func_decl(parameters[0].get_ast());
return mk_as_array(f);
}
default: return 0;
default: return nullptr;
}
}

View file

@ -161,11 +161,11 @@ public:
bool is_as_array_tree(expr * n);
app * mk_store(unsigned num_args, expr * const * args) {
return m_manager.mk_app(m_fid, OP_STORE, 0, 0, num_args, args);
return m_manager.mk_app(m_fid, OP_STORE, 0, nullptr, num_args, args);
}
app * mk_select(unsigned num_args, expr * const * args) {
return m_manager.mk_app(m_fid, OP_SELECT, 0, 0, num_args, args);
return m_manager.mk_app(m_fid, OP_SELECT, 0, nullptr, num_args, args);
}
app * mk_map(func_decl * f, unsigned num_args, expr * const * args) {
@ -191,7 +191,7 @@ public:
app * mk_as_array(func_decl * f) {
parameter param(f);
return m_manager.mk_app(m_fid, OP_AS_ARRAY, 1, &param, 0, 0, 0);
return m_manager.mk_app(m_fid, OP_AS_ARRAY, 1, &param, 0, nullptr, nullptr);
}
};

View file

@ -405,7 +405,7 @@ sort * get_sort(expr const * n) {
break;
default:
UNREACHABLE();
return 0;
return nullptr;
}
}
}
@ -434,18 +434,18 @@ bool compare_nodes(ast const * n1, ast const * n2) {
}
switch (n1->get_kind()) {
case AST_SORT:
if ((to_sort(n1)->get_info() == 0) != (to_sort(n2)->get_info() == 0)) {
if ((to_sort(n1)->get_info() == nullptr) != (to_sort(n2)->get_info() == nullptr)) {
return false;
}
if (to_sort(n1)->get_info() != 0 && !(*to_sort(n1)->get_info() == *to_sort(n2)->get_info())) {
if (to_sort(n1)->get_info() != nullptr && !(*to_sort(n1)->get_info() == *to_sort(n2)->get_info())) {
return false;
}
return to_sort(n1)->get_name() == to_sort(n2)->get_name();
case AST_FUNC_DECL:
if ((to_func_decl(n1)->get_info() == 0) != (to_func_decl(n2)->get_info() == 0)) {
if ((to_func_decl(n1)->get_info() == nullptr) != (to_func_decl(n2)->get_info() == nullptr)) {
return false;
}
if (to_func_decl(n1)->get_info() != 0 && !(*to_func_decl(n1)->get_info() == *to_func_decl(n2)->get_info())) {
if (to_func_decl(n1)->get_info() != nullptr && !(*to_func_decl(n1)->get_info() == *to_func_decl(n2)->get_info())) {
return false;
}
return
@ -549,13 +549,13 @@ unsigned get_node_hash(ast const * n) {
switch (n->get_kind()) {
case AST_SORT:
if (to_sort(n)->get_info() == 0)
if (to_sort(n)->get_info() == nullptr)
return to_sort(n)->get_name().hash();
else
return combine_hash(to_sort(n)->get_name().hash(), to_sort(n)->get_info()->hash());
case AST_FUNC_DECL:
return ast_array_hash(to_func_decl(n)->get_domain(), to_func_decl(n)->get_arity(),
to_func_decl(n)->get_info() == 0 ?
to_func_decl(n)->get_info() == nullptr ?
to_func_decl(n)->get_name().hash() : combine_hash(to_func_decl(n)->get_name().hash(), to_func_decl(n)->get_info()->hash()));
case AST_APP:
return ast_array_hash(to_app(n)->get_args(),
@ -587,13 +587,13 @@ void ast_table::erase(ast * n) {
unsigned idx = h & mask;
cell * c = m_table + idx;
SASSERT(!c->is_free());
cell * prev = 0;
cell * prev = nullptr;
while (true) {
if (c->m_data == n) {
m_size--;
if (prev == 0) {
if (prev == nullptr) {
cell * next = c->m_next;
if (next == 0) {
if (next == nullptr) {
m_used_slots--;
c->mark_free();
SASSERT(c->is_free());
@ -638,49 +638,49 @@ func_decl * decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, para
// -----------------------------------
basic_decl_plugin::basic_decl_plugin():
m_bool_sort(0),
m_true_decl(0),
m_false_decl(0),
m_and_decl(0),
m_or_decl(0),
m_iff_decl(0),
m_xor_decl(0),
m_not_decl(0),
m_interp_decl(0),
m_implies_decl(0),
m_bool_sort(nullptr),
m_true_decl(nullptr),
m_false_decl(nullptr),
m_and_decl(nullptr),
m_or_decl(nullptr),
m_iff_decl(nullptr),
m_xor_decl(nullptr),
m_not_decl(nullptr),
m_interp_decl(nullptr),
m_implies_decl(nullptr),
m_proof_sort(0),
m_undef_decl(0),
m_true_pr_decl(0),
m_asserted_decl(0),
m_goal_decl(0),
m_modus_ponens_decl(0),
m_reflexivity_decl(0),
m_symmetry_decl(0),
m_transitivity_decl(0),
m_quant_intro_decl(0),
m_and_elim_decl(0),
m_not_or_elim_decl(0),
m_rewrite_decl(0),
m_pull_quant_decl(0),
m_pull_quant_star_decl(0),
m_push_quant_decl(0),
m_elim_unused_vars_decl(0),
m_der_decl(0),
m_quant_inst_decl(0),
m_proof_sort(nullptr),
m_undef_decl(nullptr),
m_true_pr_decl(nullptr),
m_asserted_decl(nullptr),
m_goal_decl(nullptr),
m_modus_ponens_decl(nullptr),
m_reflexivity_decl(nullptr),
m_symmetry_decl(nullptr),
m_transitivity_decl(nullptr),
m_quant_intro_decl(nullptr),
m_and_elim_decl(nullptr),
m_not_or_elim_decl(nullptr),
m_rewrite_decl(nullptr),
m_pull_quant_decl(nullptr),
m_pull_quant_star_decl(nullptr),
m_push_quant_decl(nullptr),
m_elim_unused_vars_decl(nullptr),
m_der_decl(nullptr),
m_quant_inst_decl(nullptr),
m_hypothesis_decl(0),
m_iff_true_decl(0),
m_iff_false_decl(0),
m_commutativity_decl(0),
m_def_axiom_decl(0),
m_lemma_decl(0),
m_hypothesis_decl(nullptr),
m_iff_true_decl(nullptr),
m_iff_false_decl(nullptr),
m_commutativity_decl(nullptr),
m_def_axiom_decl(nullptr),
m_lemma_decl(nullptr),
m_def_intro_decl(0),
m_iff_oeq_decl(0),
m_skolemize_decl(0),
m_mp_oeq_decl(0),
m_hyper_res_decl0(0) {
m_def_intro_decl(nullptr),
m_iff_oeq_decl(nullptr),
m_skolemize_decl(nullptr),
m_mp_oeq_decl(nullptr),
m_hyper_res_decl0(nullptr) {
}
bool basic_decl_plugin::check_proof_sorts(basic_op_kind k, unsigned arity, sort * const * domain) const {
@ -790,7 +790,7 @@ func_decl * basic_decl_plugin::mk_proof_decl(basic_op_kind k, unsigned num_param
}
default:
UNREACHABLE();
return 0;
return nullptr;
}
}
@ -852,7 +852,7 @@ func_decl * basic_decl_plugin::mk_proof_decl(basic_op_kind k, unsigned num_paren
case PR_HYPER_RESOLVE: return mk_proof_decl("hyper-res", k, num_parents, m_hyper_res_decl0);
default:
UNREACHABLE();
return 0;
return nullptr;
}
}
@ -1067,10 +1067,10 @@ func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
case OP_IFF: return m_iff_decl;
case OP_IMPLIES: return m_implies_decl;
case OP_XOR: return m_xor_decl;
case OP_ITE: return arity == 3 ? mk_ite_decl(join(domain[1], domain[2])) : 0;
case OP_ITE: return arity == 3 ? mk_ite_decl(join(domain[1], domain[2])) : nullptr;
// eq and oeq must have at least two arguments, they can have more since they are chainable
case OP_EQ: return arity >= 2 ? mk_eq_decl_core("=", OP_EQ, join(arity, domain), m_eq_decls) : 0;
case OP_OEQ: return arity >= 2 ? mk_eq_decl_core("~", OP_OEQ, join(arity, domain), m_oeq_decls) : 0;
case OP_EQ: return arity >= 2 ? mk_eq_decl_core("=", OP_EQ, join(arity, domain), m_eq_decls) : nullptr;
case OP_OEQ: return arity >= 2 ? mk_eq_decl_core("~", OP_OEQ, join(arity, domain), m_oeq_decls) : nullptr;
case OP_DISTINCT: {
func_decl_info info(m_family_id, OP_DISTINCT);
info.set_pairwise();
@ -1110,10 +1110,10 @@ func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
case OP_IFF: return m_iff_decl;
case OP_IMPLIES: return m_implies_decl;
case OP_XOR: return m_xor_decl;
case OP_ITE: return num_args == 3 ? mk_ite_decl(join(m_manager->get_sort(args[1]), m_manager->get_sort(args[2]))): 0;
case OP_ITE: return num_args == 3 ? mk_ite_decl(join(m_manager->get_sort(args[1]), m_manager->get_sort(args[2]))): nullptr;
// eq and oeq must have at least two arguments, they can have more since they are chainable
case OP_EQ: return num_args >= 2 ? mk_eq_decl_core("=", OP_EQ, join(num_args, args), m_eq_decls) : 0;
case OP_OEQ: return num_args >= 2 ? mk_eq_decl_core("~", OP_OEQ, join(num_args, args), m_oeq_decls) : 0;
case OP_EQ: return num_args >= 2 ? mk_eq_decl_core("=", OP_EQ, join(num_args, args), m_eq_decls) : nullptr;
case OP_OEQ: return num_args >= 2 ? mk_eq_decl_core("~", OP_OEQ, join(num_args, args), m_oeq_decls) : nullptr;
case OP_DISTINCT:
return decl_plugin::mk_func_decl(k, num_parameters, parameters, num_args, args, range);
default:
@ -1134,7 +1134,7 @@ func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
expr * basic_decl_plugin::get_some_value(sort * s) {
if (s == m_bool_sort)
return m_manager->mk_false();
return 0;
return nullptr;
}
bool basic_recognizers::is_ite(expr const * n, expr * & t1, expr * & t2, expr * & t3) const {
@ -1168,7 +1168,7 @@ void label_decl_plugin::set_manager(ast_manager * m, family_id id) {
sort * label_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
UNREACHABLE();
return 0;
return nullptr;
}
func_decl * label_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -1176,12 +1176,12 @@ func_decl * label_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
if (k == OP_LABEL) {
if (arity != 1 || num_parameters < 2 || !parameters[0].is_int() || !parameters[1].is_symbol() || !m_manager->is_bool(domain[0])) {
m_manager->raise_exception("invalid label declaration");
return 0;
return nullptr;
}
for (unsigned i = 2; i < num_parameters; i++) {
if (!parameters[i].is_symbol()) {
m_manager->raise_exception("invalid label declaration");
return 0;
return nullptr;
}
}
return m_manager->mk_func_decl(parameters[0].get_int() ? m_lblpos : m_lblneg, arity, domain, domain[0],
@ -1191,15 +1191,15 @@ func_decl * label_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
SASSERT(k == OP_LABEL_LIT);
if (arity != 0) {
m_manager->raise_exception("invalid label literal declaration");
return 0;
return nullptr;
}
for (unsigned i = 0; i < num_parameters; i++) {
if (!parameters[i].is_symbol()) {
m_manager->raise_exception("invalid label literal declaration");
return 0;
return nullptr;
}
}
return m_manager->mk_func_decl(m_lbllit, 0, static_cast<sort * const *>(0), m_manager->mk_bool_sort(),
return m_manager->mk_func_decl(m_lbllit, 0, static_cast<sort * const *>(nullptr), m_manager->mk_bool_sort(),
func_decl_info(m_family_id, OP_LABEL_LIT, num_parameters, parameters));
}
}
@ -1212,7 +1212,7 @@ func_decl * label_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
sort * pattern_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
UNREACHABLE();
return 0;
return nullptr;
}
func_decl * pattern_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -1230,7 +1230,7 @@ func_decl * pattern_decl_plugin::mk_func_decl(decl_kind k, unsigned num_paramete
sort * model_value_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
UNREACHABLE();
return 0;
return nullptr;
}
func_decl * model_value_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -1239,7 +1239,7 @@ func_decl * model_value_decl_plugin::mk_func_decl(decl_kind k, unsigned num_para
if (arity != 0 || num_parameters != 2 || !parameters[0].is_int() || !parameters[1].is_ast() || !is_sort(parameters[1].get_ast())) {
UNREACHABLE();
m_manager->raise_exception("invalid model value");
return 0;
return nullptr;
}
int idx = parameters[0].get_int();
sort * s = to_sort(parameters[1].get_ast());
@ -1247,7 +1247,7 @@ func_decl * model_value_decl_plugin::mk_func_decl(decl_kind k, unsigned num_para
buffer << s->get_name().bare_str() << "!val!" << idx;
func_decl_info info(m_family_id, k, num_parameters, parameters);
info.m_private_parameters = true;
return m_manager->mk_func_decl(symbol(buffer.c_str()), 0, static_cast<sort * const *>(0), s, info);
return m_manager->mk_func_decl(symbol(buffer.c_str()), 0, static_cast<sort * const *>(nullptr), s, info);
}
bool model_value_decl_plugin::is_value(app* n) const {
@ -1274,7 +1274,7 @@ sort * user_sort_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter
func_decl * user_sort_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
UNREACHABLE();
return 0;
return nullptr;
}
decl_kind user_sort_plugin::register_name(symbol s) {
@ -1307,7 +1307,7 @@ ast_manager::ast_manager(proof_gen_mode m, char const * trace_file, bool is_form
m_expr_dependency_manager(*this, m_alloc),
m_expr_dependency_array_manager(*this, m_alloc),
m_proof_mode(m),
m_trace_stream(0),
m_trace_stream(nullptr),
m_trace_stream_owner(false),
m_rec_fun(":rec-fun") {
@ -1319,7 +1319,7 @@ ast_manager::ast_manager(proof_gen_mode m, char const * trace_file, bool is_form
if (!is_format_manager)
m_format_manager = alloc(ast_manager, PGM_DISABLED, m_trace_stream, true);
else
m_format_manager = 0;
m_format_manager = nullptr;
init();
}
@ -1336,7 +1336,7 @@ ast_manager::ast_manager(proof_gen_mode m, std::fstream * trace_stream, bool is_
if (!is_format_manager)
m_format_manager = alloc(ast_manager, PGM_DISABLED, trace_stream, true);
else
m_format_manager = 0;
m_format_manager = nullptr;
init();
}
@ -1361,7 +1361,7 @@ void ast_manager::init() {
m_fresh_id = 0;
m_expr_id_gen.reset(0);
m_decl_id_gen.reset(c_first_decl_id);
m_some_value_proc = 0;
m_some_value_proc = nullptr;
m_basic_family_id = mk_family_id("basic");
m_label_family_id = mk_family_id("label");
m_pattern_family_id = mk_family_id("pattern");
@ -1427,14 +1427,14 @@ ast_manager::~ast_manager() {
switch (n->get_kind()) {
case AST_SORT: {
sort_info* info = to_sort(n)->get_info();
if (info != 0) {
if (info != nullptr) {
mark_array_ref(mark, info->get_num_parameters(), info->get_parameters());
}
break;
}
case AST_FUNC_DECL: {
func_decl_info* info = to_func_decl(n)->get_info();
if (info != 0) {
if (info != nullptr) {
mark_array_ref(mark, info->get_num_parameters(), info->get_parameters());
}
mark_array_ref(mark, to_func_decl(n)->get_arity(), to_func_decl(n)->get_domain());
@ -1476,14 +1476,14 @@ ast_manager::~ast_manager() {
delete_node(a);
}
}
if (m_format_manager != 0)
if (m_format_manager != nullptr)
dealloc(m_format_manager);
if (m_trace_stream_owner) {
std::fstream & tmp = * m_trace_stream;
tmp << "[eof]\n";
tmp.close();
dealloc(m_trace_stream);
m_trace_stream = 0;
m_trace_stream = nullptr;
}
}
@ -1587,7 +1587,7 @@ decl_plugin * ast_manager::get_plugin(family_id fid) const {
bool ast_manager::is_value(expr* e) const {
decl_plugin const * p = 0;
decl_plugin const * p = nullptr;
if (is_app(e)) {
p = get_plugin(to_app(e)->get_family_id());
return p && p->is_value(to_app(e));
@ -1596,7 +1596,7 @@ bool ast_manager::is_value(expr* e) const {
}
bool ast_manager::is_unique_value(expr* e) const {
decl_plugin const * p = 0;
decl_plugin const * p = nullptr;
if (is_app(e)) {
p = get_plugin(to_app(e)->get_family_id());
return p && p->is_unique_value(to_app(e));
@ -1698,13 +1698,13 @@ ast * ast_manager::register_node_core(ast * n) {
// increment reference counters
switch (n->get_kind()) {
case AST_SORT:
if (to_sort(n)->m_info != 0) {
if (to_sort(n)->m_info != nullptr) {
to_sort(n)->m_info = alloc(sort_info, *(to_sort(n)->get_info()));
to_sort(n)->m_info->init_eh(*this);
}
break;
case AST_FUNC_DECL:
if (to_func_decl(n)->m_info != 0) {
if (to_func_decl(n)->m_info != nullptr) {
to_func_decl(n)->m_info = alloc(func_decl_info, *(to_func_decl(n)->get_info()));
to_func_decl(n)->m_info->init_eh(*this);
}
@ -1807,14 +1807,14 @@ void ast_manager::delete_node(ast * n) {
#endif
switch (n->get_kind()) {
case AST_SORT:
if (to_sort(n)->m_info != 0 && !m_debug_ref_count) {
if (to_sort(n)->m_info != nullptr && !m_debug_ref_count) {
sort_info * info = to_sort(n)->get_info();
info->del_eh(*this);
dealloc(info);
}
break;
case AST_FUNC_DECL:
if (to_func_decl(n)->m_info != 0 && !m_debug_ref_count) {
if (to_func_decl(n)->m_info != nullptr && !m_debug_ref_count) {
func_decl_info * info = to_func_decl(n)->get_info();
info->del_eh(*this);
dealloc(info);
@ -1849,7 +1849,7 @@ sort * ast_manager::mk_sort(family_id fid, decl_kind k, unsigned num_parameters,
decl_plugin * p = get_plugin(fid);
if (p)
return p->mk_sort(k, num_parameters, parameters);
return 0;
return nullptr;
}
func_decl * ast_manager::mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -1857,7 +1857,7 @@ func_decl * ast_manager::mk_func_decl(family_id fid, decl_kind k, unsigned num_p
decl_plugin * p = get_plugin(fid);
if (p)
return p->mk_func_decl(k, num_parameters, parameters, arity, domain, range);
return 0;
return nullptr;
}
func_decl * ast_manager::mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -1865,33 +1865,33 @@ func_decl * ast_manager::mk_func_decl(family_id fid, decl_kind k, unsigned num_p
decl_plugin * p = get_plugin(fid);
if (p)
return p->mk_func_decl(k, num_parameters, parameters, num_args, args, range);
return 0;
return nullptr;
}
app * ast_manager::mk_app(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned num_args, expr * const * args, sort * range) {
func_decl * decl = mk_func_decl(fid, k, num_parameters, parameters, num_args, args, range);
if (decl != 0)
if (decl != nullptr)
return mk_app(decl, num_args, args);
return 0;
return nullptr;
}
app * ast_manager::mk_app(family_id fid, decl_kind k, unsigned num_args, expr * const * args) {
return mk_app(fid, k, 0, 0, num_args, args);
return mk_app(fid, k, 0, nullptr, num_args, args);
}
app * ast_manager::mk_app(family_id fid, decl_kind k, expr * arg) {
return mk_app(fid, k, 0, 0, 1, &arg);
return mk_app(fid, k, 0, nullptr, 1, &arg);
}
app * ast_manager::mk_app(family_id fid, decl_kind k, expr * arg1, expr * arg2) {
expr * args[2] = { arg1, arg2 };
return mk_app(fid, k, 0, 0, 2, args);
return mk_app(fid, k, 0, nullptr, 2, args);
}
app * ast_manager::mk_app(family_id fid, decl_kind k, expr * arg1, expr * arg2, expr * arg3) {
expr * args[3] = { arg1, arg2, arg3 };
return mk_app(fid, k, 0, 0, 3, args);
return mk_app(fid, k, 0, nullptr, 3, args);
}
sort * ast_manager::mk_sort(symbol const & name, sort_info * info) {
@ -2062,8 +2062,8 @@ bool ast_manager::coercion_needed(func_decl * decl, unsigned num_args, expr * co
}
app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const * args) {
app * r = 0;
app * new_node = 0;
app * r = nullptr;
app * new_node = nullptr;
unsigned sz = app::get_obj_size(num_args);
void * mem = allocate_node(sz);
@ -2171,7 +2171,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
<< ") passed to function " << mk_pp(decl, *this);
throw ast_exception(buffer.str().c_str());
}
app * r = 0;
app * r = nullptr;
if (num_args == 1 && decl->is_chainable() && decl->get_arity() == 2) {
r = mk_true();
}
@ -2200,7 +2200,7 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
r = mk_and(new_args.size(), new_args.c_ptr());
}
}
if (r == 0) {
if (r == nullptr) {
r = mk_app_core(decl, num_args, args);
}
SASSERT(r != 0);
@ -2287,7 +2287,7 @@ app * ast_manager::mk_label_lit(unsigned num_names, symbol const * names) {
buffer<parameter> p;
for (unsigned i = 0; i < num_names; i++)
p.push_back(parameter(names[i]));
return mk_app(m_label_family_id, OP_LABEL_LIT, p.size(), p.c_ptr(), 0, 0);
return mk_app(m_label_family_id, OP_LABEL_LIT, p.size(), p.c_ptr(), 0, nullptr);
}
app * ast_manager::mk_label_lit(symbol const & name) {
@ -2309,7 +2309,7 @@ app * ast_manager::mk_pattern(unsigned num_exprs, app * const * exprs) {
for (unsigned i = 0; i < num_exprs; ++i) {
SASSERT(is_app(exprs[i]));
}});
return mk_app(m_pattern_family_id, OP_PATTERN, 0, 0, num_exprs, (expr*const*)exprs);
return mk_app(m_pattern_family_id, OP_PATTERN, 0, nullptr, num_exprs, (expr*const*)exprs);
}
bool ast_manager::is_pattern(expr const * n) const {
@ -2406,7 +2406,7 @@ quantifier * ast_manager::update_quantifier(quantifier * q, unsigned num_pattern
num_patterns,
patterns,
num_patterns == 0 ? q->get_num_no_patterns() : 0,
num_patterns == 0 ? q->get_no_patterns() : 0);
num_patterns == 0 ? q->get_no_patterns() : nullptr);
}
quantifier * ast_manager::update_quantifier(quantifier * q, unsigned num_patterns, expr * const * patterns, unsigned num_no_patterns, expr * const * no_patterns, expr * body) {
@ -2492,7 +2492,7 @@ quantifier * ast_manager::update_quantifier(quantifier * q, bool is_forall, unsi
num_patterns,
patterns,
num_patterns == 0 ? q->get_num_no_patterns() : 0,
num_patterns == 0 ? q->get_no_patterns() : 0);
num_patterns == 0 ? q->get_no_patterns() : nullptr);
}
app * ast_manager::mk_distinct(unsigned num_args, expr * const * args) {
@ -2524,14 +2524,14 @@ app * ast_manager::mk_distinct_expanded(unsigned num_args, expr * const * args)
// -----------------------------------
expr_dependency * ast_manager::mk_leaf(expr * t) {
if (t == 0)
return 0;
if (t == nullptr)
return nullptr;
else
return m_expr_dependency_manager.mk_leaf(t);
}
expr_dependency * ast_manager::mk_join(unsigned n, expr * const * ts) {
expr_dependency * d = 0;
expr_dependency * d = nullptr;
for (unsigned i = 0; i < n; i++)
d = mk_join(d, mk_leaf(ts[i]));
return d;
@ -2550,7 +2550,7 @@ void ast_manager::linearize(expr_dependency * d, ptr_vector<expr> & ts) {
app * ast_manager::mk_model_value(unsigned idx, sort * s) {
parameter p[2] = { parameter(idx), parameter(s) };
return mk_app(m_model_value_family_id, OP_MODEL_VALUE, 2, p, 0, static_cast<expr * const *>(0));
return mk_app(m_model_value_family_id, OP_MODEL_VALUE, 2, p, 0, static_cast<expr * const *>(nullptr));
}
expr * ast_manager::get_some_value(sort * s, some_value_proc * p) {
@ -2559,17 +2559,17 @@ expr * ast_manager::get_some_value(sort * s, some_value_proc * p) {
}
expr * ast_manager::get_some_value(sort * s) {
expr * v = 0;
expr * v = nullptr;
if (m_some_value_proc)
v = (*m_some_value_proc)(s);
if (v != 0)
if (v != nullptr)
return v;
family_id fid = s->get_family_id();
if (fid != null_family_id) {
decl_plugin * p = get_plugin(fid);
if (p != 0) {
if (p != nullptr) {
v = p->get_some_value(s);
if (v != 0)
if (v != nullptr)
return v;
}
}
@ -2582,7 +2582,7 @@ bool ast_manager::is_fully_interp(sort * s) const {
family_id fid = s->get_family_id();
SASSERT(fid != null_family_id);
decl_plugin * p = get_plugin(fid);
if (p != 0)
if (p != nullptr)
return p->is_fully_interp(s);
return false;
}
@ -2780,14 +2780,14 @@ proof * ast_manager::mk_congruence(app * f1, app * f2, unsigned num_proofs, proo
SASSERT(get_sort(f1) == get_sort(f2));
sort * s = get_sort(f1);
sort * d[2] = { s, s };
return mk_monotonicity(mk_func_decl(m_basic_family_id, get_eq_op(f1), 0, 0, 2, d), f1, f2, num_proofs, proofs);
return mk_monotonicity(mk_func_decl(m_basic_family_id, get_eq_op(f1), 0, nullptr, 2, d), f1, f2, num_proofs, proofs);
}
proof * ast_manager::mk_oeq_congruence(app * f1, app * f2, unsigned num_proofs, proof * const * proofs) {
SASSERT(get_sort(f1) == get_sort(f2));
sort * s = get_sort(f1);
sort * d[2] = { s, s };
return mk_monotonicity(mk_func_decl(m_basic_family_id, OP_OEQ, 0, 0, 2, d), f1, f2, num_proofs, proofs);
return mk_monotonicity(mk_func_decl(m_basic_family_id, OP_OEQ, 0, nullptr, 2, d), f1, f2, num_proofs, proofs);
}
proof * ast_manager::mk_quant_intro(quantifier * q1, quantifier * q2, proof * p) {

View file

@ -132,7 +132,7 @@ public:
case PARAM_INT: m_int = other.get_int(); break;
case PARAM_AST: m_ast = other.get_ast(); break;
case PARAM_SYMBOL: m_symbol = other.m_symbol; break;
case PARAM_RATIONAL: m_rational = 0; std::swap(m_rational, other.m_rational); break;
case PARAM_RATIONAL: m_rational = nullptr; std::swap(m_rational, other.m_rational); break;
case PARAM_DOUBLE: m_dval = other.m_dval; break;
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break;
default:
@ -258,7 +258,7 @@ class decl_info {
public:
bool m_private_parameters;
decl_info(family_id family_id = null_family_id, decl_kind k = null_decl_kind,
unsigned num_parameters = 0, parameter const * parameters = 0, bool private_params = false);
unsigned num_parameters = 0, parameter const * parameters = nullptr, bool private_params = false);
decl_info(decl_info const& other);
~decl_info() {}
@ -342,17 +342,17 @@ class sort_info : public decl_info {
sort_size m_num_elements;
public:
sort_info(family_id family_id = null_family_id, decl_kind k = null_decl_kind,
unsigned num_parameters = 0, parameter const * parameters = 0, bool private_parameters = false):
unsigned num_parameters = 0, parameter const * parameters = nullptr, bool private_parameters = false):
decl_info(family_id, k, num_parameters, parameters, private_parameters) {
}
sort_info(family_id family_id, decl_kind k, uint64 num_elements,
unsigned num_parameters = 0, parameter const * parameters = 0, bool private_parameters = false):
unsigned num_parameters = 0, parameter const * parameters = nullptr, bool private_parameters = false):
decl_info(family_id, k, num_parameters, parameters, private_parameters), m_num_elements(num_elements) {
}
sort_info(family_id family_id, decl_kind k, sort_size const& num_elements,
unsigned num_parameters = 0, parameter const * parameters = 0, bool private_parameters = false):
unsigned num_parameters = 0, parameter const * parameters = nullptr, bool private_parameters = false):
decl_info(family_id, k, num_parameters, parameters, private_parameters), m_num_elements(num_elements) {
}
sort_info(sort_info const& other) : decl_info(other), m_num_elements(other.m_num_elements) {
@ -390,7 +390,7 @@ struct func_decl_info : public decl_info {
bool m_idempotent:1;
bool m_skolem:1;
func_decl_info(family_id family_id = null_family_id, decl_kind k = null_decl_kind, unsigned num_parameters = 0, parameter const * parameters = 0);
func_decl_info(family_id family_id = null_family_id, decl_kind k = null_decl_kind, unsigned num_parameters = 0, parameter const * parameters = nullptr);
~func_decl_info() {}
bool is_associative() const { return m_left_assoc && m_right_assoc; }
@ -565,12 +565,12 @@ public:
unsigned get_decl_id() const { SASSERT(get_id() >= c_first_decl_id); return get_id() - c_first_decl_id; }
symbol const & get_name() const { return m_name; }
decl_info * get_info() const { return m_info; }
family_id get_family_id() const { return m_info == 0 ? null_family_id : m_info->get_family_id(); }
decl_kind get_decl_kind() const { return m_info == 0 ? null_decl_kind : m_info->get_decl_kind(); }
unsigned get_num_parameters() const { return m_info == 0 ? 0 : m_info->get_num_parameters(); }
family_id get_family_id() const { return m_info == nullptr ? null_family_id : m_info->get_family_id(); }
decl_kind get_decl_kind() const { return m_info == nullptr ? null_decl_kind : m_info->get_decl_kind(); }
unsigned get_num_parameters() const { return m_info == nullptr ? 0 : m_info->get_num_parameters(); }
parameter const & get_parameter(unsigned idx) const { return m_info->get_parameter(idx); }
parameter const * get_parameters() const { return m_info == 0 ? 0 : m_info->get_parameters(); }
bool private_parameters() const { return m_info != 0 && m_info->private_parameters(); }
parameter const * get_parameters() const { return m_info == nullptr ? nullptr : m_info->get_parameters(); }
bool private_parameters() const { return m_info != nullptr && m_info->private_parameters(); }
};
// -----------------------------------
@ -587,8 +587,8 @@ class sort : public decl {
sort(symbol const & name, sort_info * info):decl(AST_SORT, name, info) {}
public:
sort_info * get_info() const { return static_cast<sort_info*>(m_info); }
bool is_infinite() const { return get_info() == 0 || get_info()->is_infinite(); }
bool is_very_big() const { return get_info() == 0 || get_info()->is_very_big(); }
bool is_infinite() const { return get_info() == nullptr || get_info()->is_infinite(); }
bool is_very_big() const { return get_info() == nullptr || get_info()->is_very_big(); }
bool is_sort_of(family_id fid, decl_kind k) const { return get_family_id() == fid && get_decl_kind() == k; }
sort_size const & get_num_elements() const { return get_info()->get_num_elements(); }
void set_num_elements(sort_size const& s) { get_info()->set_num_elements(s); }
@ -613,16 +613,16 @@ class func_decl : public decl {
func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range, func_decl_info * info);
public:
func_decl_info * get_info() const { return static_cast<func_decl_info*>(m_info); }
bool is_associative() const { return get_info() != 0 && get_info()->is_associative(); }
bool is_left_associative() const { return get_info() != 0 && get_info()->is_left_associative(); }
bool is_right_associative() const { return get_info() != 0 && get_info()->is_right_associative(); }
bool is_flat_associative() const { return get_info() != 0 && get_info()->is_flat_associative(); }
bool is_commutative() const { return get_info() != 0 && get_info()->is_commutative(); }
bool is_chainable() const { return get_info() != 0 && get_info()->is_chainable(); }
bool is_pairwise() const { return get_info() != 0 && get_info()->is_pairwise(); }
bool is_injective() const { return get_info() != 0 && get_info()->is_injective(); }
bool is_skolem() const { return get_info() != 0 && get_info()->is_skolem(); }
bool is_idempotent() const { return get_info() != 0 && get_info()->is_idempotent(); }
bool is_associative() const { return get_info() != nullptr && get_info()->is_associative(); }
bool is_left_associative() const { return get_info() != nullptr && get_info()->is_left_associative(); }
bool is_right_associative() const { return get_info() != nullptr && get_info()->is_right_associative(); }
bool is_flat_associative() const { return get_info() != nullptr && get_info()->is_flat_associative(); }
bool is_commutative() const { return get_info() != nullptr && get_info()->is_commutative(); }
bool is_chainable() const { return get_info() != nullptr && get_info()->is_chainable(); }
bool is_pairwise() const { return get_info() != nullptr && get_info()->is_pairwise(); }
bool is_injective() const { return get_info() != nullptr && get_info()->is_injective(); }
bool is_skolem() const { return get_info() != nullptr && get_info()->is_skolem(); }
bool is_idempotent() const { return get_info() != nullptr && get_info()->is_idempotent(); }
unsigned get_arity() const { return m_arity; }
sort * get_domain(unsigned idx) const { SASSERT(idx < get_arity()); return m_domain[idx]; }
sort * const * get_domain() const { return m_domain; }
@ -957,7 +957,7 @@ protected:
friend class ast_manager;
public:
decl_plugin():m_manager(0), m_family_id(null_family_id) {}
decl_plugin():m_manager(nullptr), m_family_id(null_family_id) {}
virtual ~decl_plugin() {}
virtual void finalize() {}
@ -1013,7 +1013,7 @@ public:
virtual void get_sort_names(svector<builtin_name> & sort_names, symbol const & logic = symbol()) {}
virtual expr * get_some_value(sort * s) { return 0; }
virtual expr * get_some_value(sort * s) { return nullptr; }
// Return true if the interpreted sort s does not depend on uninterpreted sorts.
// This may be the case, for example, for array and datatype sorts.
@ -1497,14 +1497,14 @@ protected:
public:
ast_manager(proof_gen_mode = PGM_DISABLED, char const * trace_file = 0, bool is_format_manager = false);
ast_manager(proof_gen_mode = PGM_DISABLED, char const * trace_file = nullptr, bool is_format_manager = false);
ast_manager(proof_gen_mode, std::fstream * trace_stream, bool is_format_manager = false);
ast_manager(ast_manager const & src, bool disable_proofs = false);
~ast_manager();
// propagate cancellation signal to decl_plugins
bool has_trace_stream() const { return m_trace_stream != 0; }
bool has_trace_stream() const { return m_trace_stream != nullptr; }
std::ostream & trace_stream() { SASSERT(has_trace_stream()); return *m_trace_stream; }
void enable_int_real_coercions(bool f) { m_int_real_coercions = f; }
@ -1523,7 +1523,7 @@ public:
// Equivalent to throw ast_exception(msg)
Z3_NORETURN void raise_exception(char const * msg);
bool is_format_manager() const { return m_format_manager == 0; }
bool is_format_manager() const { return m_format_manager == nullptr; }
ast_manager & get_format_manager() { return is_format_manager() ? *this : *m_format_manager; }
@ -1558,7 +1558,7 @@ public:
decl_plugin * get_plugin(family_id fid) const;
bool has_plugin(family_id fid) const { return get_plugin(fid) != 0; }
bool has_plugin(family_id fid) const { return get_plugin(fid) != nullptr; }
bool has_plugin(symbol const & s) const { return m_family_manager.has_family(s) && has_plugin(m_family_manager.get_family_id(s)); }
@ -1670,7 +1670,7 @@ private:
public:
sort * mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters);
sort * mk_uninterpreted_sort(symbol const & name) { return mk_uninterpreted_sort(name, 0, 0); }
sort * mk_uninterpreted_sort(symbol const & name) { return mk_uninterpreted_sort(name, 0, nullptr); }
sort * mk_sort(symbol const & name, sort_info const & info) {
if (info.get_family_id() == null_family_id) {
@ -1681,7 +1681,7 @@ public:
}
}
sort * mk_sort(family_id fid, decl_kind k, unsigned num_parameters = 0, parameter const * parameters = 0);
sort * mk_sort(family_id fid, decl_kind k, unsigned num_parameters = 0, parameter const * parameters = nullptr);
sort * substitute(sort* s, unsigned n, sort * const * src, sort * const * dst);
@ -1700,13 +1700,13 @@ public:
bool is_fully_interp(sort * s) const;
func_decl * mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range = 0);
unsigned arity, sort * const * domain, sort * range = nullptr);
func_decl * mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned num_args, expr * const * args, sort * range = 0);
unsigned num_args, expr * const * args, sort * range = nullptr);
app * mk_app(family_id fid, decl_kind k, unsigned num_parameters = 0, parameter const * parameters = 0,
unsigned num_args = 0, expr * const * args = 0, sort * range = 0);
app * mk_app(family_id fid, decl_kind k, unsigned num_parameters = 0, parameter const * parameters = nullptr,
unsigned num_args = 0, expr * const * args = nullptr, sort * range = nullptr);
app * mk_app(family_id fid, decl_kind k, unsigned num_args, expr * const * args);
@ -1716,7 +1716,7 @@ public:
app * mk_app(family_id fid, decl_kind k, expr * arg1, expr * arg2, expr * arg3);
app * mk_const(family_id fid, decl_kind k) { return mk_app(fid, k, 0, static_cast<expr * const *>(0)); }
app * mk_const(family_id fid, decl_kind k) { return mk_app(fid, k, 0, static_cast<expr * const *>(nullptr)); }
private:
func_decl * mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range,
func_decl_info * info);
@ -1727,13 +1727,13 @@ private:
public:
func_decl * mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range) {
return mk_func_decl(name, arity, domain, range, static_cast<func_decl_info *>(0));
return mk_func_decl(name, arity, domain, range, static_cast<func_decl_info *>(nullptr));
}
func_decl * mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range,
func_decl_info const & info) {
if (info.is_null()) {
return mk_func_decl(name, arity, domain, range, static_cast<func_decl_info *>(0));
return mk_func_decl(name, arity, domain, range, static_cast<func_decl_info *>(nullptr));
}
else {
return mk_func_decl(name, arity, domain, range, & const_cast<func_decl_info&>(info));
@ -1746,11 +1746,11 @@ public:
}
func_decl * mk_const_decl(symbol const & name, sort * s) {
return mk_func_decl(name, static_cast<unsigned>(0), 0, s);
return mk_func_decl(name, static_cast<unsigned>(0), nullptr, s);
}
func_decl * mk_const_decl(symbol const & name, sort * s, func_decl_info const & info) {
return mk_func_decl(name, static_cast<unsigned>(0), 0, s, info);
return mk_func_decl(name, static_cast<unsigned>(0), nullptr, s, info);
}
func_decl * mk_func_decl(symbol const & name, sort * domain, sort * range, func_decl_info const & info) {
@ -1804,7 +1804,7 @@ public:
app * mk_const(func_decl * decl) {
SASSERT(decl->get_arity() == 0);
return mk_app(decl, static_cast<unsigned>(0), static_cast<expr**>(0));
return mk_app(decl, static_cast<unsigned>(0), static_cast<expr**>(nullptr));
}
app * mk_const(symbol const & name, sort * s) {
@ -1825,9 +1825,9 @@ public:
return mk_fresh_func_decl(symbol(prefix), symbol::null, arity, domain, range);
}
app * mk_fresh_const(char const * prefix, sort * s) { return mk_const(mk_fresh_func_decl(prefix, 0, 0, s)); }
app * mk_fresh_const(char const * prefix, sort * s) { return mk_const(mk_fresh_func_decl(prefix, 0, nullptr, s)); }
symbol mk_fresh_var_name(char const * prefix = 0);
symbol mk_fresh_var_name(char const * prefix = nullptr);
var * mk_var(unsigned idx, sort * ty);
@ -1879,21 +1879,21 @@ public:
quantifier * mk_quantifier(bool forall, unsigned num_decls, sort * const * decl_sorts, symbol const * decl_names, expr * body,
int weight = 0, symbol const & qid = symbol::null, symbol const & skid = symbol::null,
unsigned num_patterns = 0, expr * const * patterns = 0,
unsigned num_no_patterns = 0, expr * const * no_patterns = 0);
unsigned num_patterns = 0, expr * const * patterns = nullptr,
unsigned num_no_patterns = 0, expr * const * no_patterns = nullptr);
quantifier * mk_forall(unsigned num_decls, sort * const * decl_sorts, symbol const * decl_names, expr * body,
int weight = 0, symbol const & qid = symbol::null, symbol const & skid = symbol::null,
unsigned num_patterns = 0, expr * const * patterns = 0,
unsigned num_no_patterns = 0, expr * const * no_patterns = 0) {
unsigned num_patterns = 0, expr * const * patterns = nullptr,
unsigned num_no_patterns = 0, expr * const * no_patterns = nullptr) {
return mk_quantifier(true, num_decls, decl_sorts, decl_names, body, weight, qid, skid, num_patterns, patterns,
num_no_patterns, no_patterns);
}
quantifier * mk_exists(unsigned num_decls, sort * const * decl_sorts, symbol const * decl_names, expr * body,
int weight = 0, symbol const & qid = symbol::null, symbol const & skid = symbol::null,
unsigned num_patterns = 0, expr * const * patterns = 0,
unsigned num_no_patterns = 0, expr * const * no_patterns = 0) {
unsigned num_patterns = 0, expr * const * patterns = nullptr,
unsigned num_no_patterns = 0, expr * const * no_patterns = nullptr) {
return mk_quantifier(false, num_decls, decl_sorts, decl_names, body, weight, qid, skid, num_patterns, patterns,
num_no_patterns, no_patterns);
}
@ -2057,12 +2057,12 @@ public:
func_decl* mk_and_decl() {
sort* domain[2] = { m_bool_sort, m_bool_sort };
return mk_func_decl(m_basic_family_id, OP_AND, 0, 0, 2, domain);
return mk_func_decl(m_basic_family_id, OP_AND, 0, nullptr, 2, domain);
}
func_decl* mk_not_decl() { return mk_func_decl(m_basic_family_id, OP_NOT, 0, 0, 1, &m_bool_sort); }
func_decl* mk_not_decl() { return mk_func_decl(m_basic_family_id, OP_NOT, 0, nullptr, 1, &m_bool_sort); }
func_decl* mk_or_decl() {
sort* domain[2] = { m_bool_sort, m_bool_sort };
return mk_func_decl(m_basic_family_id, OP_OR, 0, 0, 2, domain);
return mk_func_decl(m_basic_family_id, OP_OR, 0, nullptr, 2, domain);
}
// -----------------------------------
@ -2210,7 +2210,7 @@ public:
proof * mk_th_lemma(family_id tid,
expr * fact, unsigned num_proofs, proof * const * proofs,
unsigned num_params = 0, parameter const* params = 0);
unsigned num_params = 0, parameter const* params = nullptr);
protected:
bool check_nnf_proof_parents(unsigned num_proofs, proof * const * proofs) const;

View file

@ -319,11 +319,11 @@ void ast_ll_pp(std::ostream & out, ast_manager & m, ast * n, ast_mark & visited,
}
void ast_def_ll_pp(std::ostream & out, ast_manager & m, ast * n, ast_mark & visited, bool only_exprs, bool compact) {
ll_printer p(out, m, 0, only_exprs, compact);
ll_printer p(out, m, nullptr, only_exprs, compact);
p.pp(n, visited);
}
void ast_ll_bounded_pp(std::ostream & out, ast_manager & m, ast * n, unsigned depth) {
ll_printer p(out, m, 0, false, true);
ll_printer p(out, m, nullptr, false, true);
p.display_bounded(n, depth);
}

View file

@ -24,10 +24,10 @@ Revision History:
#include "ast/ast_smt2_pp.h"
struct mk_pp : public mk_ismt2_pp {
mk_pp(ast * t, ast_manager & m, params_ref const & p, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0):
mk_pp(ast * t, ast_manager & m, params_ref const & p, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = nullptr):
mk_ismt2_pp(t, m, p, indent, num_vars, var_prefix) {
}
mk_pp(ast * t, ast_manager & m, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0):
mk_pp(ast * t, ast_manager & m, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = nullptr):
mk_ismt2_pp(t, m, indent, num_vars, var_prefix) {
}
};

View file

@ -40,7 +40,7 @@ void ast_pp_util::display_decls(std::ostream& out) {
ast_smt_pp pp(m);
unsigned n = coll.get_num_sorts();
for (unsigned i = 0; i < n; ++i) {
pp.display_ast_smt2(out, coll.get_sorts()[i], 0, 0, 0);
pp.display_ast_smt2(out, coll.get_sorts()[i], 0, 0, nullptr);
}
n = coll.get_num_decls();
for (unsigned i = 0; i < n; ++i) {

View file

@ -37,7 +37,7 @@ public:
void pp(func_decl * f, format_ns::format_ref & r) const override { mk_smt2_format(f, env(), params_ref(), r); }
void pp(expr * n, format_ns::format_ref & r) const override {
sbuffer<symbol> buf;
mk_smt2_format(n, env(), params_ref(), 0, 0, r, buf);
mk_smt2_format(n, env(), params_ref(), 0, nullptr, r, buf);
}
void pp(expr * n, unsigned num_vars, char const * var_prefix, format_ns::format_ref & r, sbuffer<symbol> & var_names) const override {
mk_smt2_format(n, env(), params_ref(), num_vars, var_prefix, r, var_names);

View file

@ -236,7 +236,7 @@ format * smt2_pp_environment::pp_float_literal(app * t, bool use_bv_lits, bool u
mpf_manager & fm = get_futil().fm();
scoped_mpf v(fm);
ast_manager & m = get_manager();
format * body = 0;
format * body = nullptr;
string_buffer<> buf;
VERIFY(get_futil().is_numeral(t, v));
if (fm.is_nan(v)) {
@ -750,7 +750,7 @@ class smt2_printer {
}
buffer<symbol> labels;
bool is_pos;
format * f = 0;
format * f = nullptr;
format ** it = m_format_stack.c_ptr() + fr.m_spos;
format ** end = m_format_stack.c_ptr() + m_format_stack.size();
if (m().is_label(t, is_pos, labels)) {
@ -1004,7 +1004,7 @@ class smt2_printer {
void del_expr2alias_stack() {
std::for_each(m_expr2alias_stack.begin(), m_expr2alias_stack.end(), delete_proc<expr2alias>());
m_expr2alias_stack.reset();
m_expr2alias = 0;
m_expr2alias = nullptr;
}
void reset_expr2alias_stack() {
@ -1064,7 +1064,7 @@ public:
m_manager(env.get_manager()),
m_env(env),
m_soccs(m_manager),
m_root(0),
m_root(nullptr),
m_aliased_pps(fm()),
m_next_alias_idx(1),
m_format_stack(fm()) {
@ -1092,7 +1092,7 @@ public:
void operator()(expr * n, unsigned num, char const * var_prefix, format_ref & r, sbuffer<symbol> & var_names) {
reset_var_names();
if (var_prefix == 0)
if (var_prefix == nullptr)
var_prefix = "x";
if (strcmp(var_prefix, ALIAS_PREFIX) == 0) {
var_prefix = "_a";
@ -1228,7 +1228,7 @@ mk_ismt2_pp::mk_ismt2_pp(ast * t, ast_manager & m, unsigned indent, unsigned num
std::ostream& operator<<(std::ostream& out, mk_ismt2_pp const & p) {
smt2_pp_environment_dbg env(p.m_manager);
if (p.m_ast == 0) {
if (p.m_ast == nullptr) {
out << "null";
}
else if (is_expr(p.m_ast)) {
@ -1263,13 +1263,13 @@ std::ostream& operator<<(std::ostream& out, sort_ref const& e) {
std::ostream& operator<<(std::ostream& out, expr_ref_vector const& e) {
smt2_pp_environment_dbg env(e.get_manager());
params_ref p;
return ast_smt2_pp(out, e.size(), e.c_ptr(), env, p, 0, 0, 0);
return ast_smt2_pp(out, e.size(), e.c_ptr(), env, p, 0, 0, nullptr);
}
std::ostream& operator<<(std::ostream& out, app_ref_vector const& e) {
smt2_pp_environment_dbg env(e.get_manager());
params_ref p;
return ast_smt2_pp(out, e.size(), (expr*const*)e.c_ptr(), env, p, 0, 0, 0);
return ast_smt2_pp(out, e.size(), (expr*const*)e.c_ptr(), env, p, 0, 0, nullptr);
}
std::ostream& operator<<(std::ostream& out, func_decl_ref_vector const& e) {

View file

@ -98,7 +98,7 @@ void mk_smt2_format(sort * s, smt2_pp_environment & env, params_ref const & p, f
void mk_smt2_format(func_decl * f, smt2_pp_environment & env, params_ref const & p, format_ns::format_ref & r);
std::ostream & ast_smt2_pp(std::ostream & out, expr * n, smt2_pp_environment & env, params_ref const & p = params_ref(), unsigned indent = 0,
unsigned num_vars = 0, char const * var_prefix = 0);
unsigned num_vars = 0, char const * var_prefix = nullptr);
std::ostream & ast_smt2_pp(std::ostream & out, sort * s, smt2_pp_environment & env, params_ref const & p = params_ref(), unsigned indent = 0);
std::ostream & ast_smt2_pp(std::ostream & out, func_decl * f, smt2_pp_environment & env, params_ref const & p = params_ref(), unsigned indent = 0);
@ -113,8 +113,8 @@ struct mk_ismt2_pp {
unsigned m_indent;
unsigned m_num_vars;
char const * m_var_prefix;
mk_ismt2_pp(ast * t, ast_manager & m, params_ref const & p, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0);
mk_ismt2_pp(ast * t, ast_manager & m, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = 0);
mk_ismt2_pp(ast * t, ast_manager & m, params_ref const & p, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = nullptr);
mk_ismt2_pp(ast * t, ast_manager & m, unsigned indent = 0, unsigned num_vars = 0, char const * var_prefix = nullptr);
};
std::ostream& operator<<(std::ostream& out, mk_ismt2_pp const & p);

View file

@ -702,7 +702,7 @@ class smt_printer {
public:
smt_printer(std::ostream& out, ast_manager& m, ptr_vector<quantifier>& ql, smt_renaming& rn,
symbol logic, bool no_lets, bool simplify_implies, unsigned indent, unsigned num_var_names = 0, char const* const* var_names = 0) :
symbol logic, bool no_lets, bool simplify_implies, unsigned indent, unsigned num_var_names = 0, char const* const* var_names = nullptr) :
m_out(out),
m_manager(m),
m_qlists(ql),
@ -768,7 +768,7 @@ public:
}
m_mark.reset();
m_num_lets = 0;
m_top = 0;
m_top = nullptr;
}
void pp_dt(ast_mark& mark, sort* s) {

View file

@ -76,8 +76,8 @@ public:
void set_is_declared(is_declared* id) { m_is_declared = id; }
void display_smt2(std::ostream& strm, expr* n);
void display_expr_smt2(std::ostream& strm, expr* n, unsigned indent = 0, unsigned num_var_names = 0, char const* const* var_names = 0);
void display_ast_smt2(std::ostream& strm, ast* n, unsigned indent = 0, unsigned num_var_names = 0, char const* const* var_names = 0);
void display_expr_smt2(std::ostream& strm, expr* n, unsigned indent = 0, unsigned num_var_names = 0, char const* const* var_names = nullptr);
void display_ast_smt2(std::ostream& strm, ast* n, unsigned indent = 0, unsigned num_var_names = 0, char const* const* var_names = nullptr);
};
@ -87,7 +87,7 @@ struct mk_smt_pp {
unsigned m_indent;
unsigned m_num_var_names;
char const* const* m_var_names;
mk_smt_pp(ast* e, ast_manager & m, unsigned indent = 0, unsigned num_var_names = 0, char const* const* var_names = 0) :
mk_smt_pp(ast* e, ast_manager & m, unsigned indent = 0, unsigned num_var_names = 0, char const* const* var_names = nullptr) :
m_ast(e), m_manager(m), m_indent(indent), m_num_var_names(num_var_names), m_var_names(var_names) {}
};

View file

@ -108,7 +108,7 @@ void ast_translation::copy_params(decl * d, unsigned rpos, buffer<parameter> & p
void ast_translation::mk_sort(sort * s, frame & fr) {
sort_info * si = s->get_info();
sort * new_s;
if (si == 0) {
if (si == nullptr) {
// TODO: investigate: this branch is probably unreachable.
// It became unreachable after we started using mk_uninterpreted_sort for creating uninterpreted sorts,
// and mk_uninterpreted_sort actually creates a user_sort.
@ -139,7 +139,7 @@ void ast_translation::mk_func_decl(func_decl * f, frame & fr) {
sort ** new_domain = reinterpret_cast<sort**>(m_result_stack.c_ptr() + fr.m_rpos + num_extra);
sort * new_range = static_cast<sort*>(m_result_stack.back());
func_decl * new_f;
if (fi == 0) {
if (fi == nullptr) {
new_f = m_to_manager.mk_func_decl(f->get_name(),
f->get_arity(),
new_domain,
@ -182,7 +182,7 @@ void ast_translation::mk_func_decl(func_decl * f, frame & fr) {
}
ast * ast_translation::process(ast const * _n) {
if (!_n) return 0;
if (!_n) return nullptr;
SASSERT(m_result_stack.empty());
SASSERT(m_frame_stack.empty());
SASSERT(m_extra_children_stack.empty());
@ -320,7 +320,7 @@ ast * ast_translation::process(ast const * _n) {
}
expr_dependency * expr_dependency_translation::operator()(expr_dependency * d) {
if (d == 0)
if (d == nullptr)
return d;
m_buffer.reset();
m_translation.from().linearize(d, m_buffer);

View file

@ -38,7 +38,7 @@ app * mk_list_assoc_app(ast_manager & m, func_decl * f, unsigned num_args, expr
}
app * mk_list_assoc_app(ast_manager & m, family_id fid, decl_kind k, unsigned num_args, expr * const * args) {
func_decl * decl = m.mk_func_decl(fid, k, 0, 0, num_args, args, 0);
func_decl * decl = m.mk_func_decl(fid, k, 0, nullptr, num_args, args, nullptr);
SASSERT(decl != 0);
SASSERT(decl->is_associative());
return mk_list_assoc_app(m, decl, num_args, args);

View file

@ -34,11 +34,11 @@ bv_decl_plugin::bv_decl_plugin():
m_repeat_sym("repeat"),
m_bit2bool_sym("bit2bool"),
m_mkbv_sym("mkbv"),
m_bit0(0),
m_bit1(0),
m_carry(0),
m_xor3(0),
m_int_sort(0) {
m_bit0(nullptr),
m_bit1(nullptr),
m_carry(nullptr),
m_xor3(nullptr),
m_int_sort(nullptr) {
}
void bv_decl_plugin::set_manager(ast_manager * m, family_id id) {
@ -218,7 +218,7 @@ func_decl * bv_decl_plugin::mk_int2bv(unsigned bv_size, unsigned num_parameters,
if (arity != 1) {
m_manager->raise_exception("expecting one argument to int2bv");
return 0;
return nullptr;
}
if (m_int2bv[bv_size] == 0) {
@ -237,7 +237,7 @@ func_decl * bv_decl_plugin::mk_bv2int(unsigned bv_size, unsigned num_parameters,
if (arity != 1) {
m_manager->raise_exception("expecting one argument to bv2int");
return 0;
return nullptr;
}
if (m_bv2int[bv_size] == 0) {
@ -341,7 +341,7 @@ func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned bv_size) {
case OP_EXT_ROTATE_LEFT: return mk_binary(m_ext_rotate_left, k, "ext_rotate_left", bv_size, false);
case OP_EXT_ROTATE_RIGHT: return mk_binary(m_ext_rotate_right, k, "ext_rotate_right", bv_size, false);
default: return 0;
default: return nullptr;
}
}
@ -417,7 +417,7 @@ bool bv_decl_plugin::get_int2bv_size(unsigned num_parameters, parameter const *
func_decl * bv_decl_plugin::mk_num_decl(unsigned num_parameters, parameter const * parameters, unsigned arity) {
if (!(num_parameters == 2 && arity == 0 && parameters[0].is_rational() && parameters[1].is_int())) {
m_manager->raise_exception("invalid bit-vector numeral declaration");
return 0;
return nullptr;
}
unsigned bv_size = parameters[1].get_int();
if (bv_size == 0) {
@ -437,7 +437,7 @@ func_decl * bv_decl_plugin::mk_bit2bool(unsigned bv_size, unsigned num_parameter
unsigned arity, sort * const * domain) {
if (!(num_parameters == 1 && parameters[0].is_int() && arity == 1 && parameters[0].get_int() < static_cast<int>(bv_size))) {
m_manager->raise_exception("invalid bit2bool declaration");
return 0;
return nullptr;
}
unsigned idx = parameters[0].get_int();
m_bit2bool.reserve(bv_size+1);
@ -455,7 +455,7 @@ func_decl * bv_decl_plugin::mk_mkbv(unsigned arity, sort * const * domain) {
for (unsigned i = 0; i < arity; i++) {
if (!m_manager->is_bool(domain[i])) {
m_manager->raise_exception("invalid mkbv operator");
return 0;
return nullptr;
}
}
unsigned bv_size = arity;
@ -493,26 +493,26 @@ func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
}
else if (arity == 0) {
m_manager->raise_exception("no arguments supplied to bit-vector operator");
return 0;
return nullptr;
}
else if (!get_bv_size(domain[0], bv_size)) {
m_manager->raise_exception("could not extract bit-vector size");
return 0;
return nullptr;
}
func_decl * r = mk_func_decl(k, bv_size);
if (r != 0) {
if (r != nullptr) {
if (arity != r->get_arity()) {
if (r->get_info()->is_associative())
arity = r->get_arity();
else {
m_manager->raise_exception("declared arity mismatches supplied arity");
return 0;
return nullptr;
}
}
for (unsigned i = 0; i < arity; ++i) {
if (domain[i] != r->get_domain(i)) {
m_manager->raise_exception("declared sorts do not match supplied sorts");
return 0;
return nullptr;
}
}
return r;
@ -565,7 +565,7 @@ func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
return m_manager->mk_func_decl(m_repeat_sym, arity, domain, get_bv_sort(bv_size * parameters[0].get_int()),
func_decl_info(m_family_id, k, num_parameters, parameters));
default:
return 0;
return nullptr;
}
}
@ -596,24 +596,24 @@ func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
}
else if (num_args == 0 || !get_bv_size(args[0], bv_size)) {
m.raise_exception("operator is applied to arguments of the wrong sort");
return 0;
return nullptr;
}
func_decl * r = mk_func_decl(k, bv_size);
if (r != 0) {
if (r != nullptr) {
if (num_args != r->get_arity()) {
if (r->get_info()->is_associative()) {
sort * fs = r->get_domain(0);
for (unsigned i = 0; i < num_args; ++i) {
if (m.get_sort(args[i]) != fs) {
m_manager->raise_exception("declared sorts do not match supplied sorts");
return 0;
return nullptr;
}
}
return r;
}
else {
m.raise_exception("declared arity mismatches supplied arity");
return 0;
return nullptr;
}
}
for (unsigned i = 0; i < num_args; ++i) {
@ -621,7 +621,7 @@ func_decl * bv_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
std::ostringstream buffer;
buffer << "Argument " << mk_pp(args[i], m) << " at position " << i << " does not match declaration " << mk_pp(r, m);
m.raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
}
return r;
@ -747,7 +747,7 @@ expr * bv_decl_plugin::get_some_value(sort * s) {
SASSERT(s->is_sort_of(m_family_id, BV_SORT));
unsigned bv_size = s->get_parameter(0).get_int();
parameter p[2] = { parameter(rational(0)), parameter(static_cast<int>(bv_size)) };
return m_manager->mk_app(m_family_id, OP_BV_NUM, 2, p, 0, 0);
return m_manager->mk_app(m_family_id, OP_BV_NUM, 2, p, 0, nullptr);
}
rational bv_recognizers::norm(rational const & val, unsigned bv_size, bool is_signed) const {
@ -856,7 +856,7 @@ bv_util::bv_util(ast_manager & m):
app * bv_util::mk_numeral(rational const & val, sort* s) const {
if (!is_bv_sort(s)) {
return 0;
return nullptr;
}
unsigned bv_size = get_bv_size(s);
return mk_numeral(val, bv_size);
@ -864,7 +864,7 @@ app * bv_util::mk_numeral(rational const & val, sort* s) const {
app * bv_util::mk_numeral(rational const & val, unsigned bv_size) const {
parameter p[2] = { parameter(val), parameter(static_cast<int>(bv_size)) };
return m_manager.mk_app(get_fid(), OP_BV_NUM, 2, p, 0, 0);
return m_manager.mk_app(get_fid(), OP_BV_NUM, 2, p, 0, nullptr);
}
sort * bv_util::mk_sort(unsigned bv_size) {

View file

@ -122,7 +122,7 @@ inline bv_op_kind get_div0_op(bv_op_kind k) {
// models the value of "div" it is underspecified (i.e., when the denominator is zero).
inline func_decl * get_div0_decl(ast_manager & m, func_decl * decl) {
return m.mk_func_decl(decl->get_family_id(), get_div0_op(static_cast<bv_op_kind>(decl->get_decl_kind())),
0, 0, 1, decl->get_domain());
0, nullptr, 1, decl->get_domain());
}
class bv_decl_plugin : public decl_plugin {

View file

@ -157,13 +157,13 @@ namespace datatype {
dealloc(kv.m_value);
}
m_defs.reset();
m_util = 0; // force deletion
m_util = nullptr; // force deletion
}
util & plugin::u() const {
SASSERT(m_manager);
SASSERT(m_family_id != null_family_id);
if (m_util.get() == 0) {
if (m_util.get() == nullptr) {
m_util = alloc(util, *m_manager);
}
return *(m_util.get());
@ -215,7 +215,7 @@ namespace datatype {
sort* s = m_manager->mk_sort(name.get_symbol(),
sort_info(m_family_id, k, num_parameters, parameters, true));
def* d = 0;
def* d = nullptr;
if (m_defs.find(s->get_name(), d) && d->sort_size()) {
obj_map<sort, sort_size> S;
for (unsigned i = 0; i + 1 < num_parameters; ++i) {
@ -233,7 +233,7 @@ namespace datatype {
}
catch (invalid_datatype) {
m_manager->raise_exception("invalid datatype");
return 0;
return nullptr;
}
}
@ -245,35 +245,35 @@ namespace datatype {
if (num_parameters != 1 || !parameters[0].is_ast()) {
m.raise_exception("invalid parameters for datatype field update");
return 0;
return nullptr;
}
if (arity != 2) {
m.raise_exception("invalid number of arguments for datatype field update");
return 0;
return nullptr;
}
func_decl* acc = 0;
func_decl* acc = nullptr;
if (is_func_decl(parameters[0].get_ast())) {
acc = to_func_decl(parameters[0].get_ast());
}
if (acc && !u().is_accessor(acc)) {
acc = 0;
acc = nullptr;
}
if (!acc) {
m.raise_exception("datatype field update requires a datatype accessor as the second argument");
return 0;
return nullptr;
}
sort* dom = acc->get_domain(0);
sort* rng = acc->get_range();
if (dom != domain[0]) {
m.raise_exception("first argument to field update should be a data-type");
return 0;
return nullptr;
}
if (rng != domain[1]) {
std::ostringstream buffer;
buffer << "second argument to field update should be " << mk_ismt2_pp(rng, m)
<< " instead of " << mk_ismt2_pp(domain[1], m);
m.raise_exception(buffer.str().c_str());
return 0;
return nullptr;
}
range = domain[0];
func_decl_info info(m_family_id, k, num_parameters, parameters);
@ -345,7 +345,7 @@ namespace datatype {
return mk_update_field(num_parameters, parameters, arity, domain, range);
default:
m_manager->raise_exception("invalid datatype operator kind");
return 0;
return nullptr;
}
}
@ -386,7 +386,7 @@ namespace datatype {
bool plugin::mk_datatypes(unsigned num_datatypes, def * const * datatypes, unsigned num_params, sort* const* sort_params, sort_ref_vector & new_sorts) {
begin_def_block();
for (unsigned i = 0; i < num_datatypes; ++i) {
def* d = 0;
def* d = nullptr;
TRACE("datatype", tout << "declaring " << datatypes[i]->name() << "\n";);
if (m_defs.find(datatypes[i]->name(), d)) {
TRACE("datatype", tout << "delete previous version for " << datatypes[i]->name() << "\n";);
@ -404,7 +404,7 @@ namespace datatype {
}
void plugin::remove(symbol const& s) {
def* d = 0;
def* d = nullptr;
if (m_defs.find(s, d)) dealloc(d);
m_defs.remove(s);
}
@ -750,7 +750,7 @@ namespace datatype {
ptr_vector<func_decl> const * util::get_datatype_constructors(sort * ty) {
SASSERT(is_datatype(ty));
ptr_vector<func_decl> * r = 0;
ptr_vector<func_decl> * r = nullptr;
if (m_datatype2constructors.find(ty, r))
return r;
r = alloc(ptr_vector<func_decl>);
@ -768,7 +768,7 @@ namespace datatype {
ptr_vector<func_decl> const * util::get_constructor_accessors(func_decl * con) {
SASSERT(is_constructor(con));
ptr_vector<func_decl> * res = 0;
ptr_vector<func_decl> * res = nullptr;
if (m_constructor2accessors.find(con, res)) {
return res;
}
@ -793,7 +793,7 @@ namespace datatype {
func_decl * util::get_constructor_recognizer(func_decl * con) {
SASSERT(is_constructor(con));
func_decl * d = 0;
func_decl * d = nullptr;
if (m_constructor2recognizer.find(con, d))
return d;
sort * datatype = con->get_range();
@ -848,7 +848,7 @@ namespace datatype {
func_decl * util::get_accessor_constructor(func_decl * accessor) {
SASSERT(is_accessor(accessor));
func_decl * r = 0;
func_decl * r = nullptr;
if (m_accessor2constructor.find(accessor, r))
return r;
sort * datatype = accessor->get_domain(0);
@ -892,10 +892,10 @@ namespace datatype {
*/
func_decl * util::get_non_rec_constructor(sort * ty) {
SASSERT(is_datatype(ty));
func_decl * r = 0;
func_decl * r = nullptr;
if (m_datatype2nonrec_constructor.find(ty, r))
return r;
r = 0;
r = nullptr;
ptr_vector<sort> forbidden_set;
forbidden_set.push_back(ty);
TRACE("util_bug", tout << "invoke get-non-rec: " << sort_ref(ty, m) << "\n";);
@ -962,14 +962,14 @@ namespace datatype {
func_decl * nested_c = get_non_rec_constructor_core(T_i, forbidden_set);
SASSERT(forbidden_set.back() == T_i);
forbidden_set.pop_back();
if (nested_c == 0)
if (nested_c == nullptr)
break;
TRACE("util_bug", tout << "nested_c: " << nested_c->get_name() << "\n";);
}
if (i == num_args)
return c;
}
return 0;
return nullptr;
}
unsigned util::get_constructor_idx(func_decl * f) const {

View file

@ -204,7 +204,7 @@ namespace datatype {
m_util(u),
m_name(n),
m_class_id(class_id),
m_sort_size(0),
m_sort_size(nullptr),
m_params(m, num_params, params),
m_sort(m)
{}
@ -228,7 +228,7 @@ namespace datatype {
sort_ref_vector const& params() const { return m_params; }
util& u() const { return m_util; }
param_size::size* sort_size() { return m_sort_size; }
void set_sort_size(param_size::size* p) { m_sort_size = p; p->inc_ref(); m_sort = 0; }
void set_sort_size(param_size::size* p) { m_sort_size = p; p->inc_ref(); m_sort = nullptr; }
def* translate(ast_translation& tr, util& u);
};
@ -398,7 +398,7 @@ typedef datatype::util datatype_util;
class type_ref {
void * m_data;
public:
type_ref():m_data(TAG(void *, static_cast<void*>(0), 1)) {}
type_ref():m_data(TAG(void *, nullptr, 1)) {}
type_ref(int idx):m_data(BOXINT(void *, idx)) {}
type_ref(sort * s):m_data(TAG(void *, s, 1)) {}

View file

@ -72,7 +72,7 @@ namespace datalog {
for (unsigned i = 0; is_finite && i < num_parameters; ++i) {
if (!parameters[i].is_ast() || !is_sort(parameters[i].get_ast())) {
m_manager->raise_exception("expecting sort parameters");
return 0;
return nullptr;
}
sort* s = to_sort(parameters[i].get_ast());
sort_size sz1 = s->get_num_elements();
@ -97,16 +97,16 @@ namespace datalog {
sort * dl_decl_plugin::mk_finite_sort(unsigned num_params, parameter const* params) {
if (num_params != 2) {
m_manager->raise_exception("expecting two parameters");
return 0;
return nullptr;
}
if (!params[0].is_symbol()) {
m_manager->raise_exception("expecting symbol");
return 0;
return nullptr;
}
if (!params[1].is_rational() || !params[1].get_rational().is_uint64()) {
m_manager->raise_exception("expecting rational");
return 0;
return nullptr;
}
sort_size sz = sort_size::mk_finite(params[1].get_rational().get_uint64());
sort_info info(m_family_id, DL_FINITE_SORT, sz, num_params, params);
@ -115,7 +115,7 @@ namespace datalog {
sort* dl_decl_plugin::mk_rule_sort() {
sort_size sz(sort_size::mk_infinite());
sort_info info(m_family_id, DL_RULE_SORT, sz, 0, 0);
sort_info info(m_family_id, DL_RULE_SORT, sz, 0, nullptr);
return m_manager->mk_sort(m_rule_sym, info);
}
@ -130,7 +130,7 @@ namespace datalog {
default:
UNREACHABLE();
}
return 0;
return nullptr;
}
bool dl_decl_plugin::is_rel_sort(sort* r) {
@ -173,11 +173,11 @@ namespace datalog {
}
ptr_vector<sort> sorts;
if (!is_rel_sort(r, sorts)) {
return 0;
return nullptr;
}
if (sorts.size() + 1 != arity) {
m_manager->raise_exception("wrong arity supplied to relational access");
return 0;
return nullptr;
}
for (unsigned i = 0; i < sorts.size(); ++i) {
if (sorts[i] != domain[i+1]) {
@ -186,10 +186,10 @@ namespace datalog {
mk_pp(sorts[i], m) << "\n" <<
mk_pp(domain[i+1], m) << "\n";);
m_manager->raise_exception("sort miss-match for relational access");
return 0;
return nullptr;
}
}
func_decl_info info(m_family_id, k, 0, 0);
func_decl_info info(m_family_id, k, 0, nullptr);
return m.mk_func_decl(sym, arity, domain, r, info);
}
@ -197,14 +197,14 @@ namespace datalog {
ast_manager& m = *m_manager;
if (!p.is_ast() || !is_sort(p.get_ast())) {
m_manager->raise_exception("expected sort parameter");
return 0;
return nullptr;
}
sort* r = to_sort(p.get_ast());
if (!is_rel_sort(r)) {
return 0;
return nullptr;
}
func_decl_info info(m_family_id, OP_RA_EMPTY, 1, &p);
return m.mk_func_decl(m_empty_sym, 0, (sort*const*)0, r, info);
return m.mk_func_decl(m_empty_sym, 0, (sort*const*)nullptr, r, info);
}
func_decl* dl_decl_plugin::mk_project(unsigned num_params, parameter const* params, sort* r) {
@ -219,7 +219,7 @@ namespace datalog {
tout << "\n";
);
if (!is_rel_sort(r, sorts)) {
return 0;
return nullptr;
}
SASSERT(sorts.size() >= num_params);
// populate ps
@ -227,12 +227,12 @@ namespace datalog {
for (; i < num_params; ++i) {
if (!params[i].is_int()) {
m_manager->raise_exception("expecting integer parameter");
return 0;
return nullptr;
}
unsigned k = params[i].get_int();
if (j > k) {
m_manager->raise_exception("arguments to projection should be increasing");
return 0;
return nullptr;
}
while (j < k) {
ps.push_back(parameter(sorts[j]));
@ -253,13 +253,13 @@ namespace datalog {
ast_manager& m = *m_manager;
if (s1 != s2) {
m_manager->raise_exception("sort miss-match for arguments to union");
return 0;
return nullptr;
}
if (!is_rel_sort(s1)) {
return 0;
return nullptr;
}
sort* domain[2] = { s1, s2 };
func_decl_info info(m_family_id, k, 0, 0);
func_decl_info info(m_family_id, k, 0, nullptr);
return m.mk_func_decl(m_union_sym, 2, domain, s1, info);
}
@ -267,7 +267,7 @@ namespace datalog {
ast_manager& m = *m_manager;
ptr_vector<sort> sorts;
if (!is_rel_sort(r, sorts)) {
return 0;
return nullptr;
}
if (!p.is_ast() || !is_expr(p.get_ast())) {
m_manager->raise_exception("ast expression expected to filter");
@ -277,7 +277,7 @@ namespace datalog {
// 2. the free variables in f correspond to column types of r.
if (!m.is_bool(f)) {
m_manager->raise_exception("filter predicate should be of Boolean type");
return 0;
return nullptr;
}
ptr_vector<expr> todo;
todo.push_back(f);
@ -295,11 +295,11 @@ namespace datalog {
idx = to_var(e)->get_idx();
if (idx >= sorts.size()) {
m_manager->raise_exception("illegal index");
return 0;
return nullptr;
}
if (sorts[idx] != m.get_sort(e)) {
m_manager->raise_exception("sort miss-match in filter");
return 0;
return nullptr;
}
break;
case AST_APP:
@ -309,10 +309,10 @@ namespace datalog {
break;
case AST_QUANTIFIER:
m_manager->raise_exception("quantifiers are not allowed in filter expressions");
return 0;
return nullptr;
default:
m_manager->raise_exception("unexpected filter expression kind");
return 0;
return nullptr;
}
}
func_decl_info info(m_family_id, OP_RA_FILTER, 1, &p);
@ -322,23 +322,23 @@ namespace datalog {
func_decl * dl_decl_plugin::mk_rename(unsigned num_params, parameter const* params, sort* r) {
ptr_vector<sort> sorts;
if (!is_rel_sort(r, sorts)) {
return 0;
return nullptr;
}
unsigned index0 = 0;
sort* last_sort = 0;
sort* last_sort = nullptr;
SASSERT(num_params > 0);
for (unsigned i = 0; i < num_params; ++i) {
parameter const& p = params[i];
if (!p.is_int()) {
m_manager->raise_exception("expected integer parameter");
return 0;
return nullptr;
}
unsigned j = p.get_int();
if (j >= sorts.size()) {
// We should not use ast_pp anymore on error messages.
// m_manager->raise_exception("index %d out of bound %s : %d", j, ast_pp(r, *m_manager).c_str(), sorts.size());
m_manager->raise_exception("index out of bound");
return 0;
return nullptr;
}
if (i == 0) {
index0 = j;
@ -362,10 +362,10 @@ namespace datalog {
vector<parameter> params2;
ptr_vector<sort> sorts1, sorts2;
if (!is_rel_sort(r1, sorts1)) {
return 0;
return nullptr;
}
if (!is_rel_sort(r2, sorts2)) {
return 0;
return nullptr;
}
for (unsigned i = 0; i < sorts1.size(); ++i) {
params2.push_back(parameter(sorts1[i]));
@ -375,24 +375,24 @@ namespace datalog {
}
if (0 != num_params % 2) {
m_manager->raise_exception("expecting an even number of parameters to join");
return 0;
return nullptr;
}
for (unsigned i = 0; i + 1 < num_params; i += 2) {
parameter const& p1 = params[i];
parameter const& p2 = params[i+1];
if (!p1.is_int() || !p2.is_int()) {
m_manager->raise_exception("encountered non-integer parameter");
return 0;
return nullptr;
}
unsigned i1 = p1.get_int();
unsigned i2 = p2.get_int();
if (i1 >= sorts1.size() || i2 >= sorts2.size()) {
m_manager->raise_exception("index out of bounds");
return 0;
return nullptr;
}
if (sorts1[i1] != sorts2[i2]) {
m_manager->raise_exception("sort miss-match in join");
return 0;
return nullptr;
}
}
sort* args[2] = { r1, r2 };
@ -403,40 +403,40 @@ namespace datalog {
func_decl* dl_decl_plugin::mk_complement(sort* s) {
if (!is_rel_sort(s)) {
return 0;
return nullptr;
}
func_decl_info info(m_family_id, OP_RA_COMPLEMENT, 0, 0);
func_decl_info info(m_family_id, OP_RA_COMPLEMENT, 0, nullptr);
return m_manager->mk_func_decl(m_complement_sym, 1, &s, s, info);
}
func_decl * dl_decl_plugin::mk_negation_filter(unsigned num_params, parameter const* params, sort* r1, sort* r2) {
ptr_vector<sort> sorts1, sorts2;
if (!is_rel_sort(r1, sorts1)) {
return 0;
return nullptr;
}
if (!is_rel_sort(r2, sorts2)) {
return 0;
return nullptr;
}
if (0 != num_params % 2) {
m_manager->raise_exception("expecting an even number of parameters to negation filter");
return 0;
return nullptr;
}
for (unsigned i = 0; i + 1 < num_params; i += 2) {
parameter const& p1 = params[i];
parameter const& p2 = params[i+1];
if (!p1.is_int() || !p2.is_int()) {
m_manager->raise_exception("encountered non-integer parameter");
return 0;
return nullptr;
}
unsigned i1 = p1.get_int();
unsigned i2 = p2.get_int();
if (i1 >= sorts1.size() || i2 >= sorts2.size()) {
m_manager->raise_exception("index out of bounds");
return 0;
return nullptr;
}
if (sorts1[i1] != sorts2[i2]) {
m_manager->raise_exception("sort miss-match in join");
return 0;
return nullptr;
}
}
sort* args[2] = { r1, r2 };
@ -446,9 +446,9 @@ namespace datalog {
func_decl * dl_decl_plugin::mk_is_empty(sort* s) {
if (!is_rel_sort(s)) {
return 0;
return nullptr;
}
func_decl_info info(m_family_id, OP_RA_IS_EMPTY, 0, 0);
func_decl_info info(m_family_id, OP_RA_IS_EMPTY, 0, nullptr);
sort* rng = m_manager->mk_bool_sort();
return m_manager->mk_func_decl(m_is_empty_sym, 1, &s, rng, info);
}
@ -458,35 +458,35 @@ namespace datalog {
parameter const& ps = params[1];
if (!p.is_rational() || !p.get_rational().is_uint64()) {
m_manager->raise_exception("first parameter should be a rational");
return 0;
return nullptr;
}
if (!ps.is_ast() || !is_sort(ps.get_ast()) || !is_fin_sort(to_sort(ps.get_ast()))) {
m_manager->raise_exception("second parameter should be a finite domain sort");
return 0;
return nullptr;
}
sort* s = to_sort(ps.get_ast());
func_decl_info info(m_family_id, OP_DL_CONSTANT, 2, params);
return m_manager->mk_func_decl(m_num_sym, 0, (sort*const*)0, s, info);
return m_manager->mk_func_decl(m_num_sym, 0, (sort*const*)nullptr, s, info);
}
func_decl * dl_decl_plugin::mk_compare(decl_kind k, symbol const& sym, sort *const* domain) {
if (!is_sort_of(domain[0], m_family_id, DL_FINITE_SORT)) {
m_manager->raise_exception("expecting finite domain sort");
return 0;
return nullptr;
}
if (domain[0] != domain[1]) {
m_manager->raise_exception("expecting two identical finite domain sorts");
return 0;
return nullptr;
}
func_decl_info info(m_family_id, k, 0, 0);
func_decl_info info(m_family_id, k, 0, nullptr);
return m_manager->mk_func_decl(sym, 2, domain, m_manager->mk_bool_sort(), info);
}
func_decl * dl_decl_plugin::mk_clone(sort* s) {
if (!is_rel_sort(s)) {
return 0;
return nullptr;
}
func_decl_info info(m_family_id, OP_RA_CLONE, 0, 0);
func_decl_info info(m_family_id, OP_RA_CLONE, 0, nullptr);
return m_manager->mk_func_decl(m_clone_sym, 1, &s, s, info);
}
@ -494,14 +494,14 @@ namespace datalog {
func_decl * dl_decl_plugin::mk_func_decl(
decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
func_decl* result = 0;
func_decl* result = nullptr;
switch(k) {
case OP_RA_STORE:
case OP_RA_SELECT:
if (!check_params(0, 0, num_parameters) ||
!check_domain(1, UINT_MAX, arity)) {
return 0;
return nullptr;
}
result = mk_store_select(k, arity, domain);
break;
@ -509,7 +509,7 @@ namespace datalog {
case OP_RA_EMPTY:
if (!check_params( 1, 1, num_parameters) ||
!check_domain(0, 0, arity)) {
return 0;
return nullptr;
}
result = mk_empty(parameters[0]);
break;
@ -517,7 +517,7 @@ namespace datalog {
case OP_RA_JOIN:
if (!check_params(0, UINT_MAX, num_parameters) ||
!check_domain(2, 2, arity)) {
return 0;
return nullptr;
}
result = mk_join(num_parameters, parameters, domain[0], domain[1]);
break;
@ -526,7 +526,7 @@ namespace datalog {
case OP_RA_WIDEN:
if (!check_params( 0, 0, num_parameters) ||
!check_domain(2, 2, arity)) {
return 0;
return nullptr;
}
result = mk_unionw(k, domain[0], domain[1]);
break;
@ -534,7 +534,7 @@ namespace datalog {
case OP_RA_PROJECT:
if (!check_params( 1, UINT_MAX, num_parameters) ||
!check_domain(1, 1, arity)) {
return 0;
return nullptr;
}
result = mk_project(num_parameters, parameters, domain[0]);
break;
@ -542,7 +542,7 @@ namespace datalog {
case OP_RA_FILTER:
if (!check_params( 1, 1, num_parameters) ||
!check_domain(1, 1, arity)) {
return 0;
return nullptr;
}
result = mk_filter(parameters[0], domain[0]);
break;
@ -550,7 +550,7 @@ namespace datalog {
case OP_RA_IS_EMPTY:
if (!check_params( 0, 0, num_parameters) ||
!check_domain(1, 1, arity)) {
return 0;
return nullptr;
}
result = mk_is_empty(domain[0]);
break;
@ -558,7 +558,7 @@ namespace datalog {
case OP_RA_RENAME:
if (!check_params( 2, UINT_MAX, num_parameters) ||
!check_domain(1, 1, arity)) {
return 0;
return nullptr;
}
result = mk_rename(num_parameters, parameters, domain[0]);
break;
@ -566,7 +566,7 @@ namespace datalog {
case OP_RA_COMPLEMENT:
if (!check_params( 0, 0, num_parameters) ||
!check_domain(1, 1, arity)) {
return 0;
return nullptr;
}
result = mk_complement(domain[0]);
break;
@ -574,14 +574,14 @@ namespace datalog {
case OP_RA_NEGATION_FILTER:
if (!check_params(1, UINT_MAX, num_parameters) ||
!check_domain(2, 2, arity)) {
return 0;
return nullptr;
}
result = mk_negation_filter(num_parameters, parameters, domain[0], domain[1]);
break;
case OP_RA_CLONE:
if (!check_params(0, 0, num_parameters) || !check_domain(1, 1, arity)) {
return 0;
return nullptr;
}
result = mk_clone(domain[0]);
break;
@ -589,7 +589,7 @@ namespace datalog {
case OP_DL_CONSTANT:
if (!check_params( 2, 2, num_parameters) ||
!check_domain(0, 0, arity)) {
return 0;
return nullptr;
}
result = mk_constant(parameters);
break;
@ -597,23 +597,23 @@ namespace datalog {
case OP_DL_LT:
if (!check_params( 0, 0, num_parameters) ||
!check_domain(2, 2, arity)) {
return 0;
return nullptr;
}
result = mk_compare(OP_DL_LT, m_lt_sym, domain);
break;
case OP_DL_REP: {
if (!check_domain(0, 0, num_parameters) ||
!check_domain(1, 1, arity)) return 0;
func_decl_info info(m_family_id, k, 0, 0);
!check_domain(1, 1, arity)) return nullptr;
func_decl_info info(m_family_id, k, 0, nullptr);
result = m_manager->mk_func_decl(symbol("rep"), 1, domain, range, info);
break;
}
case OP_DL_ABS: {
if (!check_domain(0, 0, num_parameters) ||
!check_domain(1, 1, arity)) return 0;
func_decl_info info(m_family_id, k, 0, 0);
!check_domain(1, 1, arity)) return nullptr;
func_decl_info info(m_family_id, k, 0, nullptr);
result = m_manager->mk_func_decl(symbol("abs"), 1, domain, range, info);
break;
}
@ -621,7 +621,7 @@ namespace datalog {
default:
m_manager->raise_exception("operator not recognized");
return 0;
return nullptr;
}
TRACE("dl_decl_plugin", tout << mk_pp(result, *m_manager) << "\n";);
@ -659,7 +659,7 @@ namespace datalog {
m.raise_exception("value is out of bounds");
}
parameter params[2] = { parameter(rational(value, rational::ui64())), parameter(s) };
return m.mk_const(m.mk_func_decl(m_fid, OP_DL_CONSTANT, 2, params, 0, (sort*const*)0));
return m.mk_const(m.mk_func_decl(m_fid, OP_DL_CONSTANT, 2, params, 0, (sort*const*)nullptr));
}
if (m_arith.is_int(s) || m_arith.is_real(s)) {
return m_arith.mk_numeral(rational(value, rational::ui64()), s);
@ -677,7 +677,7 @@ namespace datalog {
std::stringstream strm;
strm << "sort '" << mk_pp(s, m) << "' is not recognized as a sort that contains numeric values.\nUse Bool, BitVec, Int, Real, or a Finite domain sort";
m.raise_exception(strm.str().c_str());
return 0;
return nullptr;
}
bool dl_decl_util::is_numeral(const expr* e, uint64& v) const {
@ -745,12 +745,12 @@ namespace datalog {
app* dl_decl_util::mk_lt(expr* a, expr* b) {
expr* args[2] = { a, b };
return m.mk_app(m_fid, OP_DL_LT, 0, 0, 2, args);
return m.mk_app(m_fid, OP_DL_LT, 0, nullptr, 2, args);
}
app* dl_decl_util::mk_le(expr* a, expr* b) {
expr* args[2] = { b, a };
return m.mk_not(m.mk_app(m_fid, OP_DL_LT, 0, 0, 2, args));
return m.mk_not(m.mk_app(m_fid, OP_DL_LT, 0, nullptr, 2, args));
}
sort* dl_decl_util::mk_rule_sort() {

View file

@ -204,9 +204,9 @@ namespace datalog {
sort* mk_rule_sort();
app* mk_rule(symbol const& name, unsigned num_args = 0, expr* const* args = 0);
app* mk_rule(symbol const& name, unsigned num_args = 0, expr* const* args = nullptr);
app* mk_fact(symbol const& name) { return mk_rule(name, 0, 0); }
app* mk_fact(symbol const& name) { return mk_rule(name, 0, nullptr); }
ast_manager& get_manager() const { return m; }

View file

@ -29,7 +29,7 @@ struct expr2polynomial::imp {
struct frame {
app * m_curr;
unsigned m_idx;
frame():m_curr(0), m_idx(0) {}
frame():m_curr(nullptr), m_idx(0) {}
frame(app * t):m_curr(t), m_idx(0) {}
};
@ -59,8 +59,8 @@ struct expr2polynomial::imp {
m_am(am),
m_autil(am),
m_pm(pm),
m_expr2var(e2v == 0 && !use_var_idxs ? alloc(expr2var, am) : e2v),
m_expr2var_owner(e2v == 0 && !use_var_idxs),
m_expr2var(e2v == nullptr && !use_var_idxs ? alloc(expr2var, am) : e2v),
m_expr2var_owner(e2v == nullptr && !use_var_idxs),
m_var2expr(am),
m_cached_domain(am),
m_cached_polynomials(pm),
@ -156,7 +156,7 @@ struct expr2polynomial::imp {
x = m_wrapper.mk_var(is_int);
m_expr2var->insert(t, x);
if (x >= m_var2expr.size())
m_var2expr.resize(x+1, 0);
m_var2expr.resize(x+1, nullptr);
m_var2expr.set(x, t);
}
}
@ -502,7 +502,7 @@ void expr2polynomial::set_cancel(bool f) {
}
default_expr2polynomial::default_expr2polynomial(ast_manager & am, polynomial::manager & pm):
expr2polynomial(am, pm, 0) {
expr2polynomial(am, pm, nullptr) {
}
default_expr2polynomial::~default_expr2polynomial() {

View file

@ -64,7 +64,7 @@ void expr2var::mk_inv(expr_ref_vector & var2expr) const {
expr * t = it->m_key;
var x = it->m_value;
if (x >= var2expr.size())
var2expr.resize(x+1, 0);
var2expr.resize(x+1, nullptr);
var2expr.set(x, t);
}
}

View file

@ -27,7 +27,7 @@ void expr_abstractor::operator()(unsigned base, unsigned num_bound, expr* const*
result = n;
return;
}
expr * curr = 0, *b = 0;
expr * curr = nullptr, *b = nullptr;
SASSERT(n->get_ref_count() > 0);
m_stack.push_back(n);

View file

@ -26,7 +26,7 @@ struct expr_delta_pair {
expr * m_node;
unsigned m_delta;
expr_delta_pair():m_node(0), m_delta(0) {}
expr_delta_pair():m_node(nullptr), m_delta(0) {}
expr_delta_pair(expr * n, unsigned d):m_node(n), m_delta(d) {}
unsigned hash() const { return hash_u_u(m_node->hash(), m_delta); }
bool operator==(const expr_delta_pair & e) const { return m_node == e.m_node && m_delta == e.m_delta; }

View file

@ -121,22 +121,22 @@ void map_proc::reconstruct(app* a) {
}
if (is_new) {
expr* b = m.mk_app(a->get_decl(), m_args.size(), m_args.c_ptr());
m_map.insert(a, b, 0);
m_map.insert(a, b, nullptr);
}
else {
m_map.insert(a, a, 0);
m_map.insert(a, a, nullptr);
}
}
void map_proc::visit(quantifier* e) {
expr_ref q(m);
q = m.update_quantifier(e, get_expr(e->get_expr()));
m_map.insert(e, q, 0);
m_map.insert(e, q, nullptr);
}
expr* map_proc::get_expr(expr* e) {
expr* result = 0;
proof* p = 0;
expr* result = nullptr;
proof* p = nullptr;
m_map.get(e, result, p);
return result;
}

View file

@ -115,7 +115,7 @@ public:
void reset() { m_map.reset(); }
void visit(var* e) { m_map.insert(e, e, 0); }
void visit(var* e) { m_map.insert(e, e, nullptr); }
void visit(quantifier* e);

View file

@ -38,7 +38,7 @@ expr_map::~expr_map() {
void expr_map::insert(expr * k, expr * d, proof * p) {
m_manager.inc_ref(d);
obj_map<expr, expr*>::obj_map_entry * entry = m_expr2expr.find_core(k);
if (entry != 0) {
if (entry != nullptr) {
m_manager.dec_ref(entry->get_data().m_value);
entry->get_data().m_value = d;
if (m_store_proofs) {
@ -61,7 +61,7 @@ void expr_map::insert(expr * k, expr * d, proof * p) {
void expr_map::get(expr * k, expr * & d, proof * & p) const {
if (m_expr2expr.find(k, d)) {
p = 0;
p = nullptr;
if (m_store_proofs)
m_expr2pr.find(k, p);
}
@ -73,7 +73,7 @@ void expr_map::erase(expr * k) {
m_expr2expr.erase(k);
m_manager.dec_ref(v);
if (m_store_proofs) {
proof * pr = 0;
proof * pr = nullptr;
m_expr2pr.find(k, pr);
m_expr2pr.erase(k);
m_manager.dec_ref(pr);

View file

@ -106,20 +106,20 @@ void expr_substitution::insert(expr * c, expr * def, proof * def_pr, expr_depend
void expr_substitution::erase(expr * c) {
if (proofs_enabled()) {
proof * pr = 0;
proof * pr = nullptr;
if (m_subst_pr->find(c, pr)) {
m_manager.dec_ref(pr);
m_subst_pr->erase(c);
}
}
if (unsat_core_enabled()) {
expr_dependency * dep = 0;
expr_dependency * dep = nullptr;
if (m_subst_dep->find(c, dep)) {
m_manager.dec_ref(dep);
m_subst_dep->erase(c);
}
}
expr * def = 0;
expr * def = nullptr;
if (m_subst.find(c, def)) {
m_manager.dec_ref(c);
m_manager.dec_ref(def);

View file

@ -43,7 +43,7 @@ public:
bool unsat_core_enabled() const { return m_cores_enabled; }
bool empty() const { return m_subst.empty(); }
void insert(expr * s, expr * def, proof * def_pr = 0, expr_dependency * def_dep = 0);
void insert(expr * s, expr * def, proof * def_pr = nullptr, expr_dependency * def_dep = nullptr);
void erase(expr * s);
bool find(expr * s, expr * & def, proof * & def_pr);
bool find(expr * s, expr * & def, proof * & def_pr, expr_dependency * & def_dep);
@ -63,7 +63,7 @@ public:
scoped_expr_substitution(expr_substitution& s): m_subst(s), m_trail(s.m()) {}
~scoped_expr_substitution() {}
void insert(expr * s, expr * def, proof * def_pr = 0, expr_dependency * def_dep = 0) {
void insert(expr * s, expr * def, proof * def_pr = nullptr, expr_dependency * def_dep = nullptr) {
if (!m_subst.contains(s)) {
m_subst.insert(s, def, def_pr, def_dep);
m_trail.push_back(s);
@ -82,7 +82,7 @@ public:
}
unsigned scope_level() const { return m_trail_lim.size(); }
bool empty() const { return m_subst.empty(); }
expr* find(expr * e) { proof* pr; expr* d = 0; if (find(e, d, pr)) return d; else return e; }
expr* find(expr * e) { proof* pr; expr* d = nullptr; if (find(e, d, pr)) return d; else return e; }
bool find(expr * s, expr * & def, proof * & def_pr) { return m_subst.find(s, def, def_pr); }
bool find(expr * s, expr * & def, proof * & def_pr, expr_dependency * & def_dep) { return m_subst.find(s, def, def_pr, def_dep); }
bool contains(expr * s) { return m_subst.contains(s); }

View file

@ -34,7 +34,7 @@ Revision History:
void factor_eqs(expr_ref_vector &v, expr_equiv_class &equiv) {
ast_manager &m = v.get_manager();
arith_util arith(m);
expr *e1 = 0, *e2 = 0;
expr *e1 = nullptr, *e2 = nullptr;
flatten_and(v);
unsigned j = 0;
@ -45,7 +45,7 @@ void factor_eqs(expr_ref_vector &v, expr_equiv_class &equiv) {
}
// y + -1*x == 0
expr* a0 = 0, *a1 = 0, *x = 0;
expr* a0 = nullptr, *a1 = nullptr, *x = nullptr;
if (arith.is_zero(e2) && arith.is_add(e1, a0, a1)) {
if (arith.is_times_minus_one(a1, x)) {
e1 = a0;

View file

@ -42,7 +42,7 @@ namespace format_ns {
public:
format_decl_plugin():
m_format_sort(0),
m_format_sort(nullptr),
m_nil("nil"),
m_string("string"),
m_indent("indent"),
@ -94,7 +94,7 @@ namespace format_ns {
return m_manager->mk_func_decl(m_line_break_ext, arity, domain, m_format_sort,
func_decl_info(m_family_id, OP_LINE_BREAK_EXT, num_parameters, parameters));
default:
return 0;
return nullptr;
}
}
};
@ -124,8 +124,8 @@ namespace format_ns {
SASSERT(m_manager.is_format_manager());
}
format * visit(var *) { UNREACHABLE(); return 0; }
format * visit(quantifier * q, format *, format * const *, format * const *) { UNREACHABLE(); return 0; }
format * visit(var *) { UNREACHABLE(); return nullptr; }
format * visit(quantifier * q, format *, format * const *, format * const *) { UNREACHABLE(); return nullptr; }
format * visit(format * n, format * const * children) {
if (is_app_of(n, m_fid, OP_LINE_BREAK))
return mk_string(m_manager, " ");
@ -147,7 +147,7 @@ namespace format_ns {
format * mk_string(ast_manager & m, char const * str) {
symbol s(str);
parameter p(s);
return fm(m).mk_app(fid(m), OP_STRING, 1, &p, 0, 0);
return fm(m).mk_app(fid(m), OP_STRING, 1, &p, 0, nullptr);
}
format * mk_int(ast_manager & m, int i) {

View file

@ -198,7 +198,7 @@ expr_ref bv2fpa_converter::rebuild_floats(model_core * mc, sort * s, app * e) {
tout << std::endl; );
if (m_fpa_util.is_float(s)) {
if (e == 0)
if (e == nullptr)
result = m_fpa_util.mk_pzero(s);
else if (m_fpa_util.is_numeral(e))
result = e;
@ -208,7 +208,7 @@ expr_ref bv2fpa_converter::rebuild_floats(model_core * mc, sort * s, app * e) {
}
}
else if (m_fpa_util.is_rm(s)) {
if (e == 0)
if (e == nullptr)
result = m_fpa_util.mk_round_toward_zero();
else if (m_fpa_util.is_rm_numeral(e))
result = e;
@ -256,7 +256,7 @@ bv2fpa_converter::array_model bv2fpa_converter::convert_array_func_interp(model_
func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl * f, func_decl * bv_f) {
SASSERT(f->get_arity() > 0);
func_interp * result = 0;
func_interp * result = nullptr;
sort * rng = f->get_range();
sort * const * dmn = f->get_domain();
@ -291,7 +291,7 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl *
mk_ismt2_pp(new_args[i], m) << std::endl;
tout << mk_ismt2_pp(bv_fres, m) << " == " << mk_ismt2_pp(ft_fres, m) << std::endl;);
func_entry * fe = result->get_entry(new_args.c_ptr());
if (fe == 0)
if (fe == nullptr)
result->insert_new_entry(new_args.c_ptr(), ft_fres);
else {
// The BV model may have multiple equivalent entries using different
@ -338,7 +338,7 @@ void bv2fpa_converter::convert_consts(model_core * mc, model_core * target_model
v2 = mc->get_const_interp(a2->get_decl());
#else
expr * bv = mc->get_const_interp(to_app(to_app(a0)->get_arg(0))->get_decl());
if (bv == 0) {
if (bv == nullptr) {
v0 = m_bv_util.mk_numeral(0, 1);
v1 = m_bv_util.mk_numeral(0, ebits);
v2 = m_bv_util.mk_numeral(0, sbits-1);
@ -477,7 +477,7 @@ void bv2fpa_converter::convert_uf2bvuf(model_core * mc, model_core * target_mode
fmv->set_else(m.mk_app(it->m_key, n, args.c_ptr()));
#else
fmv->set_else(0);
fmv->set_else(nullptr);
#endif
target_model->register_decl(f, fmv);
}

View file

@ -64,7 +64,7 @@ public:
func_interp * new_float_fi;
func_decl * bv_fd;
expr_ref result;
array_model(ast_manager & m) : new_float_fd(0), new_float_fi(0), bv_fd(0), result(m) {}
array_model(ast_manager & m) : new_float_fd(nullptr), new_float_fi(nullptr), bv_fd(nullptr), result(m) {}
};
array_model convert_array_func_interp(model_core * mc, func_decl * f, func_decl * bv_f);

View file

@ -197,7 +197,7 @@ void fpa2bv_converter::mk_const(func_decl * f, expr_ref & result) {
#else
app_ref bv(m);
unsigned bv_sz = 1 + ebits + (sbits - 1);
bv = mk_fresh_const(0, bv_sz);
bv = mk_fresh_const(nullptr, bv_sz);
sgn = m_bv_util.mk_extract(bv_sz - 1, bv_sz - 1, bv);
e = m_bv_util.mk_extract(bv_sz - 2, sbits - 1, bv);
@ -288,7 +288,7 @@ void fpa2bv_converter::mk_rm_const(func_decl * f, expr_ref & result) {
#ifdef Z3DEBUG
"fpa2bv_rm"
#else
0
nullptr
#endif
, m_bv_util.mk_sort(3));
@ -1274,8 +1274,8 @@ expr_ref fpa2bv_converter::mk_min_max_unspecified(func_decl * f, expr * x, expr
std::pair<app*, app*> decls(0, 0);
if (!m_min_max_ufs.find(f, decls)) {
decls.first = m.mk_fresh_const(0, m_bv_util.mk_sort(1));
decls.second = m.mk_fresh_const(0, m_bv_util.mk_sort(1));
decls.first = m.mk_fresh_const(nullptr, m_bv_util.mk_sort(1));
decls.second = m.mk_fresh_const(nullptr, m_bv_util.mk_sort(1));
m_min_max_ufs.insert(f, decls);
m.inc_ref(f);
m.inc_ref(decls.first);
@ -2681,11 +2681,11 @@ void fpa2bv_converter::mk_to_fp_real_int(func_decl * f, unsigned num, expr * con
a_tz = m_plugin->mk_numeral(tz);
expr_ref bv_nte(m), bv_nta(m), bv_tp(m), bv_tn(m), bv_tz(m);
mk_numeral(a_nte->get_decl(), 0, 0, bv_nte);
mk_numeral(a_nta->get_decl(), 0, 0, bv_nta);
mk_numeral(a_tp->get_decl(), 0, 0, bv_tp);
mk_numeral(a_tn->get_decl(), 0, 0, bv_tn);
mk_numeral(a_tz->get_decl(), 0, 0, bv_tz);
mk_numeral(a_nte->get_decl(), 0, nullptr, bv_nte);
mk_numeral(a_nta->get_decl(), 0, nullptr, bv_nta);
mk_numeral(a_tp->get_decl(), 0, nullptr, bv_tp);
mk_numeral(a_tn->get_decl(), 0, nullptr, bv_tn);
mk_numeral(a_tz->get_decl(), 0, nullptr, bv_tz);
expr_ref c1(m), c2(m), c3(m), c4(m);
c1 = m.mk_eq(bv_rm, m_bv_util.mk_numeral(BV_RM_TO_POSITIVE, 3));
@ -4103,7 +4103,7 @@ void fpa2bv_converter::reset(void) {
func_decl * fpa2bv_converter::mk_bv_uf(func_decl * f, sort * const * domain, sort * range) {
func_decl * res;
if (!m_uf2bvuf.find(f, res)) {
res = m.mk_fresh_func_decl(0, f->get_arity(), domain, range);
res = m.mk_fresh_func_decl(nullptr, f->get_arity(), domain, range);
m_uf2bvuf.insert(f, res);
m.inc_ref(f);
m.inc_ref(res);

View file

@ -220,7 +220,7 @@ bool fpa2bv_rewriter_cfg::reduce_quantifier(quantifier * old_q,
result = m().mk_quantifier(old_q->is_forall(), new_decl_sorts.size(), new_decl_sorts.c_ptr(), new_decl_names.c_ptr(),
new_body, old_q->get_weight(), old_q->get_qid(), old_q->get_skid(),
old_q->get_num_patterns(), new_patterns, old_q->get_num_no_patterns(), new_no_patterns);
result_pr = 0;
result_pr = nullptr;
m_bindings.shrink(old_sz);
TRACE("fpa2bv", tout << "reduce_quantifier[" << old_q->get_depth() << "]: " <<
mk_ismt2_pp(old_q->get_expr(), m()) << std::endl <<
@ -249,7 +249,7 @@ bool fpa2bv_rewriter_cfg::reduce_var(var * t, expr_ref & result, proof_ref & res
new_exp = m().mk_var(t->get_idx(), s);
result = new_exp;
result_pr = 0;
result_pr = nullptr;
TRACE("fpa2bv", tout << "reduce_var: " << mk_ismt2_pp(t, m()) << " -> " << mk_ismt2_pp(result, m()) << std::endl;);
return true;
}

View file

@ -23,9 +23,9 @@ Revision History:
fpa_decl_plugin::fpa_decl_plugin():
m_values(m_fm),
m_value_table(mpf_hash_proc(m_values), mpf_eq_proc(m_values)) {
m_real_sort = 0;
m_int_sort = 0;
m_bv_plugin = 0;
m_real_sort = nullptr;
m_int_sort = nullptr;
m_bv_plugin = nullptr;
}
void fpa_decl_plugin::set_manager(ast_manager * m, family_id id) {
@ -70,7 +70,7 @@ void fpa_decl_plugin::recycled_id(unsigned id) {
func_decl * fpa_decl_plugin::mk_numeral_decl(mpf const & v) {
sort * s = mk_float_sort(v.get_ebits(), v.get_sbits());
func_decl * r = 0;
func_decl * r = nullptr;
if (m_fm.is_nan(v))
r = m_manager->mk_const_decl(symbol("NaN"), s, func_decl_info(m_family_id, OP_FPA_NAN));
else if (m_fm.is_pinf(v))
@ -223,7 +223,7 @@ sort * fpa_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter
return mk_float_sort(15, 113);
default:
m_manager->raise_exception("unknown floating point theory sort");
return 0;
return nullptr;
}
}
@ -248,20 +248,20 @@ func_decl * fpa_decl_plugin::mk_rm_const_decl(decl_kind k, unsigned num_paramete
return m_manager->mk_const_decl(symbol("roundTowardZero"), s, finfo);
default:
UNREACHABLE();
return 0;
return nullptr;
}
}
func_decl * fpa_decl_plugin::mk_float_const_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
sort * s = 0;
sort * s = nullptr;
if (num_parameters == 1 && parameters[0].is_ast() && is_sort(parameters[0].get_ast()) && is_float_sort(to_sort(parameters[0].get_ast()))) {
s = to_sort(parameters[0].get_ast());
}
else if (num_parameters == 2 && parameters[0].is_int() && parameters[1].is_int()) {
s = mk_float_sort(parameters[0].get_int(), parameters[1].get_int());
}
else if (range != 0 && is_float_sort(range)) {
else if (range != nullptr && is_float_sort(range)) {
s = range;
}
else {
@ -561,7 +561,7 @@ func_decl * fpa_decl_plugin::mk_to_fp(decl_kind k, unsigned num_parameters, para
);
}
return 0;
return nullptr;
}
func_decl * fpa_decl_plugin::mk_to_fp_unsigned(decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -779,7 +779,7 @@ func_decl * fpa_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters,
default:
m_manager->raise_exception("unsupported floating point operator");
return 0;
return nullptr;
}
}
@ -862,12 +862,12 @@ expr * fpa_decl_plugin::get_some_value(sort * s) {
return res;
}
else if (s->is_sort_of(m_family_id, ROUNDING_MODE_SORT)) {
func_decl * f = mk_rm_const_decl(OP_FPA_RM_TOWARD_ZERO, 0, 0, 0, 0, s);
func_decl * f = mk_rm_const_decl(OP_FPA_RM_TOWARD_ZERO, 0, nullptr, 0, nullptr, s);
return m_manager->mk_const(f);
}
UNREACHABLE();
return 0;
return nullptr;
}
bool fpa_decl_plugin::is_value(app * e) const {

View file

@ -342,7 +342,7 @@ public:
app * mk_bv2rm(expr * bv3) {
SASSERT(m_bv_util.is_bv(bv3) && m_bv_util.get_bv_size(bv3) == 3);
return m().mk_app(m_fid, OP_FPA_BV2RM, 0, 0, 1, &bv3, mk_rm_sort());
return m().mk_app(m_fid, OP_FPA_BV2RM, 0, nullptr, 1, &bv3, mk_rm_sort());
}
bool is_bvwrap(expr const * e) const { return is_app_of(e, get_family_id(), OP_FPA_BVWRAP); }

View file

@ -86,7 +86,7 @@ class func_decl_dependencies::top_sort {
ptr_vector<func_decl> m_todo;
func_decl_set * definition(func_decl * f) const {
func_decl_set * r = 0;
func_decl_set * r = nullptr;
m_deps.find(f, r);
return r;
}
@ -210,7 +210,7 @@ bool func_decl_dependencies::insert(func_decl * f, func_decl_set * s) {
}
void func_decl_dependencies::erase(func_decl * f) {
func_decl_set * s = 0;
func_decl_set * s = nullptr;
if (m_deps.find(f, s)) {
m_manager.dec_ref(f);
dec_ref(m_manager, *s);

View file

@ -96,7 +96,7 @@ public:
*/
bool contains(func_decl * f) const { return m_deps.contains(f); }
func_decl_set * get_dependencies(func_decl * f) const { func_decl_set * r = 0; m_deps.find(f, r); return r; }
func_decl_set * get_dependencies(func_decl * f) const { func_decl_set * r = nullptr; m_deps.find(f, r); return r; }
/**
\brief Erase \c f (and its dependencies) from the manager.

View file

@ -123,20 +123,20 @@ void macro_substitution::insert(func_decl * f, quantifier * q, proof * pr, expr_
void macro_substitution::erase(func_decl * f) {
if (proofs_enabled()) {
proof * pr = 0;
proof * pr = nullptr;
if (m_decl2macro_pr->find(f, pr)) {
m_manager.dec_ref(pr);
m_decl2macro_pr->erase(f);
}
}
if (unsat_core_enabled()) {
expr_dependency * dep = 0;
expr_dependency * dep = nullptr;
if (m_decl2macro_dep->find(f, dep)) {
m_manager.dec_ref(dep);
m_decl2macro_dep->erase(f);
}
}
quantifier * q = 0;
quantifier * q = nullptr;
if (m_decl2macro.find(f, q)) {
m_manager.dec_ref(f);
m_manager.dec_ref(q);

View file

@ -45,7 +45,7 @@ public:
bool empty() const { return m_decl2macro.empty(); }
void insert(func_decl * f, quantifier * m, proof * pr, expr_dependency * dep = 0);
void insert(func_decl * f, quantifier * m, proof * pr, expr_dependency * dep = nullptr);
void erase(func_decl * f);
bool contains(func_decl * f) { return m_decl2macro.contains(f); }
bool find(func_decl * f, quantifier * & q, proof * & pr);

View file

@ -71,7 +71,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, expr_dependency * dep, e
quantifier_ref new_q(m);
new_q = m.update_quantifier(to_quantifier(n), new_body);
proof * new_pr = 0;
proof * new_pr = nullptr;
if (m.proofs_enabled()) {
proof * rw = m.mk_rewrite(n, new_q);
new_pr = m.mk_modus_ponens(pr, rw);
@ -142,7 +142,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, vector<justified_expr>&
quantifier_ref new_q(m);
new_q = m.update_quantifier(to_quantifier(n), new_body);
proof * new_pr = 0;
proof * new_pr = nullptr;
if (m.proofs_enabled()) {
proof * rw = m.mk_rewrite(n, new_q);
new_pr = m.mk_modus_ponens(pr, rw);
@ -163,7 +163,7 @@ bool macro_finder::is_arith_macro(expr * n, proof * pr, vector<justified_expr>&
quantifier * q1 = m.update_quantifier(new_q, body1);
expr * patterns[1] = { m.mk_pattern(k_app) };
quantifier * q2 = m.update_quantifier(new_q, 1, patterns, body2);
proof* pr1 = 0, *pr2 = 0;
proof* pr1 = nullptr, *pr2 = nullptr;
if (m.proofs_enabled()) {
// new_pr : new_q
// rw : [rewrite] new_q ~ q1 & q2
@ -233,7 +233,7 @@ static void pseudo_predicate_macro2macro(ast_manager & m, app * head, app * t, e
app * body_1 = m.mk_eq(head, ite);
app * body_2 = m.mk_not(m.mk_eq(k_app, t));
quantifier * q1 = m.update_quantifier(q, body_1);
proof * pr1 = 0, *pr2 = 0;
proof * pr1 = nullptr, *pr2 = nullptr;
expr * pats[1] = { m.mk_pattern(k_app) };
quantifier * q2 = m.update_quantifier(q, 1, pats, body_2); // erase patterns
if (m.proofs_enabled()) {
@ -268,8 +268,8 @@ bool macro_finder::expand_macros(unsigned num, expr * const * exprs, proof * con
bool found_new_macro = false;
for (unsigned i = 0; i < num; i++) {
expr * n = exprs[i];
proof * pr = m.proofs_enabled() ? prs[i] : 0;
expr_dependency * depi = deps != 0 ? deps[i] : 0;
proof * pr = m.proofs_enabled() ? prs[i] : nullptr;
expr_dependency * depi = deps != nullptr ? deps[i] : nullptr;
expr_ref new_n(m), def(m);
proof_ref new_pr(m);
expr_dependency_ref new_dep(m);
@ -292,7 +292,7 @@ bool macro_finder::expand_macros(unsigned num, expr * const * exprs, proof * con
new_exprs.push_back(new_n);
if (m.proofs_enabled())
new_prs.push_back(new_pr);
if (deps != 0)
if (deps != nullptr)
new_deps.push_back(new_dep);
}
}
@ -333,11 +333,11 @@ bool macro_finder::expand_macros(unsigned num, justified_expr const * fmls, vect
bool found_new_macro = false;
for (unsigned i = 0; i < num; i++) {
expr * n = fmls[i].get_fml();
proof * pr = m.proofs_enabled() ? fmls[i].get_proof() : 0;
proof * pr = m.proofs_enabled() ? fmls[i].get_proof() : nullptr;
expr_ref new_n(m), def(m);
proof_ref new_pr(m);
expr_dependency_ref new_dep(m);
m_macro_manager.expand_macros(n, pr, 0, new_n, new_pr, new_dep);
m_macro_manager.expand_macros(n, pr, nullptr, new_n, new_pr, new_dep);
app_ref head(m), t(m);
if (is_macro(new_n, head, def) && m_macro_manager.insert(head->get_decl(), to_quantifier(new_n.get()), new_pr)) {
TRACE("macro_finder_found", tout << "found new macro: " << head->get_decl()->get_name() << "\n" << new_n << "\n";);

View file

@ -188,7 +188,7 @@ void macro_manager::display(std::ostream & out) {
unsigned sz = m_decls.size();
for (unsigned i = 0; i < sz; i++) {
func_decl * f = m_decls.get(i);
quantifier * q = 0;
quantifier * q = nullptr;
m_decl2macro.find(f, q);
app * head;
expr * def;
@ -226,7 +226,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
bool rewrite_patterns() const { return false; }
bool flat_assoc(func_decl * f) const { return false; }
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;
return BR_FAILED;
}
@ -255,7 +255,7 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
erase_patterns = true;
}
if (erase_patterns) {
result = m.update_quantifier(old_q, 0, 0, 0, 0, new_body);
result = m.update_quantifier(old_q, 0, nullptr, 0, nullptr, new_body);
}
return erase_patterns;
}
@ -264,13 +264,13 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
if (!is_app(_n))
return false;
app * n = to_app(_n);
quantifier * q = 0;
quantifier * q = nullptr;
func_decl * d = n->get_decl();
TRACE("macro_manager", tout << "trying to expand:\n" << mk_pp(n, m) << "\nd:\n" << d->get_name() << "\n";);
if (mm.m_decl2macro.find(d, q)) {
TRACE("macro_manager", tout << "expanding: " << mk_pp(n, m) << "\n";);
app * head = 0;
expr * def = 0;
app * head = nullptr;
expr * def = nullptr;
mm.get_head_def(q, d, head, def);
unsigned num = n->get_num_args();
SASSERT(head && def);
@ -292,14 +292,14 @@ struct macro_manager::macro_expander_cfg : public default_rewriter_cfg {
expr_ref instance(m);
s(q->get_expr(), num, subst_args.c_ptr(), instance);
proof * qi_pr = m.mk_quant_inst(m.mk_or(m.mk_not(q), instance), num, subst_args.c_ptr());
proof * q_pr = 0;
proof * q_pr = nullptr;
mm.m_decl2macro_pr.find(d, q_pr);
SASSERT(q_pr != 0);
proof * prs[2] = { qi_pr, q_pr };
p = m.mk_unit_resolution(2, prs);
}
else {
p = 0;
p = nullptr;
}
expr_dependency * ed = mm.m_decl2macro_dep.find(d);
m_used_macro_dependencies = m.mk_join(m_used_macro_dependencies, ed);

View file

@ -67,7 +67,7 @@ public:
~macro_manager();
ast_manager & get_manager() const { return m; }
macro_util & get_util() { return m_util; }
bool insert(func_decl * f, quantifier * m, proof * pr, expr_dependency * dep = 0);
bool insert(func_decl * f, quantifier * m, proof * pr, expr_dependency * dep = nullptr);
bool has_macros() const { return !m_macros.empty(); }
void push_scope();
void pop_scope(unsigned num_scopes);
@ -82,7 +82,7 @@ public:
unsigned get_first_macro_last_level() const { return m_scopes.empty() ? 0 : m_scopes.back().m_decls_lim; }
func_decl * get_macro_func_decl(unsigned i) const { return m_decls.get(i); }
func_decl * get_macro_interpretation(unsigned i, expr_ref & interp) const;
quantifier * get_macro_quantifier(func_decl * f) const { quantifier * q = 0; m_decl2macro.find(f, q); return q; }
quantifier * get_macro_quantifier(func_decl * f) const { quantifier * q = nullptr; m_decl2macro.find(f, q); return q; }
void get_head_def(quantifier * q, func_decl * d, app * & head, expr * & def) const;
void expand_macros(expr * n, proof * pr, expr_dependency * dep, expr_ref & r, proof_ref & new_pr, expr_dependency_ref & new_dep);

View file

@ -33,8 +33,8 @@ macro_util::macro_util(ast_manager & m):
m_arith(m),
m_arith_rw(m),
m_bv_rw(m),
m_forbidden_set(0),
m_curr_clause(0) {
m_forbidden_set(nullptr),
m_curr_clause(nullptr) {
}
@ -256,7 +256,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
inv = false;
ptr_buffer<expr> args;
expr * h = 0;
expr * h = nullptr;
unsigned lhs_num_args;
expr * const * lhs_args;
if (is_add(lhs)) {
@ -270,13 +270,13 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
for (unsigned i = 0; i < lhs_num_args; i++) {
expr * arg = lhs_args[i];
expr * neg_arg;
if (h == 0 &&
if (h == nullptr &&
is_macro_head(arg, num_decls) &&
!is_forbidden(to_app(arg)->get_decl()) &&
!poly_contains_head(lhs, to_app(arg)->get_decl(), arg)) {
h = arg;
}
else if (h == 0 && m_arith_rw.is_times_minus_one(arg, neg_arg) &&
else if (h == nullptr && m_arith_rw.is_times_minus_one(arg, neg_arg) &&
is_macro_head(neg_arg, num_decls) &&
!is_forbidden(to_app(neg_arg)->get_decl()) &&
!poly_contains_head(lhs, to_app(neg_arg)->get_decl(), arg)) {
@ -287,7 +287,7 @@ bool macro_util::is_arith_macro(expr * n, unsigned num_decls, app_ref & head, ex
args.push_back(arg);
}
}
if (h == 0)
if (h == nullptr)
return false;
head = to_app(h);
expr_ref tmp(m_manager);
@ -666,7 +666,7 @@ void macro_util::insert_macro(app * head, unsigned num_decls, expr * def, expr *
expr_ref norm_def(m_manager);
expr_ref norm_cond(m_manager);
normalize_expr(head, num_decls, def, norm_def);
if (cond != 0)
if (cond != nullptr)
normalize_expr(head, num_decls, cond, norm_cond);
else if (!hint)
norm_cond = m_manager.mk_true();
@ -682,7 +682,7 @@ void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def,
expr_ref new_cond(m_manager);
if (!hint) {
quasi_macro_head_to_macro_head(head, num_decls, new_head, extra_cond);
if (cond == 0)
if (cond == nullptr)
new_cond = extra_cond;
else
bool_rewriter(m_manager).mk_and(cond, extra_cond, new_cond);
@ -701,7 +701,7 @@ void macro_util::insert_quasi_macro(app * head, unsigned num_decls, expr * def,
}
bool macro_util::rest_contains_decl(func_decl * f, expr * except_lit) {
if (m_curr_clause == 0)
if (m_curr_clause == nullptr)
return false;
SASSERT(is_clause(m_manager, m_curr_clause));
unsigned num_lits = get_clause_num_literals(m_manager, m_curr_clause);
@ -714,7 +714,7 @@ bool macro_util::rest_contains_decl(func_decl * f, expr * except_lit) {
}
void macro_util::get_rest_clause_as_cond(expr * except_lit, expr_ref & extra_cond) {
if (m_curr_clause == 0)
if (m_curr_clause == nullptr)
return;
SASSERT(is_clause(m_manager, m_curr_clause));
expr_ref_buffer neg_other_lits(m_manager);
@ -795,7 +795,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a
mk_sub(rhs, rest, def);
// If is_poly_hint, rhs may contain variables that do not occur in to_app(arg).
// So, we should re-check.
if (!_is_poly_hint || is_poly_hint(def, to_app(arg), 0))
if (!_is_poly_hint || is_poly_hint(def, to_app(arg), nullptr))
add_arith_macro_candidate(to_app(arg), num_decls, def, atom, is_ineq, _is_poly_hint, r);
}
else if (is_times_minus_one(arg, neg_arg) && is_app(neg_arg)) {
@ -816,7 +816,7 @@ void macro_util::collect_arith_macro_candidates(expr * lhs, expr * rhs, expr * a
mk_sub(rest, rhs, def);
// If is_poly_hint, rhs may contain variables that do not occur in to_app(neg_arg).
// So, we should re-check.
if (!_is_poly_hint || is_poly_hint(def, to_app(neg_arg), 0))
if (!_is_poly_hint || is_poly_hint(def, to_app(neg_arg), nullptr))
add_arith_macro_candidate(to_app(neg_arg), num_decls, def, atom, is_ineq, _is_poly_hint, r);
}
}
@ -885,7 +885,7 @@ void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls,
insert_quasi_macro(to_app(lhs), num_decls, rhs, cond, false, true, false, r);
}
else if (is_hint_atom(lhs, rhs)) {
insert_quasi_macro(to_app(lhs), num_decls, rhs, 0, false, true, true, r);
insert_quasi_macro(to_app(lhs), num_decls, rhs, nullptr, false, true, true, r);
}
if (is_quasi_macro_head(rhs, num_decls) &&
@ -897,7 +897,7 @@ void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls,
insert_quasi_macro(to_app(rhs), num_decls, lhs, cond, false, true, false, r);
}
else if (is_hint_atom(rhs, lhs)) {
insert_quasi_macro(to_app(rhs), num_decls, lhs, 0, false, true, true, r);
insert_quasi_macro(to_app(rhs), num_decls, lhs, nullptr, false, true, true, r);
}
}
@ -905,7 +905,7 @@ void macro_util::collect_macro_candidates_core(expr * atom, unsigned num_decls,
}
void macro_util::collect_macro_candidates(expr * atom, unsigned num_decls, macro_candidates & r) {
m_curr_clause = 0;
m_curr_clause = nullptr;
r.reset();
collect_macro_candidates_core(atom, num_decls, r);
}
@ -922,7 +922,7 @@ void macro_util::collect_macro_candidates(quantifier * q, macro_candidates & r)
unsigned num_lits = get_clause_num_literals(m_manager, n);
for (unsigned i = 0; i < num_lits; i++)
collect_macro_candidates_core(get_clause_literal(m_manager, n, i), num_decls, r);
m_curr_clause = 0;
m_curr_clause = nullptr;
}
else {
collect_macro_candidates_core(n, num_decls, r);

View file

@ -64,7 +64,7 @@ private:
mutable bv_rewriter m_bv_rw;
obj_hashtable<func_decl> * m_forbidden_set;
bool is_forbidden(func_decl * f) const { return m_forbidden_set != 0 && m_forbidden_set->contains(f); }
bool is_forbidden(func_decl * f) const { return m_forbidden_set != nullptr && m_forbidden_set->contains(f); }
bool poly_contains_head(expr * n, func_decl * f, expr * exception) const;
void collect_arith_macros(expr * n, unsigned num_decls, unsigned max_macros, bool allow_cond_macros,

View file

@ -281,10 +281,10 @@ bool quasi_macros::find_macros(unsigned n, expr * const * exprs) {
quasi_macro_to_macro(to_quantifier(exprs[i]), a, t, macro);
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i], m_manager) << std::endl;
tout << "Macro: " << mk_pp(macro, m_manager) << std::endl; );
proof * pr = 0;
proof * pr = nullptr;
if (m_manager.proofs_enabled())
pr = m_manager.mk_def_axiom(macro);
expr_dependency * dep = 0;
expr_dependency * dep = nullptr;
if (m_macro_manager.insert(a->get_decl(), macro, pr, dep))
res = true;
}
@ -320,7 +320,7 @@ bool quasi_macros::find_macros(unsigned n, justified_expr const * exprs) {
quasi_macro_to_macro(to_quantifier(exprs[i].get_fml()), a, t, macro);
TRACE("quasi_macros", tout << "Found quasi macro: " << mk_pp(exprs[i].get_fml(), m_manager) << std::endl;
tout << "Macro: " << mk_pp(macro, m_manager) << std::endl; );
proof * pr = 0;
proof * pr = nullptr;
if (m_manager.proofs_enabled())
pr = m_manager.mk_def_axiom(macro);
if (m_macro_manager.insert(a->get_decl(), macro, pr))
@ -336,7 +336,7 @@ void quasi_macros::apply_macros(unsigned n, expr * const * exprs, proof * const
expr_ref r(m_manager), rs(m_manager);
proof_ref pr(m_manager), ps(m_manager);
expr_dependency_ref dep(m_manager);
proof * p = m_manager.proofs_enabled() ? prs[i] : 0;
proof * p = m_manager.proofs_enabled() ? prs[i] : nullptr;
m_macro_manager.expand_macros(exprs[i], p, deps[i], r, pr, dep);
m_rewriter(r);
@ -366,9 +366,9 @@ void quasi_macros::apply_macros(unsigned n, justified_expr const* fmls, vector<j
for ( unsigned i = 0 ; i < n ; i++ ) {
expr_ref r(m_manager), rs(m_manager);
proof_ref pr(m_manager), ps(m_manager);
proof * p = m_manager.proofs_enabled() ? fmls[i].get_proof() : 0;
proof * p = m_manager.proofs_enabled() ? fmls[i].get_proof() : nullptr;
expr_dependency_ref dep(m_manager);
m_macro_manager.expand_macros(fmls[i].get_fml(), p, 0, r, pr, dep);
m_macro_manager.expand_macros(fmls[i].get_fml(), p, nullptr, r, pr, dep);
m_rewriter(r);
new_fmls.push_back(justified_expr(m_manager, r, pr));
}

View file

@ -210,7 +210,7 @@ bool defined_names::impl::mk_name(expr * e, expr_ref & new_def, proof_ref & new_
TRACE("mk_definition_bug", tout << "name for expression is already cached..., returning false...\n";);
n = n_ptr;
if (m_manager.proofs_enabled()) {
proof * pr_ptr = 0;
proof * pr_ptr = nullptr;
m_expr2proof.find(e, pr_ptr);
SASSERT(pr_ptr);
pr = pr_ptr;

View file

@ -38,8 +38,8 @@ class name_exprs_core : public name_exprs {
m_pred(pred),
m_r(m),
m_pr(m),
m_def_exprs(0),
m_def_proofs(0) {
m_def_exprs(nullptr),
m_def_proofs(nullptr) {
}
void gen_name_for_expr(expr * n, expr * & t, proof * & t_pr) {
@ -127,7 +127,7 @@ class name_nested_formulas : public name_exprs_core {
ast_manager & m_manager;
expr * m_root;
pred(ast_manager & m):m_manager(m), m_root(0) {}
pred(ast_manager & m):m_manager(m), m_root(nullptr) {}
bool operator()(expr * t) override {
TRACE("name_exprs", tout << "name_nested_formulas::pred:\n" << mk_ismt2_pp(t, m_manager) << "\n";);

View file

@ -82,7 +82,7 @@ class skolemizer {
expr_ref_vector args(m());
for (unsigned i = 0; i < sz; i++) {
sort * s = uv.get(i);
if (s != 0) {
if (s != nullptr) {
sorts.push_back(s);
args.push_back(m().mk_var(i, s));
}
@ -105,10 +105,10 @@ class skolemizer {
//
for (unsigned i = 0; i < sz; i++) {
sort * s = uv.get(i);
if (s != 0)
if (s != nullptr)
substitution.push_back(m().mk_var(i, s));
else
substitution.push_back(0);
substitution.push_back(nullptr);
}
//
// (VAR num_decls) ... (VAR num_decls+sz-1)
@ -137,7 +137,7 @@ class skolemizer {
}
}
s(body, substitution.size(), substitution.c_ptr(), r);
p = 0;
p = nullptr;
if (m().proofs_enabled()) {
if (q->is_forall())
p = m().mk_skolemization(m().mk_not(q), m().mk_not(r));
@ -163,8 +163,8 @@ public:
void operator()(quantifier * q, expr_ref & r, proof_ref & p) {
r = m_cache.find(q);
if (r.get() != 0) {
p = 0;
if (r.get() != nullptr) {
p = nullptr;
if (m().proofs_enabled())
p = static_cast<proof*>(m_cache_pr.find(q));
}
@ -496,7 +496,7 @@ struct nnf::imp {
return false;
}
expr * r = m_result_stack.back();
proof * pr = 0;
proof * pr = nullptr;
if (proofs_enabled()) {
pr = m_result_pr_stack.back();
if (!fr.m_pol) {
@ -673,7 +673,7 @@ struct nnf::imp {
}
expr * arg = m_result_stack.back();
proof * arg_pr = proofs_enabled() ? m_result_pr_stack.back() : 0;
proof * arg_pr = proofs_enabled() ? m_result_pr_stack.back() : nullptr;
if (m_ignore_labels && !proofs_enabled())
return true; // the result is already on the stack
@ -765,7 +765,7 @@ struct nnf::imp {
if (q->is_forall() == fr.m_pol || !m_skolemize) {
expr * new_expr = m_result_stack.back();
proof * new_expr_pr = proofs_enabled() ? m_result_pr_stack.back() : 0;
proof * new_expr_pr = proofs_enabled() ? m_result_pr_stack.back() : nullptr;
ptr_buffer<expr> new_patterns;
@ -783,8 +783,8 @@ struct nnf::imp {
// So, ignore patterns
}
quantifier * new_q = 0;
proof * new_q_pr = 0;
quantifier * new_q = nullptr;
proof * new_q_pr = nullptr;
if (fr.m_pol) {
new_q = m().update_quantifier(q, new_patterns.size(), new_patterns.c_ptr(), new_expr);
if (proofs_enabled())
@ -827,7 +827,7 @@ struct nnf::imp {
if (proofs_enabled()) {
result_pr = m_result_pr_stack.back();
m_result_pr_stack.pop_back();
if (result_pr.get() == 0)
if (result_pr.get() == nullptr)
result_pr = m().mk_reflexivity(t);
SASSERT(m_result_pr_stack.empty());
}
@ -870,7 +870,7 @@ struct nnf::imp {
if (status) {
if (fr.m_cache_result)
cache_result(fr.m_curr, fr.m_pol, fr.m_in_q, m_result_stack.back(), proofs_enabled() ? m_result_pr_stack.back() : 0);
cache_result(fr.m_curr, fr.m_pol, fr.m_in_q, m_result_stack.back(), proofs_enabled() ? m_result_pr_stack.back() : nullptr);
m_frame_stack.pop_back();
}
}

View file

@ -85,7 +85,7 @@ struct pull_quant::imp {
var_sorts.push_back(nested_q->get_decl_sort(j));
symbol s = nested_q->get_decl_name(j);
if (std::find(var_names.begin(), var_names.end(), s) != var_names.end())
var_names.push_back(m_manager.mk_fresh_var_name(s.is_numerical() ? 0 : s.bare_str()));
var_names.push_back(m_manager.mk_fresh_var_name(s.is_numerical() ? nullptr : s.bare_str()));
else
var_names.push_back(s);
}
@ -215,7 +215,7 @@ struct pull_quant::imp {
// Code for proof generation...
void pull_quant2(expr * n, expr_ref & r, proof_ref & pr) {
pr = 0;
pr = nullptr;
if (is_app(n)) {
expr_ref_buffer new_args(m_manager);
expr_ref new_arg(m_manager);
@ -231,8 +231,8 @@ struct pull_quant::imp {
pull_quant1(to_app(n)->get_decl(), new_args.size(), new_args.c_ptr(), r);
if (m_manager.proofs_enabled()) {
app * r1 = m_manager.mk_app(to_app(n)->get_decl(), new_args.size(), new_args.c_ptr());
proof * p1 = proofs.empty() ? 0 : m_manager.mk_congruence(to_app(n), r1, proofs.size(), proofs.c_ptr());
proof * p2 = r1 == r ? 0 : m_manager.mk_pull_quant(r1, to_quantifier(r));
proof * p1 = proofs.empty() ? nullptr : m_manager.mk_congruence(to_app(n), r1, proofs.size(), proofs.c_ptr());
proof * p2 = r1 == r ? nullptr : m_manager.mk_pull_quant(r1, to_quantifier(r));
pr = m_manager.mk_transitivity(p1, p2);
}
}
@ -242,12 +242,12 @@ struct pull_quant::imp {
pull_quant1(to_quantifier(n), new_expr, r);
if (m_manager.proofs_enabled()) {
quantifier * q1 = m_manager.update_quantifier(to_quantifier(n), new_expr);
proof * p1 = 0;
proof * p1 = nullptr;
if (n != q1) {
proof * p0 = m_manager.mk_pull_quant(n, to_quantifier(new_expr));
p1 = m_manager.mk_quant_intro(to_quantifier(n), q1, p0);
}
proof * p2 = q1 == r ? 0 : m_manager.mk_pull_quant(q1, to_quantifier(r));
proof * p2 = q1 == r ? nullptr : m_manager.mk_pull_quant(q1, to_quantifier(r));
pr = m_manager.mk_transitivity(p1, p2);
}
}

View file

@ -83,7 +83,7 @@ expr_pattern_match::instantiate(expr* a, unsigned num_bound, subst& s, expr_ref&
inst_proc proc(m_manager, s, b, m_regs);
for_each_ast(proc, a);
expr* v = 0;
expr* v = nullptr;
proc.m_memoize.find(a, v);
SASSERT(v);
result = v;

View file

@ -80,7 +80,7 @@ class expr_pattern_match {
}
void operator()(var* v) {
var* b = 0;
var* b = nullptr;
if (m_bound.find(v, b)) {
m_memoize.insert(v, b);
}
@ -99,7 +99,7 @@ class expr_pattern_match {
decl = to_app(m_regs[r])->get_decl();
}
for (unsigned i = 0; i < num_args; ++i) {
expr* arg = 0;
expr* arg = nullptr;
if (m_memoize.find(n->get_arg(i), arg)) {
SASSERT(arg);
args.push_back(arg);

View file

@ -168,7 +168,7 @@ bool pattern_inference_cfg::collect::visit_children(expr * n, unsigned delta) {
inline void pattern_inference_cfg::collect::save(expr * n, unsigned delta, info * i) {
m_cache.insert(entry(n, delta), i);
if (i != 0)
if (i != nullptr)
m_info.push_back(i);
}
@ -181,7 +181,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
uint_set free_vars;
if (idx < m_num_bindings)
free_vars.insert(idx);
info * i = 0;
info * i = nullptr;
if (delta == 0)
i = alloc(info, m, n, free_vars, 1);
else
@ -189,7 +189,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
save(n, delta, i);
}
else {
save(n, delta, 0);
save(n, delta, nullptr);
}
return;
}
@ -197,7 +197,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
app * c = to_app(n);
func_decl * decl = c->get_decl();
if (m_owner.is_forbidden(c)) {
save(n, delta, 0);
save(n, delta, nullptr);
return;
}
@ -213,14 +213,14 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
unsigned num = c->get_num_args();
for (unsigned i = 0; i < num; i++) {
expr * child = c->get_arg(i);
info * child_info = 0;
info * child_info = nullptr;
#ifdef Z3DEBUG
bool found =
#endif
m_cache.find(entry(child, delta), child_info);
SASSERT(found);
if (child_info == 0) {
save(n, delta, 0);
if (child_info == nullptr) {
save(n, delta, nullptr);
return;
}
buffer.push_back(child_info->m_node.get());
@ -230,7 +230,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
changed = true;
}
app * new_node = 0;
app * new_node = nullptr;
if (changed)
new_node = m.mk_app(decl, buffer.size(), buffer.c_ptr());
else
@ -254,7 +254,7 @@ void pattern_inference_cfg::collect::save_candidate(expr * n, unsigned delta) {
return;
}
default:
save(n, delta, 0);
save(n, delta, nullptr);
return;
}
}
@ -630,7 +630,7 @@ bool pattern_inference_cfg::reduce_quantifier(
if (new_patterns.empty() && num_no_patterns > 0) {
if (new_patterns.empty()) {
mk_patterns(q->get_num_decls(), new_body, 0, 0, new_patterns);
mk_patterns(q->get_num_decls(), new_body, 0, nullptr, new_patterns);
if (m_params.m_pi_warnings && !new_patterns.empty()) {
warning_msg("ignoring nopats annotation because Z3 couldn't find any other pattern (quantifier id: %s)", q->get_qid().str().c_str());
}
@ -683,7 +683,7 @@ bool pattern_inference_cfg::reduce_quantifier(
pull(new_q, new_expr, new_pr);
quantifier * result2 = to_quantifier(new_expr);
if (result2 != new_q) {
mk_patterns(result2->get_num_decls(), result2->get_expr(), 0, 0, new_patterns);
mk_patterns(result2->get_num_decls(), result2->get_expr(), 0, nullptr, new_patterns);
if (!new_patterns.empty()) {
if (m_params.m_pi_warnings) {
warning_msg("pulled nested quantifier to be able to find an useable pattern (quantifier id: %s)", q->get_qid().str().c_str());

View file

@ -118,7 +118,7 @@ class pattern_inference_cfg : public default_rewriter_cfg {
struct entry {
expr * m_node;
unsigned m_delta;
entry():m_node(0), m_delta(0) {}
entry():m_node(nullptr), m_delta(0) {}
entry(expr * n, unsigned d):m_node(n), m_delta(d) {}
unsigned hash() const {
return hash_u_u(m_node->get_id(), m_delta);

View file

@ -86,7 +86,7 @@ func_decl * pb_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, p
}
default:
UNREACHABLE();
return 0;
return nullptr;
}
}
@ -299,6 +299,6 @@ bool pb_util::has_unit_coefficients(func_decl* f) const {
app* pb_util::mk_fresh_bool() {
symbol name = m.mk_fresh_var_name("pb");
func_decl_info info(m_fid, OP_PB_AUX_BOOL, 0, 0);
return m.mk_const(m.mk_func_decl(name, 0, (sort *const*)0, m.mk_bool_sort(), info));
func_decl_info info(m_fid, OP_PB_AUX_BOOL, 0, nullptr);
return m.mk_const(m.mk_func_decl(name, 0, (sort *const*)nullptr, m.mk_bool_sort(), info));
}

Some files were not shown because too many files have changed in this diff Show more