3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-11 19:35:43 +00:00

Convert internal class enums to enum class for type safety (#8158)

* Initial plan

* Convert plain enums to enum class in EUF module

- Convert eq_status in euf::ac_plugin to enum class
- Convert undo_kind in euf::ac_plugin to enum class
- Convert undo_t in euf::arith_plugin to enum class
- Convert to_merge_t in euf::egraph to enum class
- Update all usage sites to use scoped enum syntax

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Convert more plain enums to enum class

- Convert state enum in substitution class
- Convert instruction enum in generic_model_converter class
- Convert eq_type enum in bit2int class
- Update all usage sites to use scoped enum syntax

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
Copilot 2026-01-11 17:44:59 -08:00 committed by GitHub
parent 31122b0c10
commit ee037dcafe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 54 additions and 54 deletions

View file

@ -26,7 +26,7 @@ substitution::substitution(ast_manager & m):
m_manager(m),
m_refs(m),
m_new_exprs(m),
m_state(CLEAN) {
m_state(state::CLEAN) {
}
void substitution::reset() {
@ -44,7 +44,7 @@ void substitution::reset_cache() {
m_apply_cache.reset();
m_new_exprs.reset();
m_state = CLEAN;
m_state = state::CLEAN;
}
void substitution::pop_scope(unsigned num_scopes) {
@ -79,10 +79,10 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
// It is incorrect to cache results between different calls if we are applying a substitution
// modulo a substitution s -> t.
if (m_state == INSERT || s != expr_offset(nullptr,0))
if (m_state == state::INSERT || s != expr_offset(nullptr,0))
reset_cache();
m_state = APPLY;
m_state = state::APPLY;
unsigned j;
expr * e = nullptr;

View file

@ -60,7 +60,7 @@ class substitution {
// keep track of how substitution state was last updated.
enum state { CLEAN, APPLY, INSERT };
enum class state { CLEAN, APPLY, INSERT };
state m_state;
#ifdef Z3DEBUG
@ -137,7 +137,7 @@ public:
m_vars.push_back(var_offset(v_idx, offset));
m_refs.push_back(t.get_expr());
m_subst.insert(v_idx, offset, t);
m_state = INSERT;
m_state = state::INSERT;
}
void insert(var * v, unsigned offset, expr_offset const & t) { insert(v->get_idx(), offset, t); }
void insert(expr_offset v, expr_offset const & t) {