Skip to content

Commit 50e0fd3

Browse files
Use noexcept more. (#7058)
1 parent b44ab2f commit 50e0fd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+97
-112
lines changed

src/ast/recfun_decl_plugin.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -602,15 +602,6 @@ namespace recfun {
602602
m_args.append(n->get_num_args(), n->get_args());
603603
}
604604

605-
case_expansion::case_expansion(case_expansion const & from)
606-
: m_lhs(from.m_lhs),
607-
m_def(from.m_def),
608-
m_args(from.m_args) {}
609-
case_expansion::case_expansion(case_expansion && from)
610-
: m_lhs(from.m_lhs),
611-
m_def(from.m_def),
612-
m_args(std::move(from.m_args)) {}
613-
614605
std::ostream& case_expansion::display(std::ostream & out) const {
615606
return out << "case_exp(" << m_lhs << ")";
616607
}

src/ast/recfun_decl_plugin.h

-6
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ namespace recfun {
301301
recfun::def * m_def;
302302
expr_ref_vector m_args;
303303
case_expansion(recfun::util& u, app * n);
304-
case_expansion(case_expansion const & from);
305-
case_expansion(case_expansion && from);
306304
std::ostream& display(std::ostream& out) const;
307305
};
308306

@@ -323,10 +321,6 @@ namespace recfun {
323321
}
324322
body_expansion(app_ref & pred, recfun::case_def const & d, expr_ref_vector & args) :
325323
m_pred(pred), m_cdef(&d), m_args(args) {}
326-
body_expansion(body_expansion const & from):
327-
m_pred(from.m_pred), m_cdef(from.m_cdef), m_args(from.m_args) {}
328-
body_expansion(body_expansion && from) noexcept :
329-
m_pred(from.m_pred), m_cdef(from.m_cdef), m_args(std::move(from.m_args)) {}
330324

331325
std::ostream& display(std::ostream& out) const;
332326
};

src/math/dd/dd_pdd.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ namespace dd {
503503
unsigned max_pow2_divisor() const { return m->max_pow2_divisor(root); }
504504
unsigned_vector const& free_vars() const { return m->free_vars(*this); }
505505

506-
void swap(pdd& other) { VERIFY_EQ(m, other.m); std::swap(root, other.root); }
506+
void swap(pdd& other) noexcept { VERIFY_EQ(m, other.m); std::swap(root, other.root); }
507507

508508
pdd_iterator begin() const;
509509
pdd_iterator end() const;
@@ -547,7 +547,7 @@ namespace dd {
547547
inline pdd& operator-=(pdd & p, rational const& q) { p = p - q; return p; }
548548
inline pdd& operator+=(pdd & p, rational const& q) { p = p + q; return p; }
549549

550-
inline void swap(pdd& p, pdd& q) { p.swap(q); }
550+
inline void swap(pdd& p, pdd& q) noexcept { p.swap(q); }
551551

552552
std::ostream& operator<<(std::ostream& out, pdd const& b);
553553

src/math/lp/lp_core_solver_base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ class lp_core_solver_base {
517517

518518

519519
template <typename K>
520-
static void swap(vector<K> &v, unsigned i, unsigned j) {
520+
static void swap(vector<K> &v, unsigned i, unsigned j) noexcept {
521521
auto t = v[i];
522522
v[i] = v[j];
523523
v[j] = t;

src/math/polynomial/algebraic_numbers.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ namespace algebraic_numbers {
358358
return a.to_algebraic()->m_p_sz - 1;
359359
}
360360

361-
void swap(numeral & a, numeral & b) {
361+
void swap(numeral & a, numeral & b) noexcept {
362362
std::swap(a.m_cell, b.m_cell);
363363
}
364364

@@ -2935,7 +2935,7 @@ namespace algebraic_numbers {
29352935
return m_imp->to_rational(const_cast<numeral&>(a), r);
29362936
}
29372937

2938-
void manager::swap(numeral & a, numeral & b) {
2938+
void manager::swap(numeral & a, numeral & b) noexcept {
29392939
return m_imp->swap(a, b);
29402940
}
29412941

src/math/polynomial/algebraic_numbers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace algebraic_numbers {
129129
void set(numeral & a, mpq const & n);
130130
void set(numeral & a, numeral const & n);
131131

132-
void swap(numeral & a, numeral & b);
132+
void swap(numeral & a, numeral & b) noexcept;
133133

134134
/**
135135
\brief Store in b an integer value smaller than 'a'.

src/math/polynomial/polynomial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ namespace polynomial {
447447
}
448448
};
449449

450-
inline void swap(monomial * & m1, monomial * & m2) { std::swap(m1, m2); }
450+
inline void swap(monomial * & m1, monomial * & m2) noexcept { std::swap(m1, m2); }
451451

452452
typedef chashtable<monomial*, monomial::hash_proc, monomial::eq_proc> monomial_table;
453453

src/math/polynomial/upolynomial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace upolynomial {
126126
m_factors[i].swap(p);
127127
}
128128

129-
void core_manager::factors::swap(factors & other) {
129+
void core_manager::factors::swap(factors & other) noexcept {
130130
m_factors.swap(other.m_factors);
131131
m_degrees.swap(other.m_degrees);
132132
nm().swap(m_constant, other.m_constant);

src/math/polynomial/upolynomial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace upolynomial {
8989
void push_back_swap(numeral_vector & p, unsigned degree);
9090

9191
void swap_factor(unsigned i, numeral_vector & p);
92-
void swap(factors & other);
92+
void swap(factors & other) noexcept;
9393
void multiply(numeral_vector & out) const;
9494

9595
void display(std::ostream & out) const;

src/math/polynomial/upolynomial_factorization_int.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace upolynomial {
8585

8686
unsigned max_degree() const { return m_set.size() - 1; }
8787

88-
void swap(factorization_degree_set & other) {
88+
void swap(factorization_degree_set & other) noexcept {
8989
m_set.swap(other.m_set);
9090
}
9191

src/math/realclosure/mpz_matrix.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class mpz_matrix {
5050
SASSERT(j < n);
5151
return a_ij[i*n + j]; }
5252
mpz & operator()(unsigned i, unsigned j) { SASSERT(i < m); SASSERT(j < n); return a_ij[i*n + j]; }
53-
void swap(mpz_matrix & B) { std::swap(m, B.m); std::swap(n, B.n); std::swap(a_ij, B.a_ij); }
53+
void swap(mpz_matrix & B) noexcept { std::swap(m, B.m); std::swap(n, B.n); std::swap(a_ij, B.a_ij); }
5454
mpz * row(unsigned i) const { SASSERT(i < m); return a_ij + i*n; }
5555
};
5656

@@ -136,7 +136,7 @@ class scoped_mpz_matrix {
136136
mpz_matrix const & get() const { return A; }
137137
mpz_matrix & get() { return A; }
138138

139-
void swap(mpz_matrix & B) { A.swap(B); }
139+
void swap(mpz_matrix & B) noexcept { A.swap(B); }
140140

141141
void set(unsigned i, unsigned j, mpz const & v) { nm().set(A(i, j), v); }
142142
void set(unsigned i, unsigned j, int v) { nm().set(A(i, j), v); }

src/math/realclosure/realclosure.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ namespace realclosure {
135135
typedef interval_manager<mpbq_config> mpbqi_manager;
136136
typedef mpbqi_manager::interval mpbqi;
137137

138-
void swap(mpbqi & a, mpbqi & b) {
138+
void swap(mpbqi & a, mpbqi & b) noexcept {
139139
swap(a.m_lower, b.m_lower);
140140
swap(a.m_upper, b.m_upper);
141141
std::swap(a.m_lower_inf, b.m_lower_inf);
@@ -2534,7 +2534,7 @@ namespace realclosure {
25342534
return depends_on_infinitesimals(a.m_value);
25352535
}
25362536

2537-
static void swap(mpbqi & a, mpbqi & b) {
2537+
static void swap(mpbqi & a, mpbqi & b) noexcept {
25382538
realclosure::swap(a, b);
25392539
}
25402540

@@ -6313,7 +6313,7 @@ namespace realclosure {
63136313
m_imp->set(a, n);
63146314
}
63156315

6316-
void manager::swap(numeral & a, numeral & b) {
6316+
void manager::swap(numeral & a, numeral & b) noexcept {
63176317
std::swap(a.m_value, b.m_value);
63186318
}
63196319

src/math/realclosure/realclosure.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace realclosure {
164164
void set(numeral & a, mpq const & n);
165165
void set(numeral & a, numeral const & n);
166166

167-
void swap(numeral & a, numeral & b);
167+
void swap(numeral & a, numeral & b) noexcept;
168168

169169
/**
170170
\brief Return a^{1/k}

src/muz/rel/dl_base.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ namespace datalog {
484484

485485
virtual bool can_swap(const base_object & o) const { return false; }
486486

487-
virtual void swap(base_object & o) {
487+
virtual void swap(base_object & o) noexcept {
488488
std::swap(m_kind, o.m_kind);
489489
#if DL_LEAK_HUNTING
490490
m_leak_guard = get_plugin().get_ast_manager().mk_fresh_sort(get_plugin().get_name().bare_str());
@@ -910,7 +910,7 @@ namespace datalog {
910910
public:
911911
table_signature() : m_functional_columns(0) {}
912912

913-
void swap(table_signature & s) {
913+
void swap(table_signature & s) noexcept {
914914
signature_base::swap(s);
915915
std::swap(m_functional_columns, s.m_functional_columns);
916916
}

src/muz/rel/dl_finite_product_relation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ namespace datalog {
18351835
}
18361836
}
18371837

1838-
void finite_product_relation::swap(relation_base & r0) {
1838+
void finite_product_relation::swap(relation_base & r0) noexcept {
18391839
SASSERT(can_swap(r0));
18401840
finite_product_relation & r = finite_product_relation_plugin::get(r0);
18411841
SASSERT(get_signature()==r.get_signature());

src/muz/rel/dl_finite_product_relation.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ namespace datalog {
316316

317317
Both relations must come from the same plugin and be of the same signature.
318318
*/
319-
void swap(relation_base & r) override;
319+
void swap(relation_base & r) noexcept override;
320320

321321
/**
322322
\brief Create a \c finite_product_relation object.

src/muz/rel/dl_vector_relation.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace datalog {
5959
dealloc(m_elems);
6060
}
6161

62-
void swap(relation_base& other) override {
62+
void swap(relation_base& other) noexcept override {
6363
vector_relation& o = dynamic_cast<vector_relation&>(other);
6464
if (&o == this) return;
6565
std::swap(o.m_eqs, m_eqs);

src/nlsat/nlsat_assignment.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace nlsat {
3333
public:
3434
assignment(anum_manager & _m):m_values(_m) {}
3535
anum_manager & am() const { return m_values.m(); }
36-
void swap(assignment & other) {
36+
void swap(assignment & other) noexcept {
3737
m_values.swap(other.m_values);
3838
m_assigned.swap(other.m_assigned);
3939
}
@@ -67,7 +67,7 @@ namespace nlsat {
6767
anum_manager & m() const override { return am(); }
6868
bool contains(var x) const override { return is_assigned(x); }
6969
anum const & operator()(var x) const override { SASSERT(is_assigned(x)); return value(x); }
70-
void swap(var x, var y) {
70+
void swap(var x, var y) noexcept {
7171
SASSERT(x < m_values.size() && y < m_values.size());
7272
std::swap(m_assigned[x], m_assigned[y]);
7373
std::swap(m_values[x], m_values[y]);

src/nlsat/nlsat_scoped_literal_vector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ namespace nlsat {
6767
void append(scoped_literal_vector const& ls) {
6868
append(ls.size(), ls.data());
6969
}
70-
void swap(scoped_literal_vector& other) {
70+
void swap(scoped_literal_vector& other) noexcept {
7171
SASSERT(&m_solver == &other.m_solver);
7272
m_lits.swap(other.m_lits);
7373
}

src/nlsat/nlsat_solver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace nlsat {
4848
typedef chashtable<root_atom*, root_atom::hash_proc, root_atom::eq_proc> root_atom_table;
4949

5050
// for apply_permutation procedure
51-
void swap(clause * & c1, clause * & c2) {
51+
void swap(clause * & c1, clause * & c2) noexcept {
5252
std::swap(c1, c2);
5353
}
5454

src/sat/sat_cutset.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ namespace sat {
183183
void reset(on_update_t& on_del) { shrink(on_del, 0); }
184184
cut const & operator[](unsigned idx) const { return m_cuts[idx]; }
185185
void shrink(on_update_t& on_del, unsigned j);
186-
void swap(cut_set& other) {
186+
void swap(cut_set& other) noexcept {
187187
std::swap(m_var, other.m_var);
188188
std::swap(m_size, other.m_size);
189189
std::swap(m_max_size, other.m_max_size);

src/sat/sat_model_converter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ namespace sat {
369369
return result;
370370
}
371371

372-
void model_converter::swap(bool_var v, unsigned sz, literal_vector& clause) {
372+
void model_converter::swap(bool_var v, unsigned sz, literal_vector& clause) noexcept {
373373
for (unsigned j = 0; j < sz; ++j) {
374374
if (v == clause[j].var()) {
375375
std::swap(clause[0], clause[j]);

src/sat/sat_model_converter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace sat {
9191

9292
bool legal_to_flip(bool_var v) const;
9393

94-
void swap(bool_var v, unsigned sz, literal_vector& clause);
94+
void swap(bool_var v, unsigned sz, literal_vector& clause) noexcept;
9595

9696
void add_elim_stack(entry & e);
9797

src/sat/smt/pb_card.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace pb {
3333
literal const* begin() const { return m_lits; }
3434
literal const* end() const { return static_cast<literal const*>(m_lits) + m_size; }
3535
void negate() override;
36-
void swap(unsigned i, unsigned j) override { std::swap(m_lits[i], m_lits[j]); }
36+
void swap(unsigned i, unsigned j) noexcept override { std::swap(m_lits[i], m_lits[j]); }
3737
literal_vector literals() const override { return literal_vector(m_size, m_lits); }
3838
bool is_watching(literal l) const override;
3939
literal get_lit(unsigned i) const override { return m_lits[i]; }

src/sat/smt/pb_constraint.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace pb {
102102

103103
virtual bool is_watching(literal l) const { UNREACHABLE(); return false; };
104104
virtual literal_vector literals() const { UNREACHABLE(); return literal_vector(); }
105-
virtual void swap(unsigned i, unsigned j) { UNREACHABLE(); }
105+
virtual void swap(unsigned i, unsigned j) noexcept { UNREACHABLE(); }
106106
virtual literal get_lit(unsigned i) const { UNREACHABLE(); return sat::null_literal; }
107107
virtual void set_lit(unsigned i, literal l) { UNREACHABLE(); }
108108
virtual void negate() { UNREACHABLE(); }

src/sat/smt/pb_pb.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace pb {
4646
bool is_cardinality() const;
4747
void negate() override;
4848
void set_k(unsigned k) override { m_k = k; VERIFY(k < 4000000000); update_max_sum(); }
49-
void swap(unsigned i, unsigned j) override { std::swap(m_wlits[i], m_wlits[j]); }
49+
void swap(unsigned i, unsigned j) noexcept override { std::swap(m_wlits[i], m_wlits[j]); }
5050
literal_vector literals() const override { literal_vector lits; for (auto wl : *this) lits.push_back(wl.second); return lits; }
5151
bool is_watching(literal l) const override;
5252
literal get_lit(unsigned i) const override { return m_wlits[i].second; }

src/smt/old_interval.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ interval & interval::operator=(interval const & other) {
238238
return *this;
239239
}
240240

241-
interval & interval::operator=(interval && other) {
241+
interval & interval::operator=(interval && other) noexcept {
242242
SASSERT(&m_manager == &other.m_manager);
243243
m_lower = std::move(other.m_lower);
244244
m_upper = std::move(other.m_upper);

src/smt/old_interval.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class old_interval {
9292
rational const & get_lower_value() const { SASSERT(!minus_infinity()); return m_lower.to_rational(); }
9393
rational const & get_upper_value() const { SASSERT(!plus_infinity()); return m_upper.to_rational(); }
9494
old_interval & operator=(old_interval const & other);
95-
old_interval & operator=(old_interval && other);
95+
old_interval & operator=(old_interval && other) noexcept;
9696
old_interval & operator+=(old_interval const & other);
9797
old_interval & operator-=(old_interval const & other);
9898
old_interval & operator*=(old_interval const & other);

src/util/array.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class array {
184184
T const * data() const { return m_data; }
185185
T * data() { return m_data; }
186186

187-
void swap(array & other) {
187+
void swap(array & other) noexcept {
188188
std::swap(m_data, other.m_data);
189189
}
190190

src/util/basic_interval.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class basic_interval_manager {
5252
interval const & get() const { return m_interval; }
5353
interval & get() { return m_interval; }
5454
void reset() { m().reset(m_interval); }
55-
void swap(scoped_interval & a) { m().swap(m_interval, a.m_interval); }
56-
void swap(interval & a) { m().swap(m_interval, a); }
55+
void swap(scoped_interval & a) noexcept { m().swap(m_interval, a.m_interval); }
56+
void swap(interval & a) noexcept { m().swap(m_interval, a); }
5757
bound const & lower() const { return m_interval.lower(); }
5858
bound const & upper() const { return m_interval.upper(); }
5959
bound & lower() { return m_interval.lower(); }
@@ -146,7 +146,7 @@ class basic_interval_manager {
146146
m().set(a.m_upper, n);
147147
}
148148

149-
void swap(interval & a, interval & b) {
149+
void swap(interval & a, interval & b) noexcept {
150150
m().swap(a.m_lower, b.m_lower);
151151
m().swap(a.m_upper, b.m_upper);
152152
}

src/util/bit_vector.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class bit_vector {
9898
m_num_bits = 0;
9999
}
100100

101-
void swap(bit_vector & other) {
101+
void swap(bit_vector & other) noexcept {
102102
std::swap(m_data, other.m_data);
103103
std::swap(m_num_bits, other.m_num_bits);
104104
std::swap(m_capacity, other.m_capacity);

src/util/chashtable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class chashtable : private HashProc, private EqProc {
553553
iterator begin() const { return iterator(m_table, m_table + m_slots); }
554554
iterator end() const { return iterator(); }
555555

556-
void swap(chashtable & other) {
556+
void swap(chashtable & other) noexcept {
557557
std::swap(m_table, other.m_table);
558558
std::swap(m_capacity, other.m_capacity);
559559
std::swap(m_init_slots, other.m_init_slots);

src/util/double_manager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class double_manager {
7676
static void set(double & a, unsigned val) { a = static_cast<double>(val); }
7777
static void set(double & a, int64_t val) { a = static_cast<double>(val); }
7878
static void set(double & a, uint64_t val) { a = static_cast<double>(val); }
79-
static void swap(double & a, double & b) { std::swap(a, b); }
79+
static void swap(double & a, double & b) noexcept { std::swap(a, b); }
8080
bool is_pos(double a) const { return a > m_zero_tolerance; }
8181
bool is_neg(double a) const { return a < m_zero_tolerance; }
8282
bool is_zero(double a) const { return -m_zero_tolerance <= a && a <= m_zero_tolerance; }

0 commit comments

Comments
 (0)