chore(util/rc): remove unnecessary argument from LEAN_COPY_REF and LEAN_MOVE_REF macros
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
88424ec382
commit
2e5e5e187f
19 changed files with 40 additions and 40 deletions
|
@ -45,9 +45,9 @@ operator_info::operator_info(operator_info && info):m_ptr(info.m_ptr) { info.m_p
|
|||
|
||||
operator_info::~operator_info() { if (m_ptr) m_ptr->dec_ref(); }
|
||||
|
||||
operator_info & operator_info::operator=(operator_info const & s) { LEAN_COPY_REF(operator_info, s); }
|
||||
operator_info & operator_info::operator=(operator_info const & s) { LEAN_COPY_REF(s); }
|
||||
|
||||
operator_info & operator_info::operator=(operator_info && s) { LEAN_MOVE_REF(operator_info, s); }
|
||||
operator_info & operator_info::operator=(operator_info && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
void operator_info::add_expr(expr const & d) { lean_assert(m_ptr); m_ptr->m_exprs = cons(d, m_ptr->m_exprs); }
|
||||
|
||||
|
|
|
@ -120,8 +120,8 @@ public:
|
|||
|
||||
friend void swap(expr & a, expr & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
|
||||
expr & operator=(expr const & s) { LEAN_COPY_REF(expr, s); }
|
||||
expr & operator=(expr && s) { LEAN_MOVE_REF(expr, s); }
|
||||
expr & operator=(expr const & s) { LEAN_COPY_REF(s); }
|
||||
expr & operator=(expr && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
expr_kind kind() const { return m_ptr->kind(); }
|
||||
unsigned hash() const { return m_ptr ? m_ptr->hash() : 23; }
|
||||
|
|
|
@ -67,8 +67,8 @@ public:
|
|||
|
||||
friend void swap(justification & a, justification & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
|
||||
justification & operator=(justification const & s) { LEAN_COPY_REF(justification, s); }
|
||||
justification & operator=(justification && s) { LEAN_MOVE_REF(justification, s); }
|
||||
justification & operator=(justification const & s) { LEAN_COPY_REF(s); }
|
||||
justification & operator=(justification && s) { LEAN_MOVE_REF(s); }
|
||||
format pp(formatter const & fmt, options const & opts, pos_info_provider const * p = nullptr, bool display_children = true) const {
|
||||
lean_assert(m_ptr);
|
||||
return m_ptr->pp(fmt, opts, p, display_children);
|
||||
|
|
|
@ -158,8 +158,8 @@ unsigned lift_offset(level const & l) { lean_assert(is_lift(l)); return sta
|
|||
unsigned max_size (level const & l) { lean_assert(is_max(l)); return static_cast<level_max*>(l.m_ptr)->m_size; }
|
||||
level const & max_level (level const & l, unsigned i) { lean_assert(is_max(l)); return static_cast<level_max*>(l.m_ptr)->m_levels[i]; }
|
||||
|
||||
level & level::operator=(level const & l) { LEAN_COPY_REF(level, l); }
|
||||
level & level::operator=(level&& l) { LEAN_MOVE_REF(level, l); }
|
||||
level & level::operator=(level const & l) { LEAN_COPY_REF(l); }
|
||||
level & level::operator=(level&& l) { LEAN_MOVE_REF(l); }
|
||||
|
||||
bool operator==(level const & l1, level const & l2) {
|
||||
if (kind(l1) != kind(l2)) return false;
|
||||
|
|
|
@ -90,8 +90,8 @@ public:
|
|||
|
||||
friend void swap(object & a, object & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
|
||||
object & operator=(object const & s) { LEAN_COPY_REF(object, s); }
|
||||
object & operator=(object && s) { LEAN_MOVE_REF(object, s); }
|
||||
object & operator=(object const & s) { LEAN_COPY_REF(s); }
|
||||
object & operator=(object && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
object_kind kind() const { return m_ptr->kind(); }
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ public:
|
|||
|
||||
friend void swap(unification_constraint & a, unification_constraint & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
|
||||
unification_constraint & operator=(unification_constraint const & s) { LEAN_COPY_REF(unification_constraint, s); }
|
||||
unification_constraint & operator=(unification_constraint && s) { LEAN_MOVE_REF(unification_constraint, s); }
|
||||
unification_constraint & operator=(unification_constraint const & s) { LEAN_COPY_REF(s); }
|
||||
unification_constraint & operator=(unification_constraint && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
unification_constraint_kind kind() const { return m_ptr->kind(); }
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ public:
|
|||
void release() { if (m_ptr) m_ptr->dec_ref(); m_ptr = nullptr; }
|
||||
friend void swap(rewriter & a, rewriter & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
rewriter_kind kind() const { return m_ptr->kind(); }
|
||||
rewriter & operator=(rewriter const & s) { LEAN_COPY_REF(rewriter, s); }
|
||||
rewriter & operator=(rewriter && s) { LEAN_MOVE_REF(rewriter, s); }
|
||||
rewriter & operator=(rewriter const & s) { LEAN_COPY_REF(s); }
|
||||
rewriter & operator=(rewriter && s) { LEAN_MOVE_REF(s); }
|
||||
std::pair<expr, expr> operator()(environment const & env, context & ctx, expr const & v) const {
|
||||
return (*m_ptr)(env, ctx, v);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ Author: Leonardo de Moura
|
|||
#include "library/tactic/cex_builder.h"
|
||||
|
||||
namespace lean {
|
||||
cex_builder & cex_builder::operator=(cex_builder const & s) { LEAN_COPY_REF(cex_builder, s); }
|
||||
cex_builder & cex_builder::operator=(cex_builder && s) { LEAN_MOVE_REF(cex_builder, s); }
|
||||
cex_builder & cex_builder::operator=(cex_builder const & s) { LEAN_COPY_REF(s); }
|
||||
cex_builder & cex_builder::operator=(cex_builder && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
cex_builder mk_cex_builder_for(name const & gname) {
|
||||
return mk_cex_builder(
|
||||
|
|
|
@ -58,8 +58,8 @@ public:
|
|||
proof_builder(proof_builder && s):m_ptr(s.m_ptr) { s.m_ptr = nullptr; }
|
||||
~proof_builder() { if (m_ptr) m_ptr->dec_ref(); }
|
||||
friend void swap(proof_builder & a, proof_builder & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
proof_builder & operator=(proof_builder const & s) { LEAN_COPY_REF(proof_builder, s); }
|
||||
proof_builder & operator=(proof_builder && s) { LEAN_MOVE_REF(proof_builder, s); }
|
||||
proof_builder & operator=(proof_builder const & s) { LEAN_COPY_REF(s); }
|
||||
proof_builder & operator=(proof_builder && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
expr operator()(proof_map const & p, assignment const & a) const { return m_ptr->operator()(p, a); }
|
||||
};
|
||||
|
|
|
@ -69,8 +69,8 @@ public:
|
|||
m_ptr(new cell(s.get_precision(), gs, s.get_menv(), p, c)) {}
|
||||
~proof_state() { if (m_ptr) m_ptr->dec_ref(); }
|
||||
friend void swap(proof_state & a, proof_state & b) { std::swap(a.m_ptr, b.m_ptr); }
|
||||
proof_state & operator=(proof_state const & s) { LEAN_COPY_REF(proof_state, s); }
|
||||
proof_state & operator=(proof_state && s) { LEAN_MOVE_REF(proof_state, s); }
|
||||
proof_state & operator=(proof_state const & s) { LEAN_COPY_REF(s); }
|
||||
proof_state & operator=(proof_state && s) { LEAN_MOVE_REF(s); }
|
||||
precision get_precision() const { lean_assert(m_ptr); return m_ptr->m_precision; }
|
||||
goals const & get_goals() const { lean_assert(m_ptr); return m_ptr->m_goals; }
|
||||
metavar_env const & get_menv() const { lean_assert(m_ptr); return m_ptr->m_menv; }
|
||||
|
|
|
@ -61,11 +61,11 @@ solve_result & solve_result::operator=(solve_result && other) {
|
|||
}
|
||||
|
||||
tactic & tactic::operator=(tactic const & s) {
|
||||
LEAN_COPY_REF(tactic, s);
|
||||
LEAN_COPY_REF(s);
|
||||
}
|
||||
|
||||
tactic & tactic::operator=(tactic && s) {
|
||||
LEAN_MOVE_REF(tactic, s);
|
||||
LEAN_MOVE_REF(s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,8 +70,8 @@ public:
|
|||
lazy_list(T const & h, lazy_list const & t):m_ptr(new cell_pair(h, t)) { m_ptr->inc_ref(); }
|
||||
~lazy_list() { if (m_ptr) m_ptr->dec_ref(); }
|
||||
|
||||
lazy_list & operator=(lazy_list const & s) { LEAN_COPY_REF(lazy_list, s); }
|
||||
lazy_list & operator=(lazy_list && s) { LEAN_MOVE_REF(lazy_list, s); }
|
||||
lazy_list & operator=(lazy_list const & s) { LEAN_COPY_REF(s); }
|
||||
lazy_list & operator=(lazy_list && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
maybe_pair pull() const {
|
||||
if (m_ptr)
|
||||
|
|
|
@ -64,8 +64,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
list & operator=(list const & s) { LEAN_COPY_REF(list, s); }
|
||||
list & operator=(list && s) { LEAN_MOVE_REF(list, s); }
|
||||
list & operator=(list const & s) { LEAN_COPY_REF(s); }
|
||||
list & operator=(list && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
/**
|
||||
\brief Return internal representation.
|
||||
|
|
|
@ -163,9 +163,9 @@ name name::mk_internal_unique_name() {
|
|||
return name(id);
|
||||
}
|
||||
|
||||
name & name::operator=(name const & other) { LEAN_COPY_REF(name, other); }
|
||||
name & name::operator=(name const & other) { LEAN_COPY_REF(other); }
|
||||
|
||||
name & name::operator=(name && other) { LEAN_MOVE_REF(name, other); }
|
||||
name & name::operator=(name && other) { LEAN_MOVE_REF(other); }
|
||||
|
||||
name_kind name::kind() const {
|
||||
if (m_ptr == nullptr)
|
||||
|
|
|
@ -251,8 +251,8 @@ public:
|
|||
pdeque(pdeque && s):m_ptr(s.m_ptr) { s.m_ptr = nullptr; }
|
||||
~pdeque() { if (m_ptr) m_ptr->dec_ref(); }
|
||||
|
||||
pdeque & operator=(pdeque const & s) { LEAN_COPY_REF(pdeque, s); }
|
||||
pdeque & operator=(pdeque && s) { LEAN_MOVE_REF(pdeque, s); }
|
||||
pdeque & operator=(pdeque const & s) { LEAN_COPY_REF(s); }
|
||||
pdeque & operator=(pdeque && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
/** \brief Return the number of elements */
|
||||
unsigned size() const { return m_ptr->size(); }
|
||||
|
|
|
@ -48,8 +48,8 @@ public:
|
|||
|
||||
void release() { if (m_ptr) m_ptr->dec_ref(); m_ptr = nullptr; }
|
||||
|
||||
monomial & operator=(monomial const & s) { LEAN_COPY_REF(monomial, s); }
|
||||
monomial & operator=(monomial && s) { LEAN_MOVE_REF(monomial, s); }
|
||||
monomial & operator=(monomial const & s) { LEAN_COPY_REF(s); }
|
||||
monomial & operator=(monomial && s) { LEAN_MOVE_REF(s); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
void release() { if (m_ptr) m_ptr->dec_ref(); m_ptr = nullptr; }
|
||||
|
||||
polynomial & operator=(polynomial const & s) { LEAN_COPY_REF(polynomial, s); }
|
||||
polynomial & operator=(polynomial && s) { LEAN_MOVE_REF(polynomial, s); }
|
||||
polynomial & operator=(polynomial const & s) { LEAN_COPY_REF(s); }
|
||||
polynomial & operator=(polynomial && s) { LEAN_MOVE_REF(s); }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ void inc_ref() { atomic_fetch_add_explicit(&m_rc, 1u, memory_order_relaxed); } \
|
|||
bool dec_ref_core() { lean_assert(get_rc() > 0); return atomic_fetch_sub_explicit(&m_rc, 1u, memory_order_relaxed) == 1u; } \
|
||||
void dec_ref() { if (dec_ref_core()) dealloc(); }
|
||||
|
||||
#define LEAN_COPY_REF(T, Arg) \
|
||||
#define LEAN_COPY_REF(Arg) \
|
||||
if (Arg.m_ptr) \
|
||||
Arg.m_ptr->inc_ref(); \
|
||||
auto new_ptr = Arg.m_ptr; \
|
||||
|
@ -28,7 +28,7 @@ void dec_ref() { if (dec_ref_core()) dealloc(); }
|
|||
m_ptr = new_ptr; \
|
||||
return *this;
|
||||
|
||||
#define LEAN_MOVE_REF(T, Arg) \
|
||||
#define LEAN_MOVE_REF(Arg) \
|
||||
if (m_ptr) \
|
||||
m_ptr->dec_ref(); \
|
||||
m_ptr = Arg.m_ptr; \
|
||||
|
|
|
@ -173,8 +173,8 @@ mpq const & sexpr::get_mpq() const { return static_cast<sexpr_mpq*>(m_ptr)->m_va
|
|||
|
||||
unsigned sexpr::hash() const { return m_ptr == nullptr ? 23 : m_ptr->m_hash; }
|
||||
|
||||
sexpr & sexpr::operator=(sexpr const & s) { LEAN_COPY_REF(sexpr, s); }
|
||||
sexpr & sexpr::operator=(sexpr && s) { LEAN_MOVE_REF(sexpr, s); }
|
||||
sexpr & sexpr::operator=(sexpr const & s) { LEAN_COPY_REF(s); }
|
||||
sexpr & sexpr::operator=(sexpr && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
bool is_list(sexpr const & s) {
|
||||
if (is_nil(s))
|
||||
|
|
|
@ -325,9 +325,9 @@ public:
|
|||
~splay_tree() { node::dec_ref(m_ptr); }
|
||||
|
||||
/** \brief O(1) copy */
|
||||
splay_tree & operator=(splay_tree const & s) { LEAN_COPY_REF(splay_tree, s); }
|
||||
splay_tree & operator=(splay_tree const & s) { LEAN_COPY_REF(s); }
|
||||
/** \brief O(1) move */
|
||||
splay_tree & operator=(splay_tree && s) { LEAN_MOVE_REF(splay_tree, s); }
|
||||
splay_tree & operator=(splay_tree && s) { LEAN_MOVE_REF(s); }
|
||||
|
||||
friend void swap(splay_tree & t1, splay_tree & t2) { std::swap(t1.m_ptr, t2.m_ptr); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue