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

Use nullptr.

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

View file

@ -176,7 +176,7 @@ namespace datalog {
if (m_defs.find(e1, v)) {
cache.insert(e, v);
}
else if (!insert_def(r, e1, 0)) {
else if (!insert_def(r, e1, nullptr)) {
return false;
}
else {
@ -320,7 +320,7 @@ namespace datalog {
rule_set * mk_array_blast::operator()(rule_set const & source) {
if (!m_ctx.array_blast ()) {
return 0;
return nullptr;
}
rule_set* rules = alloc(rule_set, m_ctx);
rules->inherit_predicates(source);
@ -331,7 +331,7 @@ namespace datalog {
}
if (!change) {
dealloc(rules);
rules = 0;
rules = nullptr;
}
return rules;
}

View file

@ -138,8 +138,8 @@ namespace datalog {
m_g_vars(m),
m_old_funcs(m),
m_new_funcs(m),
m_src(0),
m_dst(0)
m_src(nullptr),
m_dst(nullptr)
{}
~expand_mkbv_cfg() {}
@ -186,7 +186,7 @@ namespace datalog {
m_g_vars.push_back(m_f_vars.back());
}
}
func_decl* g = 0;
func_decl* g = nullptr;
if (!m_pred2blast.find(f, g)) {
@ -202,7 +202,7 @@ namespace datalog {
m_dst->inherit_predicate(*m_src, f, g);
}
result = m.mk_app(g, m_args.size(), m_args.c_ptr());
result_pr = 0;
result_pr = nullptr;
return BR_DONE;
}
};
@ -262,7 +262,7 @@ namespace datalog {
rule_set * operator()(rule_set const & source) {
// TODO pc
if (!m_context.xform_bit_blast()) {
return 0;
return nullptr;
}
rule_manager& rm = m_context.get_rule_manager();
unsigned sz = source.get_num_rules();

View file

@ -45,7 +45,7 @@ namespace datalog {
for (unsigned i = 0; i < r->get_uninterpreted_tail_size(); ++i) {
func_decl* decl_i = r->get_decl(i);
if (m_context.has_facts(decl_i)) {
return 0;
return nullptr;
}
bool reachable = engine.get_fact(decl_i).is_reachable();
@ -93,7 +93,7 @@ namespace datalog {
}
if (res->get_num_rules() == source.get_num_rules()) {
TRACE("dl", tout << "No transformation\n";);
res = 0;
res = nullptr;
}
else {
res->close();
@ -134,7 +134,7 @@ namespace datalog {
if (res->get_num_rules() == source.get_num_rules()) {
TRACE("dl", tout << "No transformation\n";);
res = 0;
res = nullptr;
}
if (res && m_context.get_model_converter()) {
extension_model_converter* mc0 = alloc(extension_model_converter, m);

View file

@ -29,7 +29,7 @@ namespace datalog {
m_context(ctx),
m(ctx.get_manager()),
rm(ctx.get_rule_manager()),
m_result(0),
m_result(nullptr),
m_pinned(m) {
}
@ -89,7 +89,7 @@ namespace datalog {
app_ref filter_head(m);
filter_head = m.mk_app(filter_decl, key->filter_args.size(), key->filter_args.c_ptr());
app * filter_tail = key->new_pred;
rule * filter_rule = m_context.get_rule_manager().mk(filter_head, 1, &filter_tail, (const bool *)0);
rule * filter_rule = m_context.get_rule_manager().mk(filter_head, 1, &filter_tail, (const bool *)nullptr);
filter_rule->set_accounting_parent_object(m_context, m_current);
m_result->add_rule(filter_rule);
m_context.get_rule_manager().mk_rule_asserted_proof(*filter_rule);
@ -161,7 +161,7 @@ namespace datalog {
}
if(!m_modified) {
dealloc(m_result);
return static_cast<rule_set *>(0);
return static_cast<rule_set *>(nullptr);
}
m_result->inherit_predicates(source);
return m_result;

View file

@ -222,20 +222,20 @@ namespace datalog {
*/
app * detect_equivalence(const arg_pair& p1, const arg_pair& p2, bool inside_disjunction)
{
if (m.is_not(p1.first)==m.is_not(p2.first)) { return 0; }
if (m.is_not(p1.second)==m.is_not(p2.second)) { return 0; }
if (m.is_not(p1.first)==m.is_not(p2.first)) { return nullptr; }
if (m.is_not(p1.second)==m.is_not(p2.second)) { return nullptr; }
expr * first_bare = 0;
if (m.is_not(p1.first, first_bare) && p2.first!=first_bare) { return 0; }
if (m.is_not(p2.first, first_bare) && p1.first!=first_bare) { return 0; }
expr * first_bare = nullptr;
if (m.is_not(p1.first, first_bare) && p2.first!=first_bare) { return nullptr; }
if (m.is_not(p2.first, first_bare) && p1.first!=first_bare) { return nullptr; }
SASSERT(first_bare);
expr * second_bare = 0;
if (m.is_not(p1.second, second_bare) && p2.second!=second_bare) { return 0; }
if (m.is_not(p2.second, second_bare) && p1.second!=second_bare) { return 0; }
expr * second_bare = nullptr;
if (m.is_not(p1.second, second_bare) && p2.second!=second_bare) { return nullptr; }
if (m.is_not(p2.second, second_bare) && p1.second!=second_bare) { return nullptr; }
SASSERT(second_bare);
if (!m.is_bool(first_bare) || !m.is_bool(second_bare)) { return 0; }
if (!m.is_bool(first_bare) || !m.is_bool(second_bare)) { return nullptr; }
//both negations are in the same pair
bool negs_together = m.is_not(p1.first)==m.is_not(p1.second);
@ -261,7 +261,7 @@ namespace datalog {
arg_pair new_ap;
if (match_arg_pair(e, new_ap, inside_disjunction)) {
app * neq = 0;
app * neq = nullptr;
if (have_pair) {
neq = detect_equivalence(ap, new_ap, inside_disjunction);
}
@ -601,7 +601,7 @@ namespace datalog {
rule_set * mk_interp_tail_simplifier::operator()(rule_set const & source) {
if (source.get_num_rules() == 0) {
return 0;
return nullptr;
}
rule_set * res = alloc(rule_set, m_context);
@ -612,7 +612,7 @@ namespace datalog {
res->display(tout););
} else {
dealloc(res);
res = 0;
res = nullptr;
}
return res;
}

View file

@ -44,7 +44,7 @@ namespace datalog {
void apply(app * a, app_ref& res);
public:
rule_substitution(context & ctx)
: m(ctx.get_manager()), m_context(ctx), m_subst(m), m_unif(m), m_head(m), m_tail(m), m_rule(0) {}
: m(ctx.get_manager()), m_context(ctx), m_subst(m), m_unif(m), m_head(m), m_tail(m), m_rule(nullptr) {}
/**
Reset substitution and get it ready for working with rule r.

View file

@ -191,13 +191,13 @@ namespace datalog {
rule_set * mk_karr_invariants::operator()(rule_set const & source) {
if (!m_ctx.karr()) {
return 0;
return nullptr;
}
rule_set::iterator it = source.begin(), end = source.end();
for (; it != end; ++it) {
rule const& r = **it;
if (r.has_negation()) {
return 0;
return nullptr;
}
}
mk_loop_counter lc(m_ctx);
@ -209,7 +209,7 @@ namespace datalog {
get_invariants(*src_loop);
if (m.canceled()) {
return 0;
return nullptr;
}
// figure out whether to update same rules as used for saturation.
@ -248,7 +248,7 @@ namespace datalog {
func_decl* p = dit->m_key;
expr_ref fml = rctx.try_get_formula(p);
if (fml && !m.is_true(fml)) {
expr* inv = 0;
expr* inv = nullptr;
if (m_fun2inv.find(p, inv)) {
fml = m.mk_and(inv, fml);
}
@ -270,7 +270,7 @@ namespace datalog {
rule_set::decl2rules::iterator gend = src.end_grouped_rules();
for (; git != gend; ++git) {
func_decl* p = git->m_key;
expr* fml = 0;
expr* fml = nullptr;
if (m_fun2inv.find(p, fml)) {
kmc->add(p, fml);
}
@ -292,7 +292,7 @@ namespace datalog {
}
for (unsigned i = 0; i < utsz; ++i) {
func_decl* q = r.get_decl(i);
expr* fml = 0;
expr* fml = nullptr;
if (m_fun2inv.find(q, fml)) {
expr_safe_replace rep(m);
for (unsigned j = 0; j < q->get_arity(); ++j) {
@ -306,7 +306,7 @@ namespace datalog {
}
rule* new_rule = &r;
if (tail.size() != tsz) {
new_rule = rm.mk(r.get_head(), tail.size(), tail.c_ptr(), 0, r.name());
new_rule = rm.mk(r.get_head(), tail.size(), tail.c_ptr(), nullptr, r.name());
}
rules.add_rule(new_rule);
rm.mk_rule_rewrite_proof(r, *new_rule); // should be weakening rule.

View file

@ -56,7 +56,7 @@ namespace datalog {
app_ref mk_loop_counter::del_arg(app* fn) {
expr_ref_vector args(m);
func_decl* old_fn = 0, *new_fn = fn->get_decl();
func_decl* old_fn = nullptr, *new_fn = fn->get_decl();
SASSERT(fn->get_num_args() > 0);
args.append(fn->get_num_args()-1, fn->get_args());
VERIFY (m_new2old.find(new_fn, old_fn));

View file

@ -129,9 +129,9 @@ namespace datalog {
SASSERT(m.is_bool(old_pred->get_range()));
adornment_desc adn(old_pred);
adn.m_adornment.populate(lit, bound_vars);
adornment_map::entry * e = m_adorned_preds.insert_if_not_there2(adn, 0);
adornment_map::entry * e = m_adorned_preds.insert_if_not_there2(adn, nullptr);
func_decl * new_pred = e->get_data().m_value;
if (new_pred==0) {
if (new_pred==nullptr) {
std::string suffix = "ad_"+adn.m_adornment.to_string();
new_pred = m_context.mk_fresh_head_predicate(
old_pred->get_name(), symbol(suffix.c_str()),
@ -163,7 +163,7 @@ namespace datalog {
pred2pred::obj_map_entry * e = m_magic_preds.insert_if_not_there2(l_pred, 0);
func_decl * mag_pred = e->get_data().m_value;
if (mag_pred==0) {
if (mag_pred==nullptr) {
unsigned mag_arity = bound_args.size();
ptr_vector<sort> mag_domain;
@ -264,7 +264,7 @@ namespace datalog {
}
func_decl * new_head_pred = 0;
func_decl * new_head_pred = nullptr;
VERIFY( m_adorned_preds.find(adornment_desc(head->get_decl(), head_adornment), new_head_pred) );
app * new_head = m.mk_app(new_head_pred, head->get_args());
@ -301,14 +301,14 @@ namespace datalog {
app * tail[] = {lit, mag_lit};
rule * r = m_context.get_rule_manager().mk(adn_lit, 2, tail, 0);
rule * r = m_context.get_rule_manager().mk(adn_lit, 2, tail, nullptr);
result.add_rule(r);
}
rule_set * mk_magic_sets::operator()(rule_set const & source) {
if (!m_context.magic_sets_for_queries()) {
return 0;
return nullptr;
}
SASSERT(source.contains(m_goal));
SASSERT(source.get_predicate_rules(m_goal).size() == 1);
@ -372,10 +372,10 @@ namespace datalog {
app * adn_goal_head = adorn_literal(goal_head, empty_var_idx_set);
app * mag_goal_head = create_magic_literal(adn_goal_head);
SASSERT(mag_goal_head->is_ground());
rule * mag_goal_rule = m_context.get_rule_manager().mk(mag_goal_head, 0, 0, 0);
rule * mag_goal_rule = m_context.get_rule_manager().mk(mag_goal_head, 0, nullptr, nullptr);
result->add_rule(mag_goal_rule);
rule * back_to_goal_rule = m_context.get_rule_manager().mk(goal_head, 1, &adn_goal_head, 0);
rule * back_to_goal_rule = m_context.get_rule_manager().mk(goal_head, 1, &adn_goal_head, nullptr);
result->add_rule(back_to_goal_rule);
return result;
}

View file

@ -68,7 +68,7 @@ namespace datalog {
rule_set * mk_magic_symbolic::operator()(rule_set const & source) {
if (!m_ctx.magic()) {
return 0;
return nullptr;
}
context& ctx = source.get_context();
rule_manager& rm = source.get_rule_manager();
@ -98,7 +98,7 @@ namespace datalog {
result->add_rule(new_rule);
if (source.is_output_predicate(r.get_decl())) {
result->set_output_predicate(new_rule->get_decl());
new_rule = rm.mk(mk_query(r.get_head()), 0, 0, 0, r.name(), true);
new_rule = rm.mk(mk_query(r.get_head()), 0, nullptr, nullptr, r.name(), true);
result->add_rule(new_rule);
}

View file

@ -143,7 +143,7 @@ namespace datalog {
m_ctx(ctx),
a(m),
m_refs(m),
m_mc(NULL){
m_mc(nullptr) {
}
mk_quantifier_abstraction::~mk_quantifier_abstraction() {
@ -153,7 +153,7 @@ namespace datalog {
if (rules.is_output_predicate(old_p)) {
dst.inherit_predicate(rules, old_p, old_p);
return 0;
return nullptr;
}
unsigned sz = old_p->get_arity();
@ -164,10 +164,10 @@ namespace datalog {
}
}
if (num_arrays == 0) {
return 0;
return nullptr;
}
func_decl* new_p = 0;
func_decl* new_p = nullptr;
if (!m_old2new.find(old_p, new_p)) {
expr_ref_vector sub(m), vars(m);
svector<bool> bound;
@ -281,7 +281,7 @@ namespace datalog {
}
args.push_back(arg);
}
expr* pat = 0;
expr* pat = nullptr;
expr_ref pattern(m);
pattern = m.mk_pattern(pats.size(), pats.c_ptr());
pat = pattern.get();
@ -301,13 +301,13 @@ namespace datalog {
rule_set * mk_quantifier_abstraction::operator()(rule_set const & source) {
if (!m_ctx.quantify_arrays()) {
return 0;
return nullptr;
}
unsigned sz = source.get_num_rules();
for (unsigned i = 0; i < sz; ++i) {
rule& r = *source.get_rule(i);
if (r.has_negation()) {
return 0;
return nullptr;
}
}
@ -351,12 +351,12 @@ namespace datalog {
if (m_old2new.empty()) {
dealloc(result);
dealloc(m_mc);
result = 0;
result = nullptr;
}
else {
m_ctx.add_model_converter(m_mc);
}
m_mc = 0;
m_mc = nullptr;
return result;
}

View file

@ -139,7 +139,7 @@ namespace datalog {
return;
}
expr* arg = pat->get_arg(i);
ptr_vector<expr>* terms = 0;
ptr_vector<expr>* terms = nullptr;
if (m_funs.find(to_app(arg)->get_decl(), terms)) {
for (unsigned k = 0; k < terms->size(); ++k) {
@ -185,7 +185,7 @@ namespace datalog {
}
if (is_app(e)) {
app* ap = to_app(e);
ptr_vector<expr>* terms = 0;
ptr_vector<expr>* terms = nullptr;
if (!m_funs.find(ap->get_decl(), terms)) {
terms = alloc(ptr_vector<expr>);
m_funs.insert(ap->get_decl(), terms);
@ -250,7 +250,7 @@ namespace datalog {
rule_set * mk_quantifier_instantiation::operator()(rule_set const & source) {
if (!m_ctx.instantiate_quantifiers()) {
return 0;
return nullptr;
}
bool has_quantifiers = false;
unsigned sz = source.get_num_rules();
@ -259,11 +259,11 @@ namespace datalog {
rule& r = *source.get_rule(i);
has_quantifiers = has_quantifiers || rm.has_quantifiers(r);
if (r.has_negation()) {
return 0;
return nullptr;
}
}
if (!has_quantifiers) {
return 0;
return nullptr;
}
expr_ref_vector conjs(m);
@ -291,7 +291,7 @@ namespace datalog {
}
else {
dealloc(result);
result = 0;
result = nullptr;
}
return result;
}

View file

@ -549,16 +549,16 @@ namespace datalog {
const rule_vector& pred_rules = rules.get_predicate_rules(pred);
rule * inlining_candidate = 0;
rule * inlining_candidate = nullptr;
unsigned rule_cnt = pred_rules.size();
if (rule_cnt == 0) {
inlining_candidate = 0;
inlining_candidate = nullptr;
}
else if (rule_cnt == 1) {
inlining_candidate = pred_rules[0];
}
else {
inlining_candidate = 0;
inlining_candidate = nullptr;
for (unsigned ri = 0; ri < rule_cnt; ++ri) {
rule * pred_rule = pred_rules[ri];
@ -566,7 +566,7 @@ namespace datalog {
//we skip rules which don't unify with the tail atom
continue;
}
if (inlining_candidate != 0) {
if (inlining_candidate != nullptr) {
// We have two rules that can be inlined into the current
// tail predicate. In this situation we don't do inlinning
// on this tail atom, as we don't want the overall number
@ -576,10 +576,10 @@ namespace datalog {
inlining_candidate = pred_rule;
}
}
if (inlining_candidate == 0) {
if (inlining_candidate == nullptr) {
// nothing unifies with the tail atom, therefore the rule is unsatisfiable
// (we can say this because relation pred doesn't have any ground facts either)
res = 0;
res = nullptr;
datalog::del_rule(m_mc, *r, false);
return true;
}
@ -591,7 +591,7 @@ namespace datalog {
}
if (!try_to_inline_rule(*r, *inlining_candidate, ti, res)) {
datalog::del_rule(m_mc, *r, false);
res = 0;
res = nullptr;
}
return true;
@ -852,13 +852,13 @@ namespace datalog {
ref<horn_subsume_model_converter> hsmc;
if (source.get_num_rules() == 0) {
return 0;
return nullptr;
}
rule_set::iterator end = source.end();
for (rule_set::iterator it = source.begin(); it != end; ++ it) {
if (has_quantifier(**it)) {
return 0;
return nullptr;
}
}
@ -893,7 +893,7 @@ namespace datalog {
}
if (!something_done) {
res = 0;
res = nullptr;
}
else {
m_context.add_model_converter(hsmc.get());

View file

@ -186,7 +186,7 @@ namespace datalog {
m_simp(m_context.get_rewriter()),
m_pinned(m_rm),
m_inlined_rules(m_context),
m_mc(0),
m_mc(nullptr),
m_unifier(ctx),
m_head_index(m),
m_tail_index(m),

View file

@ -97,7 +97,7 @@ namespace datalog {
model_converter * translate(ast_translation & translator) override {
UNREACHABLE();
return 0;
return nullptr;
}
};
@ -116,7 +116,7 @@ namespace datalog {
rule_set * mk_scale::operator()(rule_set const & source) {
if (!m_ctx.scale()) {
return 0;
return nullptr;
}
rule_manager& rm = source.get_rule_manager();
rule_set * result = alloc(rule_set, m_ctx);

View file

@ -127,7 +127,7 @@ namespace datalog {
}
}
if (!has_new_rule) {
return 0;
return nullptr;
}
else {
result->inherit_predicates(src);

View file

@ -155,8 +155,8 @@ namespace datalog {
}
bool translate_asserted(proof* p) {
expr* fact = 0;
rule* r = 0;
expr* fact = nullptr;
rule* r = nullptr;
if (!m.is_asserted(p, fact)) {
return false;
}
@ -215,7 +215,7 @@ namespace datalog {
proof* p1_new = m_new_proof.find(p1);
expr* fact1 = m.get_fact(p1);
TRACE("dl", tout << "fact1: " << mk_pp(fact1, m) << "\n";);
rule* orig1 = 0;
rule* orig1 = nullptr;
if (!m_sliceform2rule.find(fact1, orig1)) {
return false;
}
@ -281,7 +281,7 @@ namespace datalog {
proof_converter * translate(ast_translation & translator) override {
UNREACHABLE();
// this would require implementing translation for the dl_context.
return 0;
return nullptr;
}
};
@ -393,7 +393,7 @@ namespace datalog {
model_converter * translate(ast_translation & translator) override {
UNREACHABLE();
return 0;
return nullptr;
}
};
@ -405,8 +405,8 @@ namespace datalog {
rm(ctx.get_rule_manager()),
m_solved_vars(m),
m_pinned(m),
m_pc(0),
m_mc(0)
m_pc(nullptr),
m_mc(nullptr)
{}
@ -790,7 +790,7 @@ namespace datalog {
tail.push_back(to_app(e));
}
new_rule = rm.mk(head.get(), tail.size(), tail.c_ptr(), (const bool*) 0, r.name());
new_rule = rm.mk(head.get(), tail.size(), tail.c_ptr(), (const bool*) nullptr, r.name());
rm.fix_unbound_vars(new_rule, false);
@ -805,7 +805,7 @@ namespace datalog {
dst.add_rule(new_rule.get());
if (m_pc) {
m_pc->insert(&r, new_rule.get(), 0, 0);
m_pc->insert(&r, new_rule.get(), 0, nullptr);
}
}
@ -819,7 +819,7 @@ namespace datalog {
rule_manager& rm = m_ctx.get_rule_manager();
for (unsigned i = 0; i < src.get_num_rules(); ++i) {
if (rm.has_quantifiers(*src.get_rule(i))) {
return 0;
return nullptr;
}
}
ref<slice_proof_converter> spc;
@ -839,7 +839,7 @@ namespace datalog {
if (m_predicates.empty()) {
// nothing could be sliced.
dealloc(result);
return 0;
return nullptr;
}
TRACE("dl", display(tout););
update_rules(src, *result);

View file

@ -297,7 +297,7 @@ namespace datalog {
SASSERT(total_size>=rel_sz);
if(total_size==rel_sz) {
on_discovered_total_relation(pred, 0);
on_discovered_total_relation(pred, nullptr);
}
}
next_pred:;
@ -335,7 +335,7 @@ namespace datalog {
rule_set * mk_subsumption_checker::operator()(rule_set const & source) {
// TODO mc
if (!m_context.get_params ().xform_subsumption_checker())
return 0;
return nullptr;
m_have_new_total_rule = false;
collect_ground_unconditional_rule_heads(source);
@ -348,7 +348,7 @@ namespace datalog {
if (!m_have_new_total_rule && !modified) {
dealloc(res);
return 0;
return nullptr;
}

View file

@ -346,7 +346,7 @@ namespace datalog {
// TODO mc
if (!m_context.compress_unbound()) {
return 0;
return nullptr;
}
m_modified = false;
@ -387,7 +387,7 @@ namespace datalog {
}
}
rule_set * result = static_cast<rule_set *>(0);
rule_set * result = static_cast<rule_set *>(nullptr);
if (m_modified) {
result = alloc(rule_set, m_context);
unsigned fin_rule_cnt = m_rules.size();