3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-29 07:13:37 +00:00

Remove redundant default constructors when they're the only constructor (#8461)

* Initial plan

* Modernize C++ constructors to use C++11 default member initialization - Phase 1

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix theory_pb.h struct definition - move reset() back inside struct

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Modernize C++ constructors to use C++11 default member initialization - Phase 2

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix opt_solver.h - revert rational initialization (complex type)

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Modernize C++ constructors to use C++11 default member initialization - Phase 3

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix sparse_matrix.h - explicitly initialize union member in default constructor

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Remove unnecessary default constructors when they're the only constructor

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
This commit is contained in:
Copilot 2026-02-01 16:51:26 -08:00 committed by GitHub
parent 04ec450b02
commit 23c531a4c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 82 additions and 101 deletions

View file

@ -111,13 +111,13 @@ namespace smt {
*/
struct row_entry {
numeral m_coeff;
theory_var m_var;
theory_var m_var = 0;
union {
int m_col_idx;
int m_next_free_row_entry_idx;
};
row_entry():m_var(0), m_col_idx(0) {}
row_entry(): m_col_idx(0) {}
row_entry(numeral const & c, theory_var v): m_coeff(c), m_var(v), m_col_idx(0) {}
bool is_dead() const { return m_var == null_theory_var; }
};
@ -128,14 +128,14 @@ namespace smt {
with the column entry.
*/
struct col_entry {
int m_row_id;
int m_row_id = 0;
union {
int m_row_idx;
int m_next_free_row_entry_idx;
};
col_entry(int r, int i): m_row_id(r), m_row_idx(i) {}
col_entry(): m_row_id(0), m_row_idx(0) {}
col_entry(): m_row_idx(0) {}
bool is_dead() const { return m_row_id == dead_row_id; }
};
@ -189,10 +189,9 @@ namespace smt {
*/
struct column {
svector<col_entry> m_entries;
unsigned m_size;
int m_first_free_idx;
unsigned m_size = 0;
int m_first_free_idx = -1;
column():m_size(0), m_first_free_idx(-1) {}
unsigned size() const { return m_size; }
unsigned num_entries() const { return m_entries.size(); }
void reset();
@ -236,7 +235,7 @@ namespace smt {
vector<numeral> m_lit_coeffs;
vector<numeral> m_eq_coeffs;
vector<parameter> m_params;
bool m_init;
bool m_init = false;
bool empty() const {
return m_eq_coeffs.empty() && m_lit_coeffs.empty();
@ -245,7 +244,6 @@ namespace smt {
void init();
public:
antecedents_t(): m_init(false) {}
void reset();
literal_vector const& lits() const { return m_lits; }
eq_vector const& eqs() const { return m_eqs; }

View file

@ -54,8 +54,7 @@ namespace smt {
};
struct bit_atom : public atom {
var_pos_occ * m_occs;
bit_atom():m_occs(nullptr) {}
var_pos_occ * m_occs = nullptr;
bool is_bit() const override { return true; }
};

View file

@ -244,19 +244,11 @@ namespace smt {
struct var_info {
ineq_watch* m_lit_watch[2];
ineq* m_ineq;
ineq_watch* m_lit_watch[2] = { nullptr, nullptr };
ineq* m_ineq = nullptr;
card_watch* m_lit_cwatch[2];
card* m_card;
var_info(): m_ineq(nullptr), m_card(nullptr)
{
m_lit_watch[0] = nullptr;
m_lit_watch[1] = nullptr;
m_lit_cwatch[0] = nullptr;
m_lit_cwatch[1] = nullptr;
}
card_watch* m_lit_cwatch[2] = { nullptr, nullptr };
card* m_card = nullptr;
void reset() {
dealloc(m_lit_watch[0]);