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

@ -30,13 +30,13 @@ class aig_lit {
friend class aig_ref;
aig * m_ref;
public:
aig_lit(aig * n = 0):m_ref(n) {}
aig_lit(aig * n = nullptr):m_ref(n) {}
aig_lit(aig_ref const & r):m_ref(static_cast<aig*>(r.m_ref)) {}
bool is_inverted() const { return (reinterpret_cast<size_t>(m_ref) & static_cast<size_t>(1)) == static_cast<size_t>(1); }
void invert() { m_ref = reinterpret_cast<aig*>(reinterpret_cast<size_t>(m_ref) ^ static_cast<size_t>(1)); }
aig * ptr() const { return reinterpret_cast<aig*>(reinterpret_cast<size_t>(m_ref) & ~static_cast<size_t>(1)); }
aig * ptr_non_inverted() const { SASSERT(!is_inverted()); return m_ref; }
bool is_null() const { return m_ref == 0; }
bool is_null() const { return m_ref == nullptr; }
friend bool operator==(aig_lit const & r1, aig_lit const & r2) { return r1.m_ref == r2.m_ref; }
friend bool operator!=(aig_lit const & r1, aig_lit const & r2) { return r1.m_ref != r2.m_ref; }
aig_lit & operator=(aig_lit const & r) { m_ref = r.m_ref; return *this; }
@ -151,7 +151,7 @@ struct aig_manager::imp {
m_num_aigs--;
if (is_var(n)) {
m_var_id_gen.recycle(n->m_id);
m_var2exprs.set(n->m_id, 0);
m_var2exprs.set(n->m_id, nullptr);
}
else {
m_table.erase(n);
@ -797,7 +797,7 @@ struct aig_manager::imp {
m_cache.resize(idx+1);
return false;
}
return m_cache.get(idx) != 0;
return m_cache.get(idx) != nullptr;
}
void cache_result(aig * n, expr * t) {
@ -960,14 +960,14 @@ struct aig_manager::imp {
}
unsigned idx = to_idx(t);
cache.reserve(idx+1);
if (cache.get(idx) != 0) {
if (cache.get(idx) != nullptr) {
todo.pop_back();
continue;
}
bool ok = true;
for (unsigned i = 0; i < 2; i++) {
aig * c = t->m_children[i].ptr();
if (!is_var(c) && cache.get(to_idx(c), 0) == 0) {
if (!is_var(c) && cache.get(to_idx(c), nullptr) == nullptr) {
todo.push_back(c);
ok = false;
}
@ -981,7 +981,7 @@ struct aig_manager::imp {
if (is_var(c))
args[i] = m.m_var2exprs.get(c->m_id);
else
args[i] = cache.get(to_idx(c), 0);
args[i] = cache.get(to_idx(c), nullptr);
if (!l.is_inverted())
args[i] = invert(args[i]);
}
@ -1009,16 +1009,16 @@ struct aig_manager::imp {
aig_lit n = roots.back();
roots.pop_back();
if (n.is_inverted()) {
g.assert_expr(invert(process_root(n.ptr())), 0, 0);
g.assert_expr(invert(process_root(n.ptr())), nullptr, nullptr);
continue;
}
aig * p = n.ptr();
if (m.is_ite(p)) {
g.assert_expr(process_root(p), 0, 0);
g.assert_expr(process_root(p), nullptr, nullptr);
continue;
}
if (is_var(p)) {
g.assert_expr(m.var2expr(p), 0, 0);
g.assert_expr(m.var2expr(p), nullptr, nullptr);
continue;
}
roots.push_back(left(p));
@ -1081,7 +1081,7 @@ struct aig_manager::imp {
bool visit(aig * p) {
if (is_var(p)) {
push_result(0);
push_result(nullptr);
return true;
}
if (is_cached(p))
@ -1654,8 +1654,8 @@ public:
aig_ref::aig_ref():
m_manager(0),
m_ref(0) {
m_manager(nullptr),
m_ref(nullptr) {
}
aig_ref::aig_ref(aig_manager & m, aig_lit const & l):
@ -1665,15 +1665,15 @@ aig_ref::aig_ref(aig_manager & m, aig_lit const & l):
}
aig_ref::~aig_ref() {
if (m_ref != 0) {
if (m_ref != nullptr) {
m_manager->m_imp->dec_ref(aig_lit(*this));
}
}
aig_ref & aig_ref::operator=(aig_ref const & r) {
if (r.m_ref != 0)
if (r.m_ref != nullptr)
r.m_manager->m_imp->inc_ref(aig_lit(r));
if (m_ref != 0)
if (m_ref != nullptr)
m_manager->m_imp->dec_ref(aig_lit(*this));
m_ref = r.m_ref;
m_manager = r.m_manager;

View file

@ -37,12 +37,12 @@ class aig_tactic : public tactic {
~mk_aig_manager() {
dealloc(m_owner.m_aig_manager);
m_owner.m_aig_manager = 0;
m_owner.m_aig_manager = nullptr;
}
};
public:
aig_tactic(params_ref const & p = params_ref()):m_aig_manager(0) {
aig_tactic(params_ref const & p = params_ref()):m_aig_manager(nullptr) {
updt_params(p);
}
@ -77,7 +77,7 @@ public:
expr_ref new_f(g->m());
m_aig_manager->to_formula(r, new_f);
expr_dependency * ed = g->dep(i);
g->update(i, new_f, 0, ed);
g->update(i, new_f, nullptr, ed);
}
}
else {
@ -96,7 +96,7 @@ public:
proof_converter_ref & pc,
expr_dependency_ref & core) override {
fail_if_proof_generation("aig", g);
mc = 0; pc = 0; core = 0;
mc = nullptr; pc = nullptr; core = nullptr;
operator()(g);
g->inc_depth();
result.push_back(g.get());