3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-11 03:14:30 +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

@ -57,12 +57,12 @@ namespace dd {
m_hi(hi),
m_index(0)
{}
bdd_node(): m_refcount(0), m_level(0), m_lo(0), m_hi(0), m_index(0) {}
unsigned m_refcount : 10;
unsigned m_level : 22;
BDD m_lo;
BDD m_hi;
unsigned m_index;
bdd_node() = default;
unsigned m_refcount : 10 = 0;
unsigned m_level : 22 = 0;
BDD m_lo = 0;
BDD m_hi = 0;
unsigned m_index = 0;
unsigned hash() const { return mk_mix(m_level, m_lo, m_hi); }
bool is_internal() const { return m_lo == 0 && m_hi == 0; }
void set_internal() { m_lo = 0; m_hi = 0; }

View file

@ -93,12 +93,12 @@ namespace dd {
m_index(0)
{}
node(): m_refcount(0), m_level(0), m_lo(0), m_hi(0), m_index(0) {}
unsigned m_refcount : 10;
unsigned m_level : 22;
PDD m_lo;
PDD m_hi;
unsigned m_index;
node() = default;
unsigned m_refcount : 10 = 0;
unsigned m_level : 22 = 0;
PDD m_lo = 0;
PDD m_hi = 0;
unsigned m_index = 0;
unsigned hash() const { return mk_mix(m_level, m_lo, m_hi); }
bool is_val() const { return m_hi == 0 && (m_lo != 0 || m_index == 0); }
bool is_internal() const { return m_hi == 0 && m_lo == 0 && m_index != 0; }
@ -160,13 +160,13 @@ namespace dd {
m_rest(UINT_MAX)
{}
factor_entry(): m_p(0), m_v(0), m_degree(0), m_lc(UINT_MAX), m_rest(UINT_MAX) {}
factor_entry() = default;
PDD m_p; // input
unsigned m_v; // input
unsigned m_degree; // input
PDD m_lc; // output
PDD m_rest; // output
PDD m_p = 0; // input
unsigned m_v = 0; // input
unsigned m_degree = 0; // input
PDD m_lc = UINT_MAX; // output
PDD m_rest = UINT_MAX; // output
bool is_valid() { return m_lc != UINT_MAX; }

View file

@ -68,7 +68,7 @@ class var_eqs {
stats() { memset(this, 0, sizeof(*this)); }
};
T* m_merge_handler;
T* m_merge_handler = nullptr;
union_find<var_eqs> m_uf;
lp::incremental_vector<std::pair<signed_var, signed_var>> m_trail;
vector<svector<eq_edge>> m_eqs; // signed_var.index() -> the edges adjacent to signed_var.index()
@ -81,7 +81,7 @@ class var_eqs {
mutable stats m_stats;
public:
var_eqs(): m_merge_handler(nullptr), m_uf(*this) {}
var_eqs(): m_uf(*this) {}
/**
\brief push a scope */
void push() {

View file

@ -74,13 +74,13 @@ namespace simplex {
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_col_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 (unsigned) m_row_id == dead_id; }
};
@ -115,11 +115,10 @@ namespace simplex {
*/
struct column {
svector<col_entry> m_entries;
unsigned m_size;
int m_first_free_idx;
mutable unsigned m_refs;
unsigned m_size = 0;
int m_first_free_idx = -1;
mutable unsigned m_refs = 0;
column():m_size(0), m_first_free_idx(-1), m_refs(0) {}
unsigned size() const { return m_size; }
unsigned num_entries() const { return m_entries.size(); }
void reset();