3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 03:15:50 +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

@ -118,7 +118,7 @@ namespace datalog {
}
exprs.reset();
assert_pred_id(numqs ? r->get_tail(0)->get_decl() : 0, m_ruleid_var_set, exprs);
assert_pred_id(numqs ? r->get_tail(0)->get_decl() : nullptr, m_ruleid_var_set, exprs);
assert_pred_id(r->get_head()->get_decl(), m_ruleid_varp_set, exprs);
subst.reset();
@ -141,7 +141,7 @@ namespace datalog {
if (m_facts) {
for (fact_vector::const_iterator I = m_facts->begin(), E = m_facts->end(); I != E; ++I) {
exprs.reset();
assert_pred_id(0, m_ruleid_var_set, exprs);
assert_pred_id(nullptr, m_ruleid_var_set, exprs);
assert_pred_id(I->first, m_ruleid_varp_set, exprs);
for (unsigned i = 0; i < I->second.size(); ++i) {

View file

@ -23,7 +23,7 @@ Abstract:
namespace datalog {
class aig_exporter {
public:
aig_exporter(const rule_set& rules, context& ctx, const fact_vector *facts = 0);
aig_exporter(const rule_set& rules, context& ctx, const fact_vector *facts = nullptr);
void operator()(std::ostream& out);
private:
@ -60,7 +60,7 @@ namespace datalog {
unsigned mk_or(unsigned id1, unsigned id2);
unsigned get_var(const expr *e);
unsigned mk_var(const expr *e);
unsigned mk_input_var(const expr *e = 0);
unsigned mk_input_var(const expr *e = nullptr);
unsigned mk_expr_id();
};
}

View file

@ -150,7 +150,7 @@ namespace datalog {
check_relation_plugin::check_relation_plugin(relation_manager& rm):
relation_plugin(check_relation_plugin::get_name(), rm),
m(rm.get_context().get_manager()),
m_base(0) {
m_base(nullptr) {
}
check_relation_plugin::~check_relation_plugin() {
}
@ -158,7 +158,7 @@ namespace datalog {
return dynamic_cast<check_relation&>(r);
}
check_relation* check_relation_plugin::get(relation_base* r) {
return r?dynamic_cast<check_relation*>(r):0;
return r?dynamic_cast<check_relation*>(r):nullptr;
}
check_relation const & check_relation_plugin::get(relation_base const& r) {
return dynamic_cast<check_relation const&>(r);
@ -207,7 +207,7 @@ namespace datalog {
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
relation_join_fn* j = m_base->mk_join_fn(get(t1).rb(), get(t2).rb(), col_cnt, cols1, cols2);
return j?alloc(join_fn, j, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2):0;
return j?alloc(join_fn, j, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2):nullptr;
}
class check_relation_plugin::join_project_fn : public convenient_relation_join_project_fn {
@ -239,7 +239,7 @@ namespace datalog {
relation_join_fn* j = m_base->mk_join_project_fn(get(t1).rb(), get(t2).rb(), col_cnt, cols1, cols2,
removed_col_cnt, removed_cols);
return j?alloc(join_project_fn, j, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2,
removed_col_cnt, removed_cols):0;
removed_col_cnt, removed_cols):nullptr;
}
void check_relation_plugin::verify_filter_project(
@ -499,8 +499,8 @@ namespace datalog {
expr_ref fml0 = r.m_fml;
expr_ref delta0(r.m_fml.get_manager());
if (d) d->to_formula(delta0);
(*m_union)(r.rb(), src.rb(), d?(&d->rb()):0);
r.get_plugin().verify_union(fml0, src.rb(), r.rb(), delta0, d?(&d->rb()):0);
(*m_union)(r.rb(), src.rb(), d?(&d->rb()):nullptr);
r.get_plugin().verify_union(fml0, src.rb(), r.rb(), delta0, d?(&d->rb()):nullptr);
r.rb().to_formula(r.m_fml);
if (d) d->rb().to_formula(d->m_fml);
}
@ -508,16 +508,16 @@ namespace datalog {
relation_union_fn * check_relation_plugin::mk_union_fn(
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
relation_base const* d1 = delta?(&(get(*delta).rb())):0;
relation_base const* d1 = delta?(&(get(*delta).rb())):nullptr;
relation_union_fn* u = m_base->mk_union_fn(get(tgt).rb(), get(src).rb(), d1);
return u?alloc(union_fn, u):0;
return u?alloc(union_fn, u):nullptr;
}
relation_union_fn * check_relation_plugin::mk_widen_fn(
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
relation_base const* d1 = delta?(&(get(*delta).rb())):0;
relation_base const* d1 = delta?(&(get(*delta).rb())):nullptr;
relation_union_fn* u = m_base->mk_widen_fn(get(tgt).rb(), get(src).rb(), d1);
return u?alloc(union_fn, u):0;
return u?alloc(union_fn, u):nullptr;
}
class check_relation_plugin::filter_identical_fn : public relation_mutator_fn {
@ -553,7 +553,7 @@ namespace datalog {
relation_mutator_fn * check_relation_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
relation_mutator_fn* r = m_base->mk_filter_identical_fn(get(t).rb(), col_cnt, identical_cols);
return r?alloc(filter_identical_fn, r, col_cnt, identical_cols):0;
return r?alloc(filter_identical_fn, r, col_cnt, identical_cols):nullptr;
}
class check_relation_plugin::filter_interpreted_fn : public relation_mutator_fn {
@ -579,7 +579,7 @@ namespace datalog {
relation_mutator_fn * check_relation_plugin::mk_filter_interpreted_fn(const relation_base & t, app * condition) {
relation_mutator_fn* r = m_base->mk_filter_interpreted_fn(get(t).rb(), condition);
app_ref cond(condition, m);
return r?alloc(filter_interpreted_fn, r, cond):0;
return r?alloc(filter_interpreted_fn, r, cond):nullptr;
}
class check_relation_plugin::project_fn : public convenient_relation_project_fn {
@ -608,7 +608,7 @@ namespace datalog {
const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
relation_transformer_fn* p = m_base->mk_project_fn(get(t).rb(), col_cnt, removed_cols);
return p?alloc(project_fn, p, t, col_cnt, removed_cols):0;
return p?alloc(project_fn, p, t, col_cnt, removed_cols):nullptr;
}
class check_relation_plugin::rename_fn : public convenient_relation_rename_fn {
@ -635,7 +635,7 @@ namespace datalog {
const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
relation_transformer_fn* p = m_base->mk_rename_fn(get(r).rb(), cycle_len, permutation_cycle);
return p?alloc(rename_fn, p, r, cycle_len, permutation_cycle):0;
return p?alloc(rename_fn, p, r, cycle_len, permutation_cycle):nullptr;
}
class check_relation_plugin::filter_equal_fn : public relation_mutator_fn {
@ -663,7 +663,7 @@ namespace datalog {
relation_mutator_fn * check_relation_plugin::mk_filter_equal_fn(
const relation_base & t, const relation_element & value, unsigned col) {
relation_mutator_fn* r = m_base->mk_filter_equal_fn(get(t).rb(), value, col);
return r?alloc(filter_equal_fn, r, t, value, col):0;
return r?alloc(filter_equal_fn, r, t, value, col):nullptr;
}
@ -700,7 +700,7 @@ namespace datalog {
const relation_base& neg, unsigned joined_col_cnt, const unsigned *t_cols,
const unsigned *negated_cols) {
relation_intersection_filter_fn* f = m_base->mk_filter_by_negation_fn(get(t).rb(), get(neg).rb(), joined_col_cnt, t_cols, negated_cols);
return f?alloc(negation_filter_fn, f, joined_col_cnt, t_cols, negated_cols):0;
return f?alloc(negation_filter_fn, f, joined_col_cnt, t_cols, negated_cols):nullptr;
}
/*
@ -779,7 +779,7 @@ namespace datalog {
unsigned removed_col_cnt, const unsigned * removed_cols) {
relation_transformer_fn* r = m_base->mk_filter_interpreted_and_project_fn(get(t).rb(), condition, removed_col_cnt, removed_cols);
app_ref cond(condition, m);
return r?alloc(filter_proj_fn, r, t, cond, removed_col_cnt, removed_cols):0;
return r?alloc(filter_proj_fn, r, t, cond, removed_col_cnt, removed_cols):nullptr;
}

View file

@ -51,7 +51,7 @@ namespace datalog {
ast_manager & m = renaming_arg.get_manager();
unsigned sz = map.size();
unsigned ofs = sz-1;
renaming_arg.resize(sz, static_cast<expr *>(0));
renaming_arg.resize(sz, static_cast<expr *>(nullptr));
for(unsigned i=0; i<sz; i++) {
if(map[i]!=UINT_MAX) {
renaming_arg.set(ofs-i, m.mk_var(map[i], orig_sig[i]));
@ -127,7 +127,7 @@ namespace datalog {
unsigned func_cnt = src.functional_columns();
if(removed_cols==0) {
if(removed_cols==nullptr) {
result.set_functional_columns(func_cnt);
return;
}

View file

@ -41,20 +41,20 @@ namespace datalog {
public:
scoped_rel(T* t) : m_t(t) {}
~scoped_rel() { if (m_t) { universal_delete(m_t); } }
scoped_rel() : m_t(0) {}
scoped_rel() : m_t(nullptr) {}
scoped_rel& operator=(T* t) { if (m_t && t != m_t) { universal_delete(m_t); } m_t = t; return *this; }
T* operator->() { return m_t; }
const T* operator->() const { return m_t; }
T& operator*() { return *m_t; }
const T& operator*() const { return *m_t; }
operator bool() const { return m_t!=0; }
operator bool() const { return m_t!=nullptr; }
T* get() const { return m_t; }
/**
\brief Remove object from \c scoped_rel without deleting it.
*/
T* release() {
T* res = m_t;
m_t = 0;
m_t = nullptr;
return res;
}
};
@ -202,7 +202,7 @@ namespace datalog {
virtual void operator()(base_object & tgt, const base_object & src, base_object * delta) = 0;
void operator()(base_object & tgt, const base_object & src) {
(*this)(tgt, src, static_cast<base_object *>(0));
(*this)(tgt, src, static_cast<base_object *>(nullptr));
}
};
@ -335,55 +335,55 @@ namespace datalog {
virtual join_fn * mk_join_fn(const base_object & t1, const base_object & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) { return 0; }
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) { return nullptr; }
virtual transformer_fn * mk_project_fn(const base_object & t, unsigned col_cnt,
const unsigned * removed_cols) { return 0; }
const unsigned * removed_cols) { return nullptr; }
virtual join_fn * mk_join_project_fn(const base_object & t1, const base_object & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) { return 0; }
unsigned removed_col_cnt, const unsigned * removed_cols) { return nullptr; }
virtual transformer_fn * mk_rename_fn(const base_object & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) { return 0; }
const unsigned * permutation_cycle) { return nullptr; }
virtual transformer_fn * mk_permutation_rename_fn(const base_object & t,
const unsigned * permutation) { return 0; }
const unsigned * permutation) { return nullptr; }
public:
virtual union_fn * mk_union_fn(const base_object & tgt, const base_object & src,
const base_object * delta) { return 0; }
const base_object * delta) { return nullptr; }
protected:
virtual union_fn * mk_widen_fn(const base_object & tgt, const base_object & src,
const base_object * delta) { return 0; }
const base_object * delta) { return nullptr; }
virtual mutator_fn * mk_filter_identical_fn(const base_object & t, unsigned col_cnt,
const unsigned * identical_cols) { return 0; }
const unsigned * identical_cols) { return nullptr; }
virtual mutator_fn * mk_filter_equal_fn(const base_object & t, const element & value,
unsigned col) { return 0; }
unsigned col) { return nullptr; }
virtual mutator_fn * mk_filter_interpreted_fn(const base_object & t, app * condition)
{ return 0; }
{ return nullptr; }
virtual transformer_fn * mk_filter_interpreted_and_project_fn(const base_object & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols)
{ return 0; }
{ return nullptr; }
virtual transformer_fn * mk_select_equal_and_project_fn(const base_object & t,
const element & value, unsigned col) { return 0; }
const element & value, unsigned col) { return nullptr; }
virtual intersection_filter_fn * mk_filter_by_intersection_fn(const base_object & t,
const base_object & src, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * src_cols)
{ return 0; }
{ return nullptr; }
virtual intersection_filter_fn * mk_filter_by_negation_fn(const base_object & t,
const base_object & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols)
{ return 0; }
{ return nullptr; }
virtual intersection_join_filter_fn * mk_filter_by_negated_join_fn(
const base_object & t,
@ -393,7 +393,7 @@ namespace datalog {
unsigned_vector const& src_cols,
unsigned_vector const& src1_cols,
unsigned_vector const& src2_cols)
{ return 0; }
{ return nullptr; }
};
@ -1029,14 +1029,14 @@ namespace datalog {
If the returned value is non-zero, the returned object must take ownership of \c mapper.
Otherwise \c mapper must remain unmodified.
*/
virtual table_mutator_fn * mk_map_fn(const table_base & t, table_row_mutator_fn * mapper) { return 0; }
virtual table_mutator_fn * mk_map_fn(const table_base & t, table_row_mutator_fn * mapper) { return nullptr; }
/**
If the returned value is non-zero, the returned object must take ownership of \c reducer.
Otherwise \c reducer must remain unmodified.
*/
virtual table_transformer_fn * mk_project_with_reduce_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols, table_row_pair_reduce_fn * reducer) { return 0; }
const unsigned * removed_cols, table_row_pair_reduce_fn * reducer) { return nullptr; }
};
@ -1047,7 +1047,7 @@ namespace datalog {
~table_base() override {}
public:
table_base * clone() const override;
virtual table_base * complement(func_decl* p, const table_element * func_columns = 0) const;
virtual table_base * complement(func_decl* p, const table_element * func_columns = nullptr) const;
bool empty() const override;
/**

View file

@ -83,7 +83,7 @@ namespace datalog {
bound_relation const& r1 = get(_r1);
bound_relation const& r2 = get(_r2);
bound_relation_plugin& p = r1.get_plugin();
bound_relation* result = dynamic_cast<bound_relation*>(p.mk_full(0, get_result_signature()));
bound_relation* result = dynamic_cast<bound_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr());
return result;
}
@ -92,7 +92,7 @@ namespace datalog {
relation_join_fn * bound_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(r1) || !check_kind(r2)) {
return 0;
return nullptr;
}
return alloc(join_fn, r1.get_signature(), r2.get_signature(), col_cnt, cols1, cols2);
}
@ -107,7 +107,7 @@ namespace datalog {
relation_base * operator()(const relation_base & _r) override {
bound_relation const& r = get(_r);
bound_relation_plugin& p = r.get_plugin();
bound_relation* result = get(p.mk_full(0, get_result_signature()));
bound_relation* result = get(p.mk_full(nullptr, get_result_signature()));
result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr());
return result;
}
@ -127,7 +127,7 @@ namespace datalog {
relation_base * operator()(const relation_base & _r) override {
bound_relation const& r = get(_r);
bound_relation_plugin& p = r.get_plugin();
bound_relation* result = get(p.mk_full(0, get_result_signature()));
bound_relation* result = get(p.mk_full(nullptr, get_result_signature()));
result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr());
return result;
}
@ -138,7 +138,7 @@ namespace datalog {
if(check_kind(r)) {
return alloc(rename_fn, r.get_signature(), cycle_len, permutation_cycle);
}
return 0;
return nullptr;
}
@ -176,7 +176,7 @@ namespace datalog {
if (check_kind(tgt) && check_kind(src) && (!delta || check_kind(*delta))) {
return alloc(union_fn, false);
}
return 0;
return nullptr;
}
relation_union_fn * bound_relation_plugin::mk_widen_fn(
@ -188,7 +188,7 @@ namespace datalog {
if (check_kind(tgt) && check_kind(src) && (!delta || check_kind(*delta))) {
return alloc(union_fn, true);
}
return 0;
return nullptr;
}
class bound_relation_plugin::filter_identical_fn : public relation_mutator_fn {
@ -209,7 +209,7 @@ namespace datalog {
if(check_kind(t)) {
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
return 0;
return nullptr;
}
class bound_relation_plugin::filter_equal_fn : public relation_mutator_fn {
@ -224,7 +224,7 @@ namespace datalog {
if (check_kind(r)) {
return alloc(filter_equal_fn, value, col);
}
return 0;
return nullptr;
}
class bound_relation_plugin::filter_interpreted_fn : public relation_mutator_fn {
@ -280,7 +280,7 @@ namespace datalog {
filter_interpreted_fn(ast_manager& m, app* cond) :
m_cond(cond, m),
m_lt(m), m_arith(m), m_interval(0), m_kind(NOT_APPLICABLE) {
m_lt(m), m_arith(m), m_interval(nullptr), m_kind(NOT_APPLICABLE) {
expr* l, *r, *r1, *r2, *c2;
rational n1;
if ((m_arith.is_lt(cond, l, r) || m_arith.is_gt(cond, r, l)) &&
@ -592,7 +592,7 @@ namespace datalog {
scoped_ptr<relation_mutator_fn> fe = get_plugin().mk_filter_equal_fn(r, f[i], i);
(*fe)(r);
}
mk_union(r, 0, false);
mk_union(r, nullptr, false);
}
bool bound_relation::contains_fact(const relation_fact & f) const {
@ -604,12 +604,12 @@ namespace datalog {
}
bound_relation * bound_relation::clone() const {
bound_relation* result = 0;
bound_relation* result = nullptr;
if (empty()) {
result = bound_relation_plugin::get(get_plugin().mk_empty(get_signature()));
}
else {
result = bound_relation_plugin::get(get_plugin().mk_full(0, get_signature()));
result = bound_relation_plugin::get(get_plugin().mk_full(nullptr, get_signature()));
result->copy(*this);
}
return result;
@ -647,7 +647,7 @@ namespace datalog {
bound_relation * bound_relation::complement(func_decl* p) const {
UNREACHABLE();
return 0;
return nullptr;
}
void bound_relation::to_formula(expr_ref& fml) const {

View file

@ -69,7 +69,7 @@ namespace datalog {
relation_join_fn * mk_join_project_fn(const relation_base & t1, const relation_base & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) override { return 0; }
unsigned removed_col_cnt, const unsigned * removed_cols) override { return nullptr; }
#if 0

View file

@ -40,12 +40,12 @@ namespace datalog {
table_base& check_table_plugin::checker(table_base& r) { return *get(r).m_checker; }
table_base const& check_table_plugin::checker(table_base const& r) { return *get(r).m_checker; }
table_base* check_table_plugin::checker(table_base* r) { return r?(get(*r).m_checker):0; }
table_base const* check_table_plugin::checker(table_base const* r) { return r?(get(*r).m_checker):0; }
table_base* check_table_plugin::checker(table_base* r) { return r?(get(*r).m_checker):nullptr; }
table_base const* check_table_plugin::checker(table_base const* r) { return r?(get(*r).m_checker):nullptr; }
table_base& check_table_plugin::tocheck(table_base& r) { return *get(r).m_tocheck; }
table_base const& check_table_plugin::tocheck(table_base const& r) { return *get(r).m_tocheck; }
table_base* check_table_plugin::tocheck(table_base* r) { return r?(get(*r).m_tocheck):0; }
table_base const* check_table_plugin::tocheck(table_base const* r) { return r?(get(*r).m_tocheck):0; }
table_base* check_table_plugin::tocheck(table_base* r) { return r?(get(*r).m_tocheck):nullptr; }
table_base const* check_table_plugin::tocheck(table_base const* r) { return r?(get(*r).m_tocheck):nullptr; }
table_base * check_table_plugin::mk_empty(const table_signature & s) {
IF_VERBOSE(1, verbose_stream() << __FUNCTION__ << "\n";);
@ -77,7 +77,7 @@ namespace datalog {
table_join_fn * check_table_plugin::mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, t1, t2, col_cnt, cols1, cols2);
}
@ -105,7 +105,7 @@ namespace datalog {
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_project_fn, *this, t1, t2, col_cnt, cols1, cols2, removed_col_cnt, removed_cols);
}
@ -132,7 +132,7 @@ namespace datalog {
table_union_fn * check_table_plugin::mk_union_fn(const table_base & tgt, const table_base & src, const table_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, *this, tgt, src, delta);
@ -157,7 +157,7 @@ namespace datalog {
table_transformer_fn * check_table_plugin::mk_project_fn(const table_base & t, unsigned col_cnt, const unsigned * removed_cols) {
if (!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(project_fn, *this, t, col_cnt, removed_cols);
}
@ -182,7 +182,7 @@ namespace datalog {
table_transformer_fn * check_table_plugin::mk_select_equal_and_project_fn(const table_base & t,
const table_element & value, unsigned col) {
if (!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(select_equal_and_project_fn, *this, t, value, col);
}
@ -207,7 +207,7 @@ namespace datalog {
table_transformer_fn * check_table_plugin::mk_rename_fn(const table_base & t, unsigned len, const unsigned * cycle) {
if (!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(rename_fn, *this, t, len, cycle);
}
@ -234,7 +234,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_identical_fn, *this, t, col_cnt, identical_cols);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_equal_fn : public table_mutator_fn {
@ -258,7 +258,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_equal_fn, *this, t, value, col);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_interpreted_fn : public table_mutator_fn {
@ -282,7 +282,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_fn, *this, t, condition);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_interpreted_and_project_fn : public table_transformer_fn {
@ -309,7 +309,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_and_project_fn, *this, t, condition, removed_col_cnt, removed_cols);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_by_negation_fn : public table_intersection_filter_fn {
@ -340,7 +340,7 @@ namespace datalog {
if (check_kind(t) && check_kind(negated_obj)) {
return alloc(filter_by_negation_fn, *this, t, negated_obj, joined_col_cnt, t_cols, negated_cols);
}
return 0;
return nullptr;
}
// ------------------

View file

@ -120,7 +120,7 @@ namespace datalog {
void add_fact(const table_fact & f) override;
void remove_fact(const table_element* fact) override;
bool contains_fact(const table_fact & f) const override;
table_base * complement(func_decl* p, const table_element * func_columns = 0) const override;
table_base * complement(func_decl* p, const table_element * func_columns = nullptr) const override;
table_base * clone() const override;
iterator begin() const override { SASSERT(well_formed()); return m_tocheck->begin(); }

View file

@ -1120,7 +1120,7 @@ namespace datalog {
//and clear local deltas
make_inloop_delta_transition(global_head_deltas, global_tail_deltas, local_deltas, *loop_body);
loop_body->set_observer(0);
loop_body->set_observer(nullptr);
acc.push_back(instruction::mk_while_loop(loop_control_regs.size(),
loop_control_regs.c_ptr(), loop_body));
}
@ -1316,7 +1316,7 @@ namespace datalog {
pred2idx empty_pred2idx_map;
compile_strats(m_rule_set.get_stratifier(), static_cast<pred2idx *>(0),
compile_strats(m_rule_set.get_stratifier(), static_cast<pred2idx *>(nullptr),
empty_pred2idx_map, true, execution_code);
@ -1331,7 +1331,7 @@ namespace datalog {
termination_code.push_back(instruction::mk_store(m_context.get_manager(), pred, reg));
}
acc.set_observer(0);
acc.set_observer(nullptr);
TRACE("dl", execution_code.display(execution_context(m_context), tout););
}

View file

@ -93,10 +93,10 @@ namespace datalog {
compiler & m_parent;
rule * m_current;
public:
instruction_observer(compiler & parent) : m_parent(parent), m_current(0) {}
instruction_observer(compiler & parent) : m_parent(parent), m_current(nullptr) {}
void start_rule(rule * r) { SASSERT(!m_current); m_current=r; }
void finish_rule() { m_current = 0; }
void finish_rule() { m_current = nullptr; }
void notify(instruction * i) override {
if(m_current) {
i->set_accounting_parent_object(m_parent.m_context, m_current);

View file

@ -46,7 +46,7 @@ namespace datalog {
args.push_back(f[i]);
}
if (!fn.get()) {
fn = m.mk_func_decl(fid, k, 0, 0, args.size(), args.c_ptr());
fn = m.mk_func_decl(fid, k, 0, nullptr, args.size(), args.c_ptr());
}
if (destructive) {
get_plugin().reduce_assign(fn, args.size(), args.c_ptr(), 1, args.c_ptr());
@ -63,7 +63,7 @@ namespace datalog {
expr_ref res(m);
if (!m_is_empty_fn.get()) {
family_id fid = get_plugin().get_family_id();
const_cast<func_decl_ref&>(m_is_empty_fn) = m.mk_func_decl(fid, OP_RA_IS_EMPTY, 0, 0, 1, &r);
const_cast<func_decl_ref&>(m_is_empty_fn) = m.mk_func_decl(fid, OP_RA_IS_EMPTY, 0, nullptr, 1, &r);
}
get_plugin().reduce(m_is_empty_fn, 1, &r, res);
return m.is_true(res);
@ -86,7 +86,7 @@ namespace datalog {
expr* rel = m_rel.get();
expr_ref res(m.mk_fresh_const("T", m.get_sort(rel)), m);
expr* rel_out = res.get();
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_CLONE,0,0, 1, &rel), m);
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_CLONE,0,nullptr, 1, &rel), m);
get_plugin().reduce_assign(fn, 1, &rel, 1, &rel_out);
return alloc(external_relation, get_plugin(), get_signature(), res);
}
@ -96,7 +96,7 @@ namespace datalog {
family_id fid = get_plugin().get_family_id();
expr_ref res(m);
expr* rel = m_rel;
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_COMPLEMENT,0,0, 1, &rel), m);
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_COMPLEMENT,0,nullptr, 1, &rel), m);
get_plugin().reduce(fn, 1, &rel, res);
return alloc(external_relation, get_plugin(), get_signature(), res);
}
@ -140,8 +140,8 @@ namespace datalog {
family_id fid = get_family_id();
expr_ref e(m.mk_fresh_const("T", r_sort), m);
expr* args[1] = { e.get() };
func_decl_ref empty_decl(m.mk_func_decl(fid, OP_RA_EMPTY, 1, &param, 0, (sort*const*)0), m);
reduce_assign(empty_decl, 0, 0, 1, args);
func_decl_ref empty_decl(m.mk_func_decl(fid, OP_RA_EMPTY, 1, &param, 0, (sort*const*)nullptr), m);
reduce_assign(empty_decl, 0, nullptr, 1, args);
return alloc(external_relation, *this, s, e);
}
@ -207,7 +207,7 @@ namespace datalog {
relation_join_fn * external_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(r1) || !check_kind(r2)) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, r1.get_signature(), r2.get_signature() , col_cnt, cols1, cols2);
}
@ -277,7 +277,7 @@ namespace datalog {
relation_transformer_fn * external_relation_plugin::mk_rename_fn(const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(rename_fn, *this, get(r).get_sort(), r.get_signature(), cycle_len, permutation_cycle);
}
@ -295,7 +295,7 @@ namespace datalog {
m_union_fn(p.get_ast_manager()) {
ast_manager& m = p.get_ast_manager();
sort* domain[2] = { relation_sort, relation_sort };
m_union_fn = m.mk_func_decl(p.get_family_id(), k, 0, 0, 2, domain);
m_union_fn = m.mk_func_decl(p.get_family_id(), k, 0, nullptr, 2, domain);
}
void operator()(relation_base & r, const relation_base & src, relation_base * delta) override {
@ -316,7 +316,7 @@ namespace datalog {
relation_union_fn * external_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, *this, OP_RA_UNION, get(src).get_sort());
}
@ -324,7 +324,7 @@ namespace datalog {
relation_union_fn * external_relation_plugin::mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, *this, OP_RA_WIDEN, get(src).get_sort());
}
@ -351,7 +351,7 @@ namespace datalog {
relation_mutator_fn * external_relation_plugin::mk_filter_interpreted_fn(const relation_base & r, app * condition) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(filter_interpreted_fn, *this, get(r).get_sort(), condition);
}
@ -359,7 +359,7 @@ namespace datalog {
relation_mutator_fn * external_relation_plugin::mk_filter_equal_fn(const relation_base & r,
const relation_element & value, unsigned col) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
ast_manager& m = get_ast_manager();
app_ref condition(m);
@ -407,7 +407,7 @@ namespace datalog {
relation_mutator_fn * external_relation_plugin::mk_filter_identical_fn(const relation_base & r,
unsigned col_cnt, const unsigned * identical_cols) {
if (!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, *this, get(r).get_sort(), col_cnt, identical_cols);
}
@ -447,7 +447,7 @@ namespace datalog {
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) {
if (!check_kind(t) || !check_kind(negated_obj)) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, *this, t, negated_obj, joined_col_cnt, t_cols, negated_cols);
}

View file

@ -245,14 +245,14 @@ namespace datalog {
}
finite_product_relation * finite_product_relation_plugin::mk_from_table_relation(const table_relation & r) {
func_decl* pred = 0;
func_decl* pred = nullptr;
const relation_signature & sig = r.get_signature();
const table_base & t = r.get_table();
table_plugin & tplugin = r.get_table().get_plugin();
relation_signature inner_sig; //empty signature for the inner relation
if(!get_inner_plugin().can_handle_signature(inner_sig)) {
return 0;
return nullptr;
}
table_signature idx_singleton_sig;
@ -270,7 +270,7 @@ namespace datalog {
idx_singleton_fact.push_back(0);
idx_singleton->add_fact(idx_singleton_fact);
scoped_ptr<table_join_fn> join_fun = get_manager().mk_join_fn(t, *idx_singleton, 0, 0, 0);
scoped_ptr<table_join_fn> join_fun = get_manager().mk_join_fn(t, *idx_singleton, 0, nullptr, nullptr);
SASSERT(join_fun);
scoped_rel<table_base> res_table = (*join_fun)(t, *idx_singleton);
@ -513,7 +513,7 @@ namespace datalog {
return alloc(converting_join_fn, *this, rb1.get_signature(), rb2.get_signature(), col_cnt, cols1,
cols2);
}
return 0;
return nullptr;
}
const finite_product_relation & r1 = get(rb1);
const finite_product_relation & r2 = get(rb2);
@ -590,7 +590,7 @@ namespace datalog {
unsigned orig_rel_cnt = r.m_others.size();
for(unsigned i=0; i<orig_rel_cnt; i++) {
relation_base * orig_rel = r.m_others[i];
res_relations.push_back(orig_rel ? orig_rel->clone() : 0);
res_relations.push_back(orig_rel ? orig_rel->clone() : nullptr);
}
SASSERT(res_relations.size()==orig_rel_cnt);
@ -608,7 +608,7 @@ namespace datalog {
res_table = (*tproject)(rtable);
}
relation_plugin * res_oplugin = 0;
relation_plugin * res_oplugin = nullptr;
if(!m_removed_rel_cols.empty()) {
unsigned res_rel_cnt = res_relations.size();
@ -651,7 +651,7 @@ namespace datalog {
relation_transformer_fn * finite_product_relation_plugin::mk_project_fn(const relation_base & rb, unsigned col_cnt,
const unsigned * removed_cols) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(project_fn, get(rb), col_cnt, removed_cols);
}
@ -705,7 +705,7 @@ namespace datalog {
unsigned orig_rel_cnt = r.m_others.size();
for(unsigned i=0; i<orig_rel_cnt; i++) {
relation_base * orig_rel = r.m_others[i];
res_relations.push_back(orig_rel ? orig_rel->clone() : 0);
res_relations.push_back(orig_rel ? orig_rel->clone() : nullptr);
}
if(!m_rel_identity) {
@ -746,7 +746,7 @@ namespace datalog {
unsigned permutation_cycle_len, const unsigned * permutation_cycle) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
const finite_product_relation & r = get(rb);
return alloc(rename_fn, r, permutation_cycle_len, permutation_cycle);
@ -771,7 +771,7 @@ namespace datalog {
relation_union_fn & get_inner_rel_union_op(relation_base & r) {
if(!m_rel_union) {
m_rel_union = r.get_manager().mk_union_fn(r, r, m_use_delta ? &r : 0);
m_rel_union = r.get_manager().mk_union_fn(r, r, m_use_delta ? &r : nullptr);
}
return *m_rel_union;
}
@ -1104,19 +1104,19 @@ namespace datalog {
relation_union_fn * finite_product_relation_plugin::mk_union_fn(const relation_base & tgtb, const relation_base & srcb,
const relation_base * deltab) {
if(&srcb.get_plugin()!=this) {
return 0;
return nullptr;
}
const finite_product_relation & src = get(srcb);
if(&tgtb.get_plugin()!=this || (deltab && &deltab->get_plugin()!=this) ) {
if(can_convert_to_table_relation(src)) {
return alloc(converting_union_fn);
}
return 0;
return nullptr;
}
const finite_product_relation * delta = get(deltab);
return alloc(union_fn, get(tgtb), delta!=0);
return alloc(union_fn, get(tgtb), delta!=nullptr);
}
@ -1131,7 +1131,7 @@ namespace datalog {
scoped_ptr<relation_mutator_fn> m_tr_filter;
public:
filter_identical_fn(const finite_product_relation & r, unsigned col_cnt, const unsigned * identical_cols)
: m_table_filter(0), m_rel_filter(0), m_tr_filter(0) {
: m_table_filter(nullptr), m_rel_filter(nullptr), m_tr_filter(nullptr) {
finite_product_relation_plugin & plugin = r.get_plugin();
for(unsigned i=0; i<col_cnt; i++) {
unsigned col = identical_cols[i];
@ -1192,7 +1192,7 @@ namespace datalog {
relation_mutator_fn * finite_product_relation_plugin::mk_filter_identical_fn(const relation_base & rb,
unsigned col_cnt, const unsigned * identical_cols) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, get(rb), col_cnt, identical_cols);
}
@ -1238,7 +1238,7 @@ namespace datalog {
relation_mutator_fn * finite_product_relation_plugin::mk_filter_equal_fn(const relation_base & rb,
const relation_element & value, unsigned col) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(filter_equal_fn, get(rb), value, col);
}
@ -1357,7 +1357,7 @@ namespace datalog {
unsigned rel_cnt = r.m_others.size();
for(unsigned i=0; i<rel_cnt; i++) {
relation_base * inner = r.m_others[i];
if(inner==0) {
if(inner==nullptr) {
continue;
}
if(!m_rel_filter) {
@ -1451,7 +1451,7 @@ namespace datalog {
relation_mutator_fn * finite_product_relation_plugin::mk_filter_interpreted_fn(const relation_base & rb,
app * condition) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(filter_interpreted_fn, get(rb), condition);
}
@ -1626,7 +1626,7 @@ namespace datalog {
const relation_base & negb, unsigned joined_col_cnt,
const unsigned * r_cols, const unsigned * negated_cols) {
if(&rb.get_plugin()!=this || &negb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, get(rb), get(negb), joined_col_cnt, r_cols, negated_cols);
@ -1852,8 +1852,8 @@ namespace datalog {
m_others.swap(r.m_others);
m_available_rel_indexes.swap(r.m_available_rel_indexes);
std::swap(m_full_rel_idx,r.m_full_rel_idx);
m_live_rel_collection_project=0;
m_empty_rel_removal_filter=0;
m_live_rel_collection_project=nullptr;
m_empty_rel_removal_filter=nullptr;
relation_base::swap(r0);
}
@ -1896,7 +1896,7 @@ namespace datalog {
unsigned finite_product_relation::get_full_rel_idx() {
if(m_full_rel_idx==UINT_MAX) {
m_full_rel_idx = get_next_rel_idx();
relation_base * full_other = mk_full_inner(0);
relation_base * full_other = mk_full_inner(nullptr);
m_others[m_full_rel_idx] = full_other;
}
return m_full_rel_idx;
@ -2027,9 +2027,9 @@ namespace datalog {
table_element full_rel_idx = get_full_rel_idx();
scoped_rel<table_base> complement_table = m_table->complement(p, &full_rel_idx);
scoped_ptr<table_union_fn> u_fn = get_manager().mk_union_fn(*m_table, *complement_table, 0);
scoped_ptr<table_union_fn> u_fn = get_manager().mk_union_fn(*m_table, *complement_table, nullptr);
SASSERT(u_fn);
(*u_fn)(*m_table, *complement_table, 0);
(*u_fn)(*m_table, *complement_table, nullptr);
}
finite_product_relation * finite_product_relation::complement(func_decl* p) const {

View file

@ -36,7 +36,7 @@ namespace datalog {
execution_context::execution_context(context & context)
: m_context(context),
m_stopwatch(0),
m_stopwatch(nullptr),
m_timelimit_ms(0) {}
execution_context::~execution_context() {
@ -271,10 +271,10 @@ namespace datalog {
bool perform(execution_context & ctx) override {
if (ctx.reg(m_src)) log_verbose(ctx);
if (m_clone) {
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.reg(m_src)->clone() : 0);
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.reg(m_src)->clone() : nullptr);
}
else {
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.release_reg(m_src) : 0);
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.release_reg(m_src) : nullptr);
}
return true;
}
@ -662,7 +662,7 @@ namespace datalog {
relation_base * new_delta = r_tgt.get_plugin().mk_empty(r_tgt);
ctx.set_reg(m_delta, new_delta);
}
relation_base * r_delta = (m_delta!=execution_context::void_register) ? ctx.reg(m_delta) : 0;
relation_base * r_delta = (m_delta!=execution_context::void_register) ? ctx.reg(m_delta) : nullptr;
relation_union_fn * fn;
@ -687,10 +687,10 @@ namespace datalog {
else {
if (!find_fn(r_tgt, r_src, fn)) {
if (m_widen) {
fn = r_src.get_manager().mk_widen_fn(r_tgt, r_src, 0);
fn = r_src.get_manager().mk_widen_fn(r_tgt, r_src, nullptr);
}
else {
fn = r_src.get_manager().mk_union_fn(r_tgt, r_src, 0);
fn = r_src.get_manager().mk_union_fn(r_tgt, r_src, nullptr);
}
if (!fn) {
std::stringstream sstm;
@ -1135,7 +1135,7 @@ namespace datalog {
dealloc(*it);
}
m_data.reset();
m_observer = 0;
m_observer = nullptr;
}
bool instruction_block::perform(execution_context & ctx) const {

View file

@ -107,7 +107,7 @@ namespace datalog {
*/
reg_type reg(reg_idx i) const {
if (i >= m_registers.size()) {
return 0;
return nullptr;
}
return m_registers[i];
}
@ -138,7 +138,7 @@ namespace datalog {
void make_empty(reg_idx i) {
if (reg(i)) {
set_reg(i, 0);
set_reg(i, nullptr);
}
}
@ -326,7 +326,7 @@ namespace datalog {
instr_seq_type m_data;
instruction_observer* m_observer;
public:
instruction_block() : m_observer(0) {}
instruction_block() : m_observer(nullptr) {}
~instruction_block();
void reset();

View file

@ -63,7 +63,7 @@ namespace datalog {
interval_relation const& r1 = get(_r1);
interval_relation const& r2 = get(_r2);
interval_relation_plugin& p = r1.get_plugin();
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(0, get_result_signature()));
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr());
return result;
}
@ -72,7 +72,7 @@ namespace datalog {
relation_join_fn * interval_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(r1) || !check_kind(r2)) {
return 0;
return nullptr;
}
return alloc(join_fn, r1.get_signature(), r2.get_signature(), col_cnt, cols1, cols2);
}
@ -87,7 +87,7 @@ namespace datalog {
relation_base * operator()(const relation_base & _r) override {
interval_relation const& r = get(_r);
interval_relation_plugin& p = r.get_plugin();
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(0, get_result_signature()));
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr());
return result;
}
@ -107,7 +107,7 @@ namespace datalog {
relation_base * operator()(const relation_base & _r) override {
interval_relation const& r = get(_r);
interval_relation_plugin& p = r.get_plugin();
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(0, get_result_signature()));
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr());
return result;
}
@ -116,7 +116,7 @@ namespace datalog {
relation_transformer_fn * interval_relation_plugin::mk_rename_fn(const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(rename_fn, r.get_signature(), cycle_len, permutation_cycle);
}
@ -134,7 +134,7 @@ namespace datalog {
high = src2.sup();
r_open = src2.is_upper_open();
}
return interval(dep(), low, l_open, 0, high, r_open, 0);
return interval(dep(), low, l_open, nullptr, high, r_open, nullptr);
}
interval interval_relation_plugin::widen(interval const& src1, interval const& src2) {
@ -151,7 +151,7 @@ namespace datalog {
high = ext_numeral(true);
r_open = true;
}
return interval(dep(), low, l_open, 0, high, r_open, 0);
return interval(dep(), low, l_open, nullptr, high, r_open, nullptr);
}
interval interval_relation_plugin::meet(interval const& src1, interval const& src2, bool& isempty) {
@ -179,7 +179,7 @@ namespace datalog {
return interval(dep());
}
else {
return interval(dep(), low, l_open, 0, high, r_open, 0);
return interval(dep(), low, l_open, nullptr, high, r_open, nullptr);
}
}
@ -209,7 +209,7 @@ namespace datalog {
r.mk_union(src, &d, m_is_widen);
}
else {
r.mk_union(src, 0, m_is_widen);
r.mk_union(src, nullptr, m_is_widen);
}
}
};
@ -217,7 +217,7 @@ namespace datalog {
relation_union_fn * interval_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, false);
}
@ -226,7 +226,7 @@ namespace datalog {
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, true);
}
@ -250,7 +250,7 @@ namespace datalog {
relation_mutator_fn * interval_relation_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
if(!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
@ -279,7 +279,7 @@ namespace datalog {
if(check_kind(r)) {
return alloc(filter_equal_fn, get_manager(), value, col);
}
return 0;
return nullptr;
}
@ -300,7 +300,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_fn, get(t), condition);
}
return 0;
return nullptr;
}
interval_relation& interval_relation_plugin::get(relation_base& r) {
@ -329,7 +329,7 @@ namespace datalog {
eq = m.mk_eq(m.mk_var(i, m.get_sort(e)), e);
r.filter_interpreted(eq.get());
}
mk_union(r, 0, false);
mk_union(r, nullptr, false);
}
bool interval_relation::contains_fact(const relation_fact & f) const {
@ -365,7 +365,7 @@ namespace datalog {
interval_relation * interval_relation::complement(func_decl*) const {
UNREACHABLE();
return 0;
return nullptr;
}
void interval_relation::to_formula(expr_ref& fml) const {
@ -434,22 +434,22 @@ namespace datalog {
// 0 < x - y + k
if (x == UINT_MAX) {
// y < k
mk_intersect(y, interval(p.dep(), k, true, false, 0));
mk_intersect(y, interval(p.dep(), k, true, false, nullptr));
return;
}
if (y == UINT_MAX) {
// -k < x
mk_intersect(x, interval(p.dep(), -k, true, true, 0));
mk_intersect(x, interval(p.dep(), -k, true, true, nullptr));
return;
}
// y < x + k
ext_numeral x_hi = (*this)[x].sup();
ext_numeral y_lo = (*this)[y].inf();
if (!x_hi.is_infinite()) {
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), true, false, 0));
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), true, false, nullptr));
}
if (!y_lo.is_infinite()) {
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, true, true, 0));
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, true, true, nullptr));
}
return;
}
@ -458,21 +458,21 @@ namespace datalog {
// 0 <= x - y + k
if (x == UINT_MAX) {
// y <= k
mk_intersect(y, interval(p.dep(), k, false, false, 0));
mk_intersect(y, interval(p.dep(), k, false, false, nullptr));
return;
}
if (y == UINT_MAX) {
// -k <= x
mk_intersect(x, interval(p.dep(), -k, false, true, 0));
mk_intersect(x, interval(p.dep(), -k, false, true, nullptr));
return;
}
ext_numeral x_hi = (*this)[x].sup();
ext_numeral y_lo = (*this)[y].inf();
if (!x_hi.is_infinite()) {
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), false, false, 0));
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), false, false, nullptr));
}
if (!y_lo.is_infinite()) {
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, false, true, 0));
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, false, true, nullptr));
}
return;
}

View file

@ -65,7 +65,7 @@ namespace datalog {
return alloc(join_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2);
}
else {
return 0;
return nullptr;
}
}
@ -81,7 +81,7 @@ namespace datalog {
lazy_table* delta = get(_delta);
table_base const* t_src = src.eval();
table_base * t_tgt = tgt.eval();
table_base * t_delta = delta?delta->eval():0;
table_base * t_delta = delta?delta->eval():nullptr;
verbose_action _t("union");
table_union_fn* m = tgt.get_lplugin().get_manager().mk_union_fn(*t_tgt, *t_src, t_delta);
SASSERT(m);
@ -98,7 +98,7 @@ namespace datalog {
return alloc(union_fn);
}
else {
return 0;
return nullptr;
}
}
@ -124,7 +124,7 @@ namespace datalog {
return alloc(project_fn, t.get_signature(), col_cnt, removed_cols);
}
else {
return 0;
return nullptr;
}
}
@ -150,7 +150,7 @@ namespace datalog {
return alloc(rename_fn, t.get_signature(), col_cnt, removed_cols);
}
else {
return 0;
return nullptr;
}
}
@ -175,7 +175,7 @@ namespace datalog {
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
else {
return 0;
return nullptr;
}
}
@ -201,7 +201,7 @@ namespace datalog {
return alloc(filter_interpreted_fn, cond);
}
else {
return 0;
return nullptr;
}
}
@ -229,7 +229,7 @@ namespace datalog {
return alloc(filter_by_negation_fn, joined_col_cnt, t_cols, negated_cols);
}
else {
return 0;
return nullptr;
}
}
@ -258,7 +258,7 @@ namespace datalog {
return alloc(filter_equal_fn, value, col);
}
else {
return 0;
return nullptr;
}
}
@ -269,7 +269,7 @@ namespace datalog {
return alloc(lazy_table_plugin, *sp);
}
else {
return 0;
return nullptr;
}
}
@ -397,7 +397,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_src->eval();
m_src->release_table();
m_src = 0;
m_src = nullptr;
verbose_action _t("filter_identical");
table_mutator_fn* m = rm().mk_filter_identical_fn(*m_table, m_cols.size(), m_cols.c_ptr());
SASSERT(m);
@ -410,7 +410,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_src->eval();
m_src->release_table();
m_src = 0;
m_src = nullptr;
verbose_action _t("filter_equal");
table_mutator_fn* m = rm().mk_filter_equal_fn(*m_table, m_value, m_col);
SASSERT(m);
@ -423,7 +423,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_src->eval();
m_src->release_table();
m_src = 0;
m_src = nullptr;
verbose_action _t("filter_interpreted");
table_mutator_fn* m = rm().mk_filter_interpreted_fn(*m_table, m_condition);
SASSERT(m);
@ -436,7 +436,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_tgt->eval();
m_tgt->release_table();
m_tgt = 0;
m_tgt = nullptr;
switch(m_src->kind()) {

View file

@ -136,7 +136,7 @@ namespace datalog {
}
table_base * clone() const override;
table_base * complement(func_decl* p, const table_element * func_columns = 0) const override;
table_base * complement(func_decl* p, const table_element * func_columns = nullptr) const override;
bool empty() const override;
bool contains_fact(const table_fact & f) const override;
void remove_fact(table_element const* fact) override;

View file

@ -189,7 +189,7 @@ namespace datalog {
}
bool is_undefined(unsigned col_idx) const {
return m_data[col_idx]==0;
return m_data[col_idx]==nullptr;
}
bool no_undefined() const {
if (empty()) {
@ -296,7 +296,7 @@ namespace datalog {
class explanation_relation_plugin::join_fn : public convenient_relation_join_fn {
public:
join_fn(const relation_signature & sig1, const relation_signature & sig2)
: convenient_relation_join_fn(sig1, sig2, 0, 0, 0) {}
: convenient_relation_join_fn(sig1, sig2, 0, nullptr, nullptr) {}
relation_base * operator()(const relation_base & r1_0, const relation_base & r2_0) override {
const explanation_relation & r1 = static_cast<const explanation_relation &>(r1_0);
@ -317,10 +317,10 @@ namespace datalog {
relation_join_fn * explanation_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (&r1.get_plugin()!=this || &r2.get_plugin()!=this) {
return 0;
return nullptr;
}
if (col_cnt!=0) {
return 0;
return nullptr;
}
return alloc(join_fn, r1.get_signature(), r2.get_signature());
}
@ -348,7 +348,7 @@ namespace datalog {
relation_transformer_fn * explanation_relation_plugin::mk_project_fn(const relation_base & r, unsigned col_cnt,
const unsigned * removed_cols) {
if (&r.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(project_fn, r.get_signature(), col_cnt, removed_cols);
}
@ -385,7 +385,7 @@ namespace datalog {
void operator()(relation_base & tgt0, const relation_base & src0, relation_base * delta0) override {
explanation_relation & tgt = static_cast<explanation_relation &>(tgt0);
const explanation_relation & src = static_cast<const explanation_relation &>(src0);
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : 0;
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : nullptr;
explanation_relation_plugin & plugin = tgt.get_plugin();
if (!src.no_undefined() || !tgt.no_undefined() || (delta && !delta->no_undefined())) {
@ -420,7 +420,7 @@ namespace datalog {
public:
void operator()(relation_base & tgt0, const relation_base & src, relation_base * delta0) override {
explanation_relation & tgt = static_cast<explanation_relation &>(tgt0);
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : 0;
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : nullptr;
if (src.empty()) {
return;
@ -435,7 +435,7 @@ namespace datalog {
relation_union_fn * explanation_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
if (!check_kind(src)) {
//this is to handle the product relation
@ -480,11 +480,11 @@ namespace datalog {
relation_mutator_fn * explanation_relation_plugin::mk_filter_interpreted_fn(const relation_base & r,
app * cond) {
if (&r.get_plugin()!=this) {
return 0;
return nullptr;
}
ast_manager & m = get_ast_manager();
if (!m.is_eq(cond)) {
return 0;
return nullptr;
}
expr * arg1 = cond->get_arg(0);
expr * arg2 = cond->get_arg(1);
@ -494,12 +494,12 @@ namespace datalog {
}
if (!is_var(arg1) || !is_app(arg2)) {
return 0;
return nullptr;
}
var * col_var = to_var(arg1);
app * new_rule = to_app(arg2);
if (!get_context().get_decl_util().is_rule_sort(col_var->get_sort())) {
return 0;
return nullptr;
}
unsigned col_idx = col_var->get_idx();
@ -520,7 +520,7 @@ namespace datalog {
const relation_base & neg, unsigned joined_col_cnt, const unsigned * t_cols,
const unsigned * negated_cols) {
if (&r.get_plugin()!=this || &neg.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn);
}
@ -569,18 +569,18 @@ namespace datalog {
const relation_base & tgt, const relation_base & src, unsigned joined_col_cnt,
const unsigned * tgt_cols, const unsigned * src_cols) {
if (&tgt.get_plugin()!=this || &src.get_plugin()!=this) {
return 0;
return nullptr;
}
//this checks the join is one to one on all columns
if (tgt.get_signature()!=src.get_signature()
|| joined_col_cnt!=tgt.get_signature().size()
|| !containers_equal(tgt_cols, tgt_cols+joined_col_cnt, src_cols, src_cols+joined_col_cnt)) {
return 0;
return nullptr;
}
counter ctr;
ctr.count(joined_col_cnt, tgt_cols);
if (ctr.get_max_counter_value()>1 || (joined_col_cnt && ctr.get_max_positive()!=joined_col_cnt-1)) {
return 0;
return nullptr;
}
return alloc(intersection_filter_fn, *this);
}
@ -776,7 +776,7 @@ namespace datalog {
app_ref orig_lit(m_manager.mk_app(orig_decl, lit_args.c_ptr()), m_manager);
app_ref e_lit(get_e_lit(orig_lit, arity), m_manager);
app * tail[] = { e_lit.get() };
dst.add_rule(m_context.get_rule_manager().mk(orig_lit, 1, tail, 0));
dst.add_rule(m_context.get_rule_manager().mk(orig_lit, 1, tail, nullptr));
}
}
@ -852,7 +852,7 @@ namespace datalog {
translate_rel_level_relation(rmgr, orig_rel, e_rel);
}
else {
scoped_ptr<relation_join_fn> product_fun = rmgr.mk_join_fn(orig_rel, *m_e_fact_relation, 0, 0, 0);
scoped_ptr<relation_join_fn> product_fun = rmgr.mk_join_fn(orig_rel, *m_e_fact_relation, 0, nullptr, nullptr);
SASSERT(product_fun);
scoped_rel<relation_base> aux_extended_rel = (*product_fun)(orig_rel, *m_e_fact_relation);
TRACE("dl", tout << aux_extended_rel << " " << aux_extended_rel->get_plugin().get_name() << "\n";
@ -868,10 +868,10 @@ namespace datalog {
rule_set * mk_explanations::operator()(rule_set const & source) {
if (source.empty()) {
return 0;
return nullptr;
}
if (!m_context.generate_explanations()) {
return 0;
return nullptr;
}
rule_set * res = alloc(rule_set, m_context);
transform_facts(m_context.get_rel_context()->get_rmanager(), source, *res);

View file

@ -531,7 +531,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_result_rules.size();

View file

@ -165,7 +165,7 @@ namespace datalog {
SASSERT(is_var(t->get_arg(i)));
var * v = to_var(t->get_arg(i));
unsigned var_idx = v->get_idx();
if (result[res_ofs-var_idx]==0) {
if (result[res_ofs-var_idx]==nullptr) {
result[res_ofs-var_idx]=m.mk_var(next_var, v->get_sort());
next_var++;
}
@ -235,7 +235,7 @@ namespace datalog {
//so the order should not matter
}
result.resize(max_var_idx+1, static_cast<expr *>(0));
result.resize(max_var_idx+1, static_cast<expr *>(nullptr));
unsigned next_var = 0;
get_normalizer(t1, next_var, result);
get_normalizer(t2, next_var, result);
@ -268,9 +268,9 @@ namespace datalog {
*/
void register_pair(app * t1, app * t2, rule * r, const var_idx_set & non_local_vars) {
SASSERT(t1!=t2);
cost_map::entry * e = m_costs.insert_if_not_there2(get_key(t1, t2), 0);
cost_map::entry * e = m_costs.insert_if_not_there2(get_key(t1, t2), nullptr);
pair_info * & ptr_inf = e->get_data().m_value;
if (ptr_inf==0) {
if (ptr_inf==nullptr) {
ptr_inf = alloc(pair_info);
}
pair_info & inf = *ptr_inf;
@ -297,7 +297,7 @@ namespace datalog {
}
void remove_rule_from_pair(app_pair key, rule * r, unsigned original_len) {
pair_info * ptr = 0;
pair_info * ptr = nullptr;
if (m_costs.find(key, ptr) && ptr &&
ptr->remove_rule(r, original_len)) {
SASSERT(ptr->m_rules.empty());
@ -354,7 +354,7 @@ namespace datalog {
void join_pair(app_pair pair_key) {
app * t1 = pair_key.first;
app * t2 = pair_key.second;
pair_info* infp = 0;
pair_info* infp = nullptr;
if (!m_costs.find(pair_key, infp) || !infp) {
UNREACHABLE();
return;
@ -402,7 +402,7 @@ namespace datalog {
app * tail[] = {t1, t2};
rule * new_rule = m_context.get_rule_manager().mk(head, 2, tail, 0);
rule * new_rule = m_context.get_rule_manager().mk(head, 2, tail, nullptr);
//TODO: update accounting so that it can handle multiple parents
new_rule->set_accounting_parent_object(m_context, one_parent);
@ -702,7 +702,7 @@ namespace datalog {
}
if (!m_modified_rules) {
return 0;
return nullptr;
}
rule_set * result = alloc(rule_set, m_context);
rule_pred_map::iterator rcit = m_rules_content.begin();

View file

@ -261,7 +261,7 @@ namespace datalog {
void init(relation_signature const& r1_sig, unsigned num_rels1, relation_base const* const* r1,
relation_signature const& r2_sig, unsigned num_rels2, relation_base const* const* r2,
unsigned col_cnt, unsigned const* cols1, unsigned const* cols2) {
func_decl* p = 0;
func_decl* p = nullptr;
bit_vector bv;
bv.resize(num_rels2);
relation_manager& rmgr = m_plugin.get_manager();
@ -453,7 +453,7 @@ namespace datalog {
TRACE("dl", _r1.display(tout); _r2.display(tout););
ptr_vector<relation_base> relations;
unsigned sz = m_joins.size();
relation_base* result = 0;
relation_base* result = nullptr;
for (unsigned i = 0; i < sz; ++i) {
relation_base const& r1 = (m_kind1[i] == T_FULL)?(*m_full[m_offset1[i]]):access(m_offset1[i], _r1);
relation_base const& r2 = (m_kind2[i] == T_FULL)?(*m_full[m_offset2[i]]):access(m_offset2[i], _r2);
@ -479,7 +479,7 @@ namespace datalog {
if (r1.get_kind() != r2.get_kind()) {
return alloc(join_fn, *this, r1, r2, col_cnt, cols1, cols2);
}
return 0;
return nullptr;
}
@ -519,7 +519,7 @@ namespace datalog {
relation_signature::from_project(r.get_signature(), col_cnt, removed_cols, s);
return alloc(transform_fn, s, projs.size(), projs.c_ptr());
}
return 0;
return nullptr;
}
relation_transformer_fn * product_relation_plugin::mk_rename_fn(const relation_base & _r,
@ -534,7 +534,7 @@ namespace datalog {
relation_signature::from_rename(r.get_signature(), cycle_len, permutation_cycle, s);
return alloc(transform_fn, s, trans.size(), trans.c_ptr());
}
return 0;
return nullptr;
}
class product_relation_plugin::aligned_union_fn : public relation_union_fn {
@ -549,7 +549,7 @@ namespace datalog {
void mk_union_fn(unsigned i, unsigned j, relation_base const& r1, relation_base const& r2,
const relation_base* delta) {
relation_manager& rmgr = r1.get_manager();
relation_union_fn* u = 0;
relation_union_fn* u = nullptr;
if (m_is_widen) {
u = rmgr.mk_widen_fn(r1, r2, delta);
}
@ -596,7 +596,7 @@ namespace datalog {
return;
}
do_intersection(*tgt, *src);
src = 0;
src = nullptr;
}
void do_intersection(relation_base& tgt, relation_base& src) {
@ -625,7 +625,7 @@ namespace datalog {
m_is_widen(is_widen) {
SASSERT(vectors_equal(tgt.m_spec, src.m_spec));
SASSERT(!delta || vectors_equal(tgt.m_spec, delta->m_spec));
init(tgt.m_relations, src.m_relations, delta ? &delta->m_relations : 0);
init(tgt.m_relations, src.m_relations, delta ? &delta->m_relations : nullptr);
}
~aligned_union_fn() override {
@ -650,9 +650,9 @@ namespace datalog {
for (unsigned i = 0; i < num; ++i) {
relation_base& itgt = tgt[i];
relation_base* idelta = delta ? &(*delta)[i] : 0;
relation_base* idelta = delta ? &(*delta)[i] : nullptr;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : 0;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : nullptr;
scoped_rel<relation_base> side_result;
scoped_rel<relation_base> side_delta;
@ -665,7 +665,7 @@ namespace datalog {
TRACE("dl", itgt.display(tout << "tgt:\n"); src[j].display(tout << "src:\n"););
// union[i][j]
scoped_rel<relation_base> one_side_union = itgt.clone();
scoped_rel<relation_base> one_side_delta = fresh_delta ? fresh_delta->clone() : 0;
scoped_rel<relation_base> one_side_delta = fresh_delta ? fresh_delta->clone() : nullptr;
TRACE("dl", one_side_union->display(tout << "union 1:\n"); src[j].display(tout););
do_inner_union(i, j, *one_side_union, src[j], one_side_delta.get());
TRACE("dl", one_side_union->display(tout << "union:\n"););
@ -679,7 +679,7 @@ namespace datalog {
// union[j][i]
one_side_union = src[i].clone();
one_side_delta = fresh_delta ? fresh_delta->clone() : 0;
one_side_delta = fresh_delta ? fresh_delta->clone() : nullptr;
TRACE("dl", one_side_union->display(tout << "union 2:\n"); tgt[j].display(tout););
do_inner_union(i, j, *one_side_union, tgt[j], one_side_delta.get());
TRACE("dl", one_side_union->display(tout << "union:\n"););
@ -697,8 +697,8 @@ namespace datalog {
}
for (unsigned i = 0; i < num; ++i) {
relation_base& itgt = tgt[i];
relation_base* idelta = delta ? &(*delta)[i] : 0;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : 0;
relation_base* idelta = delta ? &(*delta)[i] : nullptr;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : nullptr;
scoped_rel<relation_base> side_result(side_results[i]);
scoped_rel<relation_base> side_delta(side_deltas[i]);
@ -752,7 +752,7 @@ namespace datalog {
TRACE("dl_verbose", _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
product_relation& tgt = get(_tgt);
product_relation const& src0 = get(_src);
product_relation* delta = _delta ? get(_delta) : 0;
product_relation* delta = _delta ? get(_delta) : nullptr;
tgt.convert_spec(m_common_spec);
if(delta) {
@ -815,7 +815,7 @@ namespace datalog {
}
}
}
return 0;
return nullptr;
}
relation_union_fn * product_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
@ -867,7 +867,7 @@ namespace datalog {
return alloc(mutator_fn, mutators.size(), mutators.c_ptr());
}
}
return 0;
return nullptr;
}
relation_mutator_fn * product_relation_plugin::mk_filter_equal_fn(const relation_base & _t,
@ -885,7 +885,7 @@ namespace datalog {
return alloc(mutator_fn, mutators.size(), mutators.c_ptr());
}
}
return 0;
return nullptr;
}
class product_relation_plugin::filter_interpreted_fn : public relation_mutator_fn {
@ -983,7 +983,7 @@ namespace datalog {
void product_relation::convert_spec(const rel_spec & spec) {
func_decl* p = 0;
func_decl* p = nullptr;
const relation_signature & sig = get_signature();
family_id new_kind = get_plugin().get_relation_kind(sig, spec);
if (new_kind == get_kind()) {
@ -1008,7 +1008,7 @@ namespace datalog {
//the loop is quadratic with the number of relations, maybe we want to fix it
for(unsigned i=0; i<new_sz; i++) {
family_id ikind = spec[i];
relation_base * irel = 0;
relation_base * irel = nullptr;
//we try to find the relation for the new specification among those we already have
for(unsigned j=0; j<old_sz; j++) {
if(m_relations[j] && m_relations[j]->get_kind()==ikind) {
@ -1096,7 +1096,7 @@ namespace datalog {
return res;
}
UNREACHABLE();
return 0;
return nullptr;
}
bool product_relation::empty() const {

View file

@ -47,8 +47,8 @@ namespace datalog {
void relation_manager::reset() {
reset_relations();
m_favourite_table_plugin = static_cast<table_plugin *>(0);
m_favourite_relation_plugin = static_cast<relation_plugin *>(0);
m_favourite_table_plugin = static_cast<table_plugin *>(nullptr);
m_favourite_relation_plugin = static_cast<relation_plugin *>(nullptr);
dealloc_ptr_vector_content(m_table_plugins);
m_table_plugins.reset();
dealloc_ptr_vector_content(m_relation_plugins);
@ -95,9 +95,9 @@ namespace datalog {
}
relation_base * relation_manager::try_get_relation(func_decl * pred) const {
relation_base * res = 0;
relation_base * res = nullptr;
if(!m_relations.find(pred, res)) {
return 0;
return nullptr;
}
SASSERT(res);
return res;
@ -217,7 +217,7 @@ namespace datalog {
return *rpit;
}
}
return 0;
return nullptr;
}
relation_plugin & relation_manager::get_appropriate_plugin(const relation_signature & s) {
@ -239,7 +239,7 @@ namespace datalog {
return *tpit;
}
}
return 0;
return nullptr;
}
table_plugin & relation_manager::get_appropriate_plugin(const table_signature & t) {
@ -258,13 +258,13 @@ namespace datalog {
return *rpit;
}
}
return 0;
return nullptr;
}
relation_plugin & relation_manager::get_relation_plugin(family_id kind) {
SASSERT(kind>=0);
SASSERT(kind<m_next_relation_fid);
relation_plugin * res = 0;
relation_plugin * res = nullptr;
VERIFY(m_kind2plugin.find(kind, res));
return *res;
}
@ -275,11 +275,11 @@ namespace datalog {
return tp;
}
}
return 0;
return nullptr;
}
table_relation_plugin & relation_manager::get_table_relation_plugin(table_plugin & tp) {
table_relation_plugin * res = 0;
table_relation_plugin * res = nullptr;
VERIFY( m_table_relation_plugins.find(&tp, res) );
return *res;
}
@ -612,7 +612,7 @@ namespace datalog {
unsigned removed_col_cnt,
const unsigned * removed_cols)
: m_filter(filter),
m_project(0),
m_project(nullptr),
m_removed_cols(removed_col_cnt, removed_cols) {}
relation_base * operator()(const relation_base & t) override {
@ -686,7 +686,7 @@ namespace datalog {
*/
default_relation_join_project_fn(join_fn * join, unsigned removed_col_cnt,
const unsigned * removed_cols)
: m_join(join), m_project(0), m_removed_cols(removed_col_cnt, removed_cols) {}
: m_join(join), m_project(nullptr), m_removed_cols(removed_col_cnt, removed_cols) {}
relation_base * operator()(const relation_base & t1, const relation_base & t2) override {
scoped_rel<relation_base> aux = (*m_join)(t1, t2);
@ -851,21 +851,21 @@ namespace datalog {
scoped_rel<relation_join_fn> join_fun = mk_join_project_fn(tgt, src, joined_col_cnt, tgt_cols, src_cols,
join_removed_cols.size(), join_removed_cols.c_ptr(), false);
if(!join_fun) {
return 0;
return nullptr;
}
//we perform the join operation here to see what the result is
scoped_rel<relation_base> join_res = (*join_fun)(tgt, src);
if(tgt.can_swap(*join_res)) {
return alloc(default_relation_intersection_filter_fn, join_fun.release(), 0);
return alloc(default_relation_intersection_filter_fn, join_fun.release(), nullptr);
}
if(join_res->get_plugin().is_product_relation()) {
//we cannot have the product relation here, since it uses the intersection operation
//for unions and therefore we would get into an infinite recursion
return 0;
return nullptr;
}
scoped_rel<relation_union_fn> union_fun = mk_union_fn(tgt, *join_res);
if(!union_fun) {
return 0;
return nullptr;
}
return alloc(default_relation_intersection_filter_fn, join_fun.release(), union_fun.release());
}
@ -1357,11 +1357,11 @@ namespace datalog {
static table_mutator_fn* mk(context& ctx, expr* condition) {
ast_manager& m = ctx.get_manager();
if (!m.is_not(condition)) {
return 0;
return nullptr;
}
condition = to_app(condition)->get_arg(0);
if (!m.is_eq(condition)) {
return 0;
return nullptr;
}
expr* x = to_app(condition)->get_arg(0);
expr* y = to_app(condition)->get_arg(1);
@ -1369,12 +1369,12 @@ namespace datalog {
std::swap(x, y);
}
if (!is_var(x)) {
return 0;
return nullptr;
}
dl_decl_util decl_util(m);
uint64 value = 0;
if (!decl_util.is_numeral_ext(y, value)) {
return 0;
return nullptr;
}
return alloc(default_table_filter_not_equal_fn, ctx, to_var(x)->get_idx(), value);
}
@ -1410,7 +1410,7 @@ namespace datalog {
unsigned col_cnt = f.size();
for(int i=col_cnt-1;i>=0;i--) {
if(!m_free_vars.contains(i)) {
args.push_back(0);
args.push_back(nullptr);
continue; //this variable does not occur in the condition;
}
@ -1502,7 +1502,7 @@ namespace datalog {
default_table_negation_filter_fn(const table_base & tgt, const table_base & neg_t,
unsigned joined_col_cnt, const unsigned * t_cols, const unsigned * negated_cols)
: convenient_table_negation_filter_fn(tgt, neg_t, joined_col_cnt, t_cols, negated_cols),
m_negated_table(0) {
m_negated_table(nullptr) {
m_aux_fact.resize(neg_t.get_signature().size());
}
@ -1603,7 +1603,7 @@ namespace datalog {
SASSERT(t.get_signature().functional_columns()>0);
table_plugin & plugin = t.get_plugin();
m_aux_table = plugin.mk_empty(t.get_signature());
m_union_fn = plugin.mk_union_fn(t, *m_aux_table, static_cast<table_base *>(0));
m_union_fn = plugin.mk_union_fn(t, *m_aux_table, static_cast<table_base *>(nullptr));
}
~default_table_map_fn() override {}
@ -1625,7 +1625,7 @@ namespace datalog {
}
t.reset();
(*m_union_fn)(t, *m_aux_table, static_cast<table_base *>(0));
(*m_union_fn)(t, *m_aux_table, static_cast<table_base *>(nullptr));
}
};

View file

@ -109,8 +109,8 @@ namespace datalog {
public:
relation_manager(context & ctx) :
m_context(ctx),
m_favourite_table_plugin(0),
m_favourite_relation_plugin(0),
m_favourite_table_plugin(nullptr),
m_favourite_relation_plugin(nullptr),
m_next_table_fid(0),
m_next_relation_fid(0) {}
@ -331,7 +331,7 @@ namespace datalog {
const relation_base * delta);
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src) {
return mk_union_fn(tgt, src, static_cast<relation_base *>(0));
return mk_union_fn(tgt, src, static_cast<relation_base *>(nullptr));
}
/**
@ -510,7 +510,7 @@ namespace datalog {
const table_base * delta);
table_union_fn * mk_union_fn(const table_base & tgt, const table_base & src) {
return mk_union_fn(tgt, src, static_cast<table_base *>(0));
return mk_union_fn(tgt, src, static_cast<table_base *>(nullptr));
}
/**

View file

@ -226,7 +226,7 @@ namespace datalog {
relation_base * sieve_relation_plugin::mk_empty(const relation_signature & s) {
UNREACHABLE();
return 0;
return nullptr;
#if 0
svector<bool> inner_cols(s.size());
extract_inner_columns(s, inner_cols.c_ptr());
@ -278,8 +278,8 @@ namespace datalog {
m_inner_join_fun(inner_join_fun) {
bool r1_sieved = r1.get_plugin().is_sieve_relation();
bool r2_sieved = r2.get_plugin().is_sieve_relation();
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0;
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : nullptr;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : nullptr;
if(r1_sieved) {
m_result_inner_cols.append(sr1->m_inner_cols);
}
@ -298,8 +298,8 @@ namespace datalog {
bool r1_sieved = r1.get_plugin().is_sieve_relation();
bool r2_sieved = r2.get_plugin().is_sieve_relation();
SASSERT(r1_sieved || r2_sieved);
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0;
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : nullptr;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : nullptr;
const relation_base & inner1 = r1_sieved ? sr1->get_inner() : r1;
const relation_base & inner2 = r2_sieved ? sr2->get_inner() : r2;
@ -313,12 +313,12 @@ namespace datalog {
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if( &r1.get_plugin()!=this && &r2.get_plugin()!=this ) {
//we create just operations that involve the current plugin
return 0;
return nullptr;
}
bool r1_sieved = r1.get_plugin().is_sieve_relation();
bool r2_sieved = r2.get_plugin().is_sieve_relation();
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0;
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : nullptr;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : nullptr;
const relation_base & inner1 = r1_sieved ? sr1->get_inner() : r1;
const relation_base & inner2 = r2_sieved ? sr2->get_inner() : r2;
@ -340,7 +340,7 @@ namespace datalog {
relation_join_fn * inner_join_fun = get_manager().mk_join_fn(inner1, inner2, inner_cols1, inner_cols2, false);
if(!inner_join_fun) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, r1, r2, col_cnt, cols1, cols2, inner_join_fun);
}
@ -371,7 +371,7 @@ namespace datalog {
relation_transformer_fn * sieve_relation_plugin::mk_project_fn(const relation_base & r0, unsigned col_cnt,
const unsigned * removed_cols) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
unsigned_vector inner_removed_cols;
@ -398,7 +398,7 @@ namespace datalog {
}
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.c_ptr());
}
@ -406,7 +406,7 @@ namespace datalog {
relation_transformer_fn * sieve_relation_plugin::mk_rename_fn(const relation_base & r0,
unsigned cycle_len, const unsigned * permutation_cycle) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
@ -428,7 +428,7 @@ namespace datalog {
relation_transformer_fn * inner_fun =
get_manager().mk_permutation_rename_fn(r.get_inner(), inner_permutation);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.c_ptr());
}
@ -443,9 +443,9 @@ namespace datalog {
bool tgt_sieved = tgt.get_plugin().is_sieve_relation();
bool src_sieved = src.get_plugin().is_sieve_relation();
bool delta_sieved = delta && delta->get_plugin().is_sieve_relation();
sieve_relation * stgt = tgt_sieved ? static_cast<sieve_relation *>(&tgt) : 0;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : 0;
sieve_relation * sdelta = delta_sieved ? static_cast<sieve_relation *>(delta) : 0;
sieve_relation * stgt = tgt_sieved ? static_cast<sieve_relation *>(&tgt) : nullptr;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : nullptr;
sieve_relation * sdelta = delta_sieved ? static_cast<sieve_relation *>(delta) : nullptr;
relation_base & itgt = tgt_sieved ? stgt->get_inner() : tgt;
const relation_base & isrc = src_sieved ? ssrc->get_inner() : src;
relation_base * idelta = delta_sieved ? &sdelta->get_inner() : delta;
@ -458,15 +458,15 @@ namespace datalog {
const relation_base * delta) {
if(&tgt.get_plugin()!=this && &src.get_plugin()!=this && (delta && &delta->get_plugin()!=this)) {
//we create the operation only if it involves this plugin
return 0;
return nullptr;
}
bool tgt_sieved = tgt.get_plugin().is_sieve_relation();
bool src_sieved = src.get_plugin().is_sieve_relation();
bool delta_sieved = delta && delta->get_plugin().is_sieve_relation();
const sieve_relation * stgt = tgt_sieved ? static_cast<const sieve_relation *>(&tgt) : 0;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : 0;
const sieve_relation * sdelta = delta_sieved ? static_cast<const sieve_relation *>(delta) : 0;
const sieve_relation * stgt = tgt_sieved ? static_cast<const sieve_relation *>(&tgt) : nullptr;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : nullptr;
const sieve_relation * sdelta = delta_sieved ? static_cast<const sieve_relation *>(delta) : nullptr;
const relation_base & itgt = tgt_sieved ? stgt->get_inner() : tgt;
const relation_base & isrc = src_sieved ? ssrc->get_inner() : src;
const relation_base * idelta = delta_sieved ? &sdelta->get_inner() : delta;
@ -476,7 +476,7 @@ namespace datalog {
if( tgt_sieved && src_sieved && (!delta || delta_sieved) ) {
if( !vectors_equal(stgt->m_inner_cols, ssrc->m_inner_cols)
|| (delta && !vectors_equal(stgt->m_inner_cols, sdelta->m_inner_cols)) ) {
return 0;
return nullptr;
}
}
else {
@ -485,13 +485,13 @@ namespace datalog {
|| (sdelta && !sdelta->no_sieved_columns()) ) {
//We have an unsieved relation and then some relation with some sieved columns,
//which means there is an misalignment.
return 0;
return nullptr;
}
}
relation_union_fn * union_fun = get_manager().mk_union_fn(itgt, isrc, idelta);
if(!union_fun) {
return 0;
return nullptr;
}
return alloc(union_fn, union_fun);
@ -515,7 +515,7 @@ namespace datalog {
relation_mutator_fn * sieve_relation_plugin::mk_filter_identical_fn(const relation_base & r0,
unsigned col_cnt, const unsigned * identical_cols) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
unsigned_vector inner_icols;
@ -534,7 +534,7 @@ namespace datalog {
relation_mutator_fn * inner_fun = get_manager().mk_filter_identical_fn(r.get_inner(), inner_icols);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(filter_fn, inner_fun);
}
@ -542,7 +542,7 @@ namespace datalog {
relation_mutator_fn * sieve_relation_plugin::mk_filter_equal_fn(const relation_base & r0,
const relation_element & value, unsigned col) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
if(!r.is_inner_col(col)) {
@ -553,7 +553,7 @@ namespace datalog {
relation_mutator_fn * inner_fun = get_manager().mk_filter_equal_fn(r.get_inner(), value, inner_col);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(filter_fn, inner_fun);
}
@ -561,7 +561,7 @@ namespace datalog {
relation_mutator_fn * sieve_relation_plugin::mk_filter_interpreted_fn(const relation_base & rb,
app * condition) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
ast_manager & m = get_ast_manager();
const sieve_relation & r = static_cast<const sieve_relation &>(rb);
@ -589,7 +589,7 @@ namespace datalog {
relation_mutator_fn * inner_fun = get_manager().mk_filter_interpreted_fn(r.get_inner(), to_app(inner_cond));
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(filter_fn, inner_fun);
}
@ -604,8 +604,8 @@ namespace datalog {
bool r_sieved = r.get_plugin().is_sieve_relation();
bool neg_sieved = neg.get_plugin().is_sieve_relation();
SASSERT(r_sieved || neg_sieved);
sieve_relation * sr = r_sieved ? static_cast<sieve_relation *>(&r) : 0;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : 0;
sieve_relation * sr = r_sieved ? static_cast<sieve_relation *>(&r) : nullptr;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : nullptr;
relation_base & inner_r = r_sieved ? sr->get_inner() : r;
const relation_base & inner_neg = neg_sieved ? sneg->get_inner() : neg;
@ -618,13 +618,13 @@ namespace datalog {
const unsigned * neg_cols) {
if(&r.get_plugin()!=this && &neg.get_plugin()!=this) {
//we create just operations that involve the current plugin
return 0;
return nullptr;
}
bool r_sieved = r.get_plugin().is_sieve_relation();
bool neg_sieved = neg.get_plugin().is_sieve_relation();
SASSERT(r_sieved || neg_sieved);
const sieve_relation * sr = r_sieved ? static_cast<const sieve_relation *>(&r) : 0;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : 0;
const sieve_relation * sr = r_sieved ? static_cast<const sieve_relation *>(&r) : nullptr;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : nullptr;
const relation_base & inner_r = r_sieved ? sr->get_inner() : r;
const relation_base & inner_neg = neg_sieved ? sneg->get_inner() : neg;
@ -657,7 +657,7 @@ namespace datalog {
relation_intersection_filter_fn * inner_fun =
get_manager().mk_filter_by_negation_fn(inner_r, inner_neg, ir_cols, ineg_cols);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, inner_fun);
}

View file

@ -257,8 +257,8 @@ namespace datalog {
\brief Empty result.
*/
query_result() : m_singleton(false) {
m_many.begin = 0;
m_many.end = 0;
m_many.begin = nullptr;
m_many.end = nullptr;
}
query_result(offset_iterator begin, offset_iterator end) : m_singleton(false) {
m_many.begin = begin;
@ -327,7 +327,7 @@ namespace datalog {
key_value key;
key.resize(key_len);
offset_vector * index_entry = 0;
offset_vector * index_entry = nullptr;
bool key_modified = true;
for (; ofs!=after_last; ofs+=t.m_fact_size) {
@ -473,7 +473,7 @@ namespace datalog {
#endif
key_spec kspec;
kspec.append(key_len, key_cols);
key_index_map::entry * key_map_entry = m_key_indexes.insert_if_not_there2(kspec, 0);
key_index_map::entry * key_map_entry = m_key_indexes.insert_if_not_there2(kspec, nullptr);
if (!key_map_entry->get_data().m_value) {
if (full_signature_key_indexer::can_handle(key_len, key_cols, *this)) {
key_map_entry->get_data().m_value = alloc(full_signature_key_indexer, key_len, key_cols, *this);
@ -777,9 +777,9 @@ namespace datalog {
const table_signature & sig = t->get_signature();
t->reset();
table_pool::entry * e = m_pool.insert_if_not_there2(sig, 0);
table_pool::entry * e = m_pool.insert_if_not_there2(sig, nullptr);
sp_table_vector * & vect = e->get_data().m_value;
if (vect == 0) {
if (vect == nullptr) {
vect = alloc(sp_table_vector);
}
IF_VERBOSE(12, verbose_stream() << "Recycle: " << t->get_size_estimate_bytes() << "\n";);
@ -859,9 +859,9 @@ namespace datalog {
if (t1.get_kind()!=get_kind() || t2.get_kind()!=get_kind()
|| join_involves_functional(sig1, sig2, col_cnt, cols1, cols2)) {
//We also don't allow indexes on functional columns (and they are needed for joins)
return 0;
return nullptr;
}
return mk_join_project_fn(t1, t2, col_cnt, cols1, cols2, 0, static_cast<unsigned*>(0));
return mk_join_project_fn(t1, t2, col_cnt, cols1, cols2, 0, static_cast<unsigned*>(nullptr));
}
table_join_fn * sparse_table_plugin::mk_join_project_fn(const table_base & t1, const table_base & t2,
@ -874,7 +874,7 @@ namespace datalog {
|| join_involves_functional(sig1, sig2, col_cnt, cols1, cols2)) {
//We don't allow sparse tables with zero signatures (and project on all columns leads to such)
//We also don't allow indexes on functional columns.
return 0;
return nullptr;
}
return alloc(join_project_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2,
removed_col_cnt, removed_cols);
@ -905,7 +905,7 @@ namespace datalog {
|| (delta && delta->get_kind()!=get_kind())
|| tgt.get_signature()!=src.get_signature()
|| (delta && delta->get_signature()!=tgt.get_signature())) {
return 0;
return nullptr;
}
return alloc(union_fn);
}
@ -969,7 +969,7 @@ namespace datalog {
table_transformer_fn * sparse_table_plugin::mk_project_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
if (col_cnt == t.get_signature().size()) {
return 0;
return nullptr;
}
return alloc(project_fn, t.get_signature(), col_cnt, removed_cols);
}
@ -1032,7 +1032,7 @@ namespace datalog {
//column table produces one).
//We also don't allow indexes on functional columns. And our implementation of
//select_equal_and_project uses index on \c col.
return 0;
return nullptr;
}
return alloc(select_equal_and_project_fn, t.get_signature(), value, col);
}
@ -1113,7 +1113,7 @@ namespace datalog {
table_transformer_fn * sparse_table_plugin::mk_rename_fn(const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) {
if (t.get_kind()!=get_kind()) {
return 0;
return nullptr;
}
return alloc(rename_fn, t.get_signature(), permutation_cycle_len, permutation_cycle);
}
@ -1252,7 +1252,7 @@ namespace datalog {
if (!check_kind(t) || !check_kind(negated_obj)
|| join_involves_functional(t.get_signature(), negated_obj.get_signature(), joined_col_cnt,
t_cols, negated_cols) ) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, t, negated_obj, joined_col_cnt, t_cols, negated_cols);
}
@ -1394,7 +1394,7 @@ namespace datalog {
return alloc(negated_join_fn, src1, t_cols, src_cols, src1_cols, src2_cols);
}
else {
return 0;
return nullptr;
}
}

View file

@ -89,7 +89,7 @@ namespace datalog {
table_join_fn * hashtable_table_plugin::mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if(t1.get_kind()!=get_kind() || t2.get_kind()!=get_kind()) {
return 0;
return nullptr;
}
return alloc(join_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2);
}

View file

@ -48,7 +48,7 @@ namespace datalog {
relation_base * table_relation_plugin::mk_empty(const relation_signature & s) {
table_signature tsig;
if (!get_manager().relation_signature_to_table(s, tsig)) {
return 0;
return nullptr;
}
table_base * t = m_table_plugin.mk_empty(tsig);
return alloc(table_relation, *this, s, t);
@ -57,7 +57,7 @@ namespace datalog {
relation_base * table_relation_plugin::mk_full_relation(const relation_signature & s, func_decl* p, family_id kind) {
table_signature tsig;
if(!get_manager().relation_signature_to_table(s, tsig)) {
return 0;
return nullptr;
}
table_base * t = m_table_plugin.mk_full(p, tsig, kind);
return alloc(table_relation, *this, s, t);
@ -108,25 +108,25 @@ namespace datalog {
relation_join_fn * table_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if(!r1.from_table() || !r2.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr1 = static_cast<const table_relation &>(r1);
const table_relation & tr2 = static_cast<const table_relation &>(r2);
table_join_fn * tfun = get_manager().mk_join_fn(tr1.get_table(), tr2.get_table(), col_cnt, cols1, cols2);
if(!tfun) {
return 0;
return nullptr;
}
return alloc(tr_join_project_fn, r1.get_signature(), r2.get_signature(), col_cnt, cols1,
cols2, 0, static_cast<const unsigned *>(0), tfun);
cols2, 0, static_cast<const unsigned *>(nullptr), tfun);
}
relation_join_fn * table_relation_plugin::mk_join_project_fn(const relation_base & r1,
const relation_base & r2, unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) {
if(!r1.from_table() || !r2.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr1 = static_cast<const table_relation &>(r1);
const table_relation & tr2 = static_cast<const table_relation &>(r2);
@ -168,7 +168,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -184,7 +184,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -200,7 +200,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_permutation_rename_fn(const relation_base & t,
const unsigned * permutation) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -216,7 +216,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_select_equal_and_project_fn(const relation_base & t,
const relation_element & value, unsigned col) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -280,7 +280,7 @@ namespace datalog {
const table_relation & tr_src = static_cast<const table_relation &>(src);
table_relation * tr_delta = static_cast<table_relation *>(delta);
(*m_tfun)(tr_tgt.get_table(), tr_src.get_table(), tr_delta ? &tr_delta->get_table() : 0);
(*m_tfun)(tr_tgt.get_table(), tr_src.get_table(), tr_delta ? &tr_delta->get_table() : nullptr);
TRACE("dl_table_relation", tout << "# union => "; tr_tgt.get_table().display(tout););
}
@ -289,7 +289,7 @@ namespace datalog {
relation_union_fn * table_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if(!src.from_table()) {
return 0;
return nullptr;
}
if(!tgt.from_table() || (delta && !delta->from_table())) {
return alloc(universal_target_union_fn);
@ -299,7 +299,7 @@ namespace datalog {
const table_relation * tr_delta = static_cast<const table_relation *>(delta);
table_union_fn * tfun = get_manager().mk_union_fn(tr_tgt.get_table(), tr_src.get_table(),
tr_delta ? &tr_delta->get_table() : 0);
tr_delta ? &tr_delta->get_table() : nullptr);
SASSERT(tfun);
return alloc(tr_union_fn, tfun);
@ -322,7 +322,7 @@ namespace datalog {
relation_mutator_fn * table_relation_plugin::mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -334,7 +334,7 @@ namespace datalog {
relation_mutator_fn * table_relation_plugin::mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -349,7 +349,7 @@ namespace datalog {
relation_mutator_fn * table_relation_plugin::mk_filter_interpreted_fn(const relation_base & t, app * condition) {
bool condition_needs_transforming = false;
if(!t.from_table() || condition_needs_transforming) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
table_mutator_fn * tfun = get_manager().mk_filter_interpreted_fn(tr.get_table(), condition);
@ -360,7 +360,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_filter_interpreted_and_project_fn(const relation_base & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols) {
if (!t.from_table())
return 0;
return nullptr;
const table_relation & tr = static_cast<const table_relation &>(t);
table_transformer_fn * tfun = get_manager().mk_filter_interpreted_and_project_fn(tr.get_table(),
@ -392,14 +392,14 @@ namespace datalog {
relation_intersection_filter_fn * table_relation_plugin::mk_filter_by_intersection_fn(const relation_base & r,
const relation_base & src, unsigned joined_col_cnt, const unsigned * r_cols, const unsigned * src_cols) {
if(!r.from_table() || !src.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(r);
const table_relation & tr_neg = static_cast<const table_relation &>(src);
table_intersection_filter_fn * tfun = get_manager().mk_filter_by_intersection_fn(tr.get_table(),
tr_neg.get_table(), joined_col_cnt, r_cols, src_cols);
if(!tfun) {
return 0;
return nullptr;
}
return alloc(tr_intersection_filter_fn, tfun);
@ -410,7 +410,7 @@ namespace datalog {
const relation_base & negated_rel, unsigned joined_col_cnt,
const unsigned * r_cols, const unsigned * negated_cols) {
if(!r.from_table() || !negated_rel.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(r);
const table_relation & tr_neg = static_cast<const table_relation &>(negated_rel);

View file

@ -447,7 +447,7 @@ doc* doc_manager::join(const doc& d1, const doc& d2, doc_manager& dm1,
}
else if (v1 != v2) {
// columns don't match
return 0;
return nullptr;
}
SASSERT(well_formed(*d));
}

View file

@ -373,7 +373,7 @@ class doc_ref {
doc_manager& dm;
doc* d;
public:
doc_ref(doc_manager& dm):dm(dm),d(0) {}
doc_ref(doc_manager& dm):dm(dm),d(nullptr) {}
doc_ref(doc_manager& dm, doc* d):dm(dm),d(d) {}
~doc_ref() {
if (d) dm.deallocate(d);
@ -385,8 +385,8 @@ public:
}
doc& operator*() { return *d; }
doc* operator->() { return d; }
doc* detach() { doc* r = d; d = 0; return r; }
operator bool() const { return d != 0; }
doc* detach() { doc* r = d; d = nullptr; return r; }
operator bool() const { return d != nullptr; }
};
#endif /* DOC_H_ */

View file

@ -90,7 +90,7 @@ namespace datalog {
karr_relation * complement(func_decl*) const override {
UNREACHABLE();
return 0;
return nullptr;
}
void to_formula(expr_ref& fml) const override {
@ -111,8 +111,8 @@ namespace datalog {
void filter_interpreted(app* cond) {
rational one(1), mone(-1);
expr* e1 = 0, *e2 = 0, *en = 0;
var* v = 0, *w = 0;
expr* e1 = nullptr, *e2 = nullptr, *en = nullptr;
var* v = nullptr, *w = nullptr;
rational n1, n2;
expr_ref_vector conjs(m);
flatten_and(cond, conjs);
@ -500,7 +500,7 @@ namespace datalog {
}
relation_base * karr_relation_plugin::mk_empty(const relation_signature & s) {
return alloc(karr_relation, *this, 0, s, true);
return alloc(karr_relation, *this, nullptr, s, true);
}
relation_base * karr_relation_plugin::mk_full(func_decl* p, const relation_signature & s) {
@ -518,7 +518,7 @@ namespace datalog {
karr_relation const& r1 = get(_r1);
karr_relation const& r2 = get(_r2);
karr_relation_plugin& p = r1.get_plugin();
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(0, get_result_signature()));
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr());
return result;
}
@ -528,7 +528,7 @@ namespace datalog {
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2);
}
@ -543,7 +543,7 @@ namespace datalog {
relation_base * operator()(const relation_base & _r) override {
karr_relation const& r = get(_r);
karr_relation_plugin& p = r.get_plugin();
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(0, get_result_signature()));
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr());
return result;
}
@ -562,7 +562,7 @@ namespace datalog {
relation_base * operator()(const relation_base & _r) override {
karr_relation const& r = get(_r);
karr_relation_plugin& p = r.get_plugin();
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(0, get_result_signature()));
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr());
return result;
}
@ -571,7 +571,7 @@ namespace datalog {
relation_transformer_fn * karr_relation_plugin::mk_rename_fn(const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
if (!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(rename_fn, *this, r.get_signature(), cycle_len, permutation_cycle);
}
@ -687,7 +687,7 @@ namespace datalog {
r.mk_union(src, &d);
}
else {
r.mk_union(src, 0);
r.mk_union(src, nullptr);
}
TRACE("dl", r.display(tout << "result:\n"););
}
@ -696,7 +696,7 @@ namespace datalog {
relation_union_fn * karr_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn);
}
@ -730,7 +730,7 @@ namespace datalog {
relation_mutator_fn * karr_relation_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
if(!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
@ -768,7 +768,7 @@ namespace datalog {
if (check_kind(r)) {
return alloc(filter_equal_fn, get_manager(), value, col);
}
return 0;
return nullptr;
}
@ -789,6 +789,6 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_fn, get(t), condition);
}
return 0;
return nullptr;
}
};

View file

@ -96,7 +96,7 @@ namespace datalog {
m(ctx.get_manager()),
m_rmanager(ctx),
m_answer(m),
m_last_result_relation(0),
m_last_result_relation(nullptr),
m_ectx(ctx),
m_sw(0) {
@ -121,7 +121,7 @@ namespace datalog {
rel_context::~rel_context() {
if (m_last_result_relation) {
m_last_result_relation->deallocate();
m_last_result_relation = 0;
m_last_result_relation = nullptr;
}
}

View file

@ -130,7 +130,7 @@ class tbv_ref {
tbv_manager& mgr;
tbv* d;
public:
tbv_ref(tbv_manager& mgr):mgr(mgr),d(0) {}
tbv_ref(tbv_manager& mgr):mgr(mgr),d(nullptr) {}
tbv_ref(tbv_manager& mgr, tbv* d):mgr(mgr),d(d) {}
~tbv_ref() {
if (d) mgr.deallocate(d);
@ -143,7 +143,7 @@ public:
tbv& operator*() { return *d; }
tbv* operator->() { return d; }
tbv* get() { return d; }
tbv* detach() { tbv* result = d; d = 0; return result; }
tbv* detach() { tbv* result = d; d = nullptr; return result; }
};

View file

@ -203,7 +203,7 @@ namespace datalog {
return dynamic_cast<udoc_relation&>(r);
}
udoc_relation* udoc_plugin::get(relation_base* r) {
return r?dynamic_cast<udoc_relation*>(r):0;
return r?dynamic_cast<udoc_relation*>(r):nullptr;
}
udoc_relation const & udoc_plugin::get(relation_base const& r) {
return dynamic_cast<udoc_relation const&>(r);
@ -351,7 +351,7 @@ namespace datalog {
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, get(t1), get(t2), col_cnt, cols1, cols2);
}
@ -394,7 +394,7 @@ namespace datalog {
const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
if (!check_kind(t))
return 0;
return nullptr;
return alloc(project_fn, get(t), col_cnt, removed_cols);
}
@ -487,7 +487,7 @@ namespace datalog {
return alloc(rename_fn, get(r), cycle_len, permutation_cycle);
}
else {
return 0;
return nullptr;
}
}
class udoc_plugin::union_fn : public relation_union_fn {
@ -500,7 +500,7 @@ namespace datalog {
udoc_relation const& src = get(_src);
udoc_relation* d = get(_delta);
doc_manager& dm = r.get_dm();
udoc* d1 = 0;
udoc* d1 = nullptr;
if (d) d1 = &d->get_udoc();
IF_VERBOSE(3, r.display(verbose_stream() << "orig: "););
r.get_plugin().mk_union(dm, r.get_udoc(), src.get_udoc(), d1);
@ -539,7 +539,7 @@ namespace datalog {
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn);
}
@ -585,7 +585,7 @@ namespace datalog {
};
relation_mutator_fn * udoc_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
return check_kind(t)?alloc(filter_identical_fn, t, col_cnt, identical_cols):0;
return check_kind(t)?alloc(filter_identical_fn, t, col_cnt, identical_cols):nullptr;
}
class udoc_plugin::filter_equal_fn : public relation_mutator_fn {
doc_manager& dm;
@ -614,7 +614,7 @@ namespace datalog {
relation_mutator_fn * udoc_plugin::mk_filter_equal_fn(
const relation_base & t, const relation_element & value, unsigned col) {
if (!check_kind(t))
return 0;
return nullptr;
return alloc(filter_equal_fn, *this, get(t), value, col);
}
@ -951,7 +951,7 @@ namespace datalog {
}
};
relation_mutator_fn * udoc_plugin::mk_filter_interpreted_fn(const relation_base & t, app * condition) {
return check_kind(t)?alloc(filter_interpreted_fn, get(t), get_ast_manager(), condition):0;
return check_kind(t)?alloc(filter_interpreted_fn, get(t), get_ast_manager(), condition):nullptr;
}
class udoc_plugin::join_project_fn : public convenient_relation_join_project_fn {
@ -1055,7 +1055,7 @@ namespace datalog {
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) {
if (!check_kind(t1) || !check_kind(t2))
return 0;
return nullptr;
// special case where we have h(X) :- f(X), g(X).
if (joined_col_cnt == removed_col_cnt &&
t1.get_signature().size() == joined_col_cnt &&
@ -1183,7 +1183,7 @@ namespace datalog {
const relation_base& neg, unsigned joined_col_cnt, const unsigned *t_cols,
const unsigned *negated_cols) {
if (!check_kind(t) || !check_kind(neg))
return 0;
return nullptr;
return alloc(negation_filter_fn, get(t), get(neg), joined_col_cnt, t_cols, negated_cols);
}
@ -1250,7 +1250,7 @@ namespace datalog {
relation_transformer_fn * udoc_plugin::mk_filter_interpreted_and_project_fn(
const relation_base & t, app * condition,
unsigned removed_col_cnt, const unsigned * removed_cols) {
return check_kind(t)?alloc(filter_proj_fn, get(t), get_ast_manager(), condition, removed_col_cnt, removed_cols):0;
return check_kind(t)?alloc(filter_proj_fn, get(t), get_ast_manager(), condition, removed_col_cnt, removed_cols):nullptr;
}

View file

@ -63,7 +63,7 @@ namespace datalog {
unsigned get_num_cols() const { return m_column_info.size()-1; }
unsigned column_idx(unsigned col) const { return m_column_info[col]; }
unsigned column_num_bits(unsigned col) const { return m_column_info[col+1] - m_column_info[col]; }
void expand_column_vector(unsigned_vector& v, const udoc_relation* other = 0) const;
void expand_column_vector(unsigned_vector& v, const udoc_relation* other = nullptr) const;
void extract_guard(expr* condition, expr_ref& guard, expr_ref& rest) const;
bool is_guard(expr* g) const;
bool is_guard(unsigned n, expr* const *g) const;