diff --git a/src/frontends/lean/operator_info.cpp b/src/frontends/lean/operator_info.cpp index a70abe88d..4d410ad2a 100644 --- a/src/frontends/lean/operator_info.cpp +++ b/src/frontends/lean/operator_info.cpp @@ -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); } diff --git a/src/kernel/expr.h b/src/kernel/expr.h index 54063b688..5e646b448 100644 --- a/src/kernel/expr.h +++ b/src/kernel/expr.h @@ -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; } diff --git a/src/kernel/justification.h b/src/kernel/justification.h index e59ba7241..30ce4f32a 100644 --- a/src/kernel/justification.h +++ b/src/kernel/justification.h @@ -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); diff --git a/src/kernel/level.cpp b/src/kernel/level.cpp index 1787a298e..0b67b5d11 100644 --- a/src/kernel/level.cpp +++ b/src/kernel/level.cpp @@ -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(l.m_ptr)->m_size; } level const & max_level (level const & l, unsigned i) { lean_assert(is_max(l)); return static_cast(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; diff --git a/src/kernel/object.h b/src/kernel/object.h index 8761ad8d6..be05b7674 100644 --- a/src/kernel/object.h +++ b/src/kernel/object.h @@ -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(); } diff --git a/src/kernel/unification_constraint.h b/src/kernel/unification_constraint.h index 377d98e20..85a9d58e4 100644 --- a/src/kernel/unification_constraint.h +++ b/src/kernel/unification_constraint.h @@ -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(); } diff --git a/src/library/rewriter/rewriter.h b/src/library/rewriter/rewriter.h index 543f786e5..49fe2da9f 100644 --- a/src/library/rewriter/rewriter.h +++ b/src/library/rewriter/rewriter.h @@ -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 operator()(environment const & env, context & ctx, expr const & v) const { return (*m_ptr)(env, ctx, v); } diff --git a/src/library/tactic/cex_builder.cpp b/src/library/tactic/cex_builder.cpp index 163f1454b..27f4dfefd 100644 --- a/src/library/tactic/cex_builder.cpp +++ b/src/library/tactic/cex_builder.cpp @@ -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( diff --git a/src/library/tactic/proof_builder.h b/src/library/tactic/proof_builder.h index a73492380..ddb84e553 100644 --- a/src/library/tactic/proof_builder.h +++ b/src/library/tactic/proof_builder.h @@ -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); } }; diff --git a/src/library/tactic/proof_state.h b/src/library/tactic/proof_state.h index 9bc36d773..f6e1bd0c2 100644 --- a/src/library/tactic/proof_state.h +++ b/src/library/tactic/proof_state.h @@ -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; } diff --git a/src/library/tactic/tactic.cpp b/src/library/tactic/tactic.cpp index e76435a22..8a7f715ac 100644 --- a/src/library/tactic/tactic.cpp +++ b/src/library/tactic/tactic.cpp @@ -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); } /** diff --git a/src/util/lazy_list.h b/src/util/lazy_list.h index f6364528c..d13629e50 100644 --- a/src/util/lazy_list.h +++ b/src/util/lazy_list.h @@ -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) diff --git a/src/util/list.h b/src/util/list.h index 21bdb0a6e..b2ee3c7b6 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -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. diff --git a/src/util/name.cpp b/src/util/name.cpp index 116e49c1a..87addfcb4 100644 --- a/src/util/name.cpp +++ b/src/util/name.cpp @@ -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) diff --git a/src/util/pdeque.h b/src/util/pdeque.h index 50e50d544..d6962130e 100644 --- a/src/util/pdeque.h +++ b/src/util/pdeque.h @@ -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(); } diff --git a/src/util/polynomial/polynomial.h b/src/util/polynomial/polynomial.h index 14a9f7838..27b5cbfb1 100644 --- a/src/util/polynomial/polynomial.h +++ b/src/util/polynomial/polynomial.h @@ -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 @@ -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); } }; } diff --git a/src/util/rc.h b/src/util/rc.h index 608ddb309..634c73769 100644 --- a/src/util/rc.h +++ b/src/util/rc.h @@ -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; \ diff --git a/src/util/sexpr/sexpr.cpp b/src/util/sexpr/sexpr.cpp index 232a6e720..22dd3c0f1 100644 --- a/src/util/sexpr/sexpr.cpp +++ b/src/util/sexpr/sexpr.cpp @@ -173,8 +173,8 @@ mpq const & sexpr::get_mpq() const { return static_cast(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)) diff --git a/src/util/splay_tree.h b/src/util/splay_tree.h index cfc8c07ce..920ec55ed 100644 --- a/src/util/splay_tree.h +++ b/src/util/splay_tree.h @@ -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); }