3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-13 04:13:01 +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

@ -32,7 +32,7 @@ Notes:
void generic_model_converter::add(func_decl * d, expr* e) {
VERIFY(e);
VERIFY(d->get_range() == e->get_sort());
m_entries.push_back(entry(d, e, m, ADD));
m_entries.push_back(entry(d, e, m, instruction::ADD));
}
void generic_model_converter::operator()(model_ref & md) {
@ -138,9 +138,9 @@ void generic_model_converter::convert_initialize_value(vector<std::pair<expr_ref
auto& [var, value] = var2value[i];
for (auto const& e : m_entries) {
switch (e.m_instruction) {
case HIDE:
case instruction::HIDE:
break;
case ADD:
case instruction::ADD:
if (is_uninterp_const(var) && e.m_f == to_app(var)->get_decl())
convert_initialize_value(e.m_def, i, var2value);
break;
@ -203,14 +203,14 @@ void generic_model_converter::get_units(obj_map<expr, bool>& units) {
for (unsigned i = m_entries.size(); i-- > 0;) {
entry const& e = m_entries[i];
switch (e.m_instruction) {
case HIDE:
case instruction::HIDE:
tmp = m.mk_const(e.m_f);
if (units.contains(tmp)) {
m.dec_ref(tmp);
units.remove(tmp);
}
break;
case ADD:
case instruction::ADD:
if (e.m_f->get_arity() == 0 && m.is_bool(e.m_f->get_range())) {
tmp = m.mk_const(e.m_f);
if (units.contains(tmp)) {

View file

@ -23,7 +23,7 @@ Notes:
class generic_model_converter : public model_converter {
public:
enum instruction { HIDE, ADD };
enum class instruction { HIDE, ADD };
struct entry {
func_decl_ref m_f;
expr_ref m_def;
@ -44,7 +44,7 @@ public:
void hide(expr* e) { SASSERT(is_app(e) && to_app(e)->get_num_args() == 0); hide(to_app(e)->get_decl()); }
void hide(func_decl * f) { m_entries.push_back(entry(f, nullptr, m, HIDE)); }
void hide(func_decl * f) { m_entries.push_back(entry(f, nullptr, m, instruction::HIDE)); }
void add(func_decl * d, expr* e);