3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-20 08:59:34 +00:00

Standardize for-loop increments to prefix form (++i) (#8199)

* Initial plan

* Convert postfix to prefix increment in for loops

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

* Fix member variable increment conversion bug

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

* Update API generator to produce prefix increments

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-14 19:55:31 -08:00 committed by GitHub
parent 1bf463d77a
commit 2436943794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
475 changed files with 3237 additions and 3237 deletions

View file

@ -40,7 +40,7 @@ void substitution::reset() {
void substitution::reset_cache() {
TRACE(subst_bug, tout << "substitution::reset_cache\n";
for (unsigned i = 0; i < m_new_exprs.size(); i++) { tout << mk_pp(m_new_exprs.get(i), m_manager) << "\nref_count: " << m_new_exprs.get(i)->get_ref_count() << "\n"; });
for (unsigned i = 0; i < m_new_exprs.size(); ++i) { tout << mk_pp(m_new_exprs.get(i), m_manager) << "\nref_count: " << m_new_exprs.get(i)->get_ref_count() << "\n"; });
m_apply_cache.reset();
m_new_exprs.reset();
@ -54,7 +54,7 @@ void substitution::pop_scope(unsigned num_scopes) {
unsigned old_sz = m_scopes[new_lvl];
unsigned curr_sz = m_vars.size();
SASSERT(old_sz <= curr_sz);
for (unsigned i = old_sz; i < curr_sz; i++) {
for (unsigned i = old_sz; i < curr_sz; ++i) {
var_offset & curr = m_vars[i];
m_subst.erase(curr.first, curr.second);
}
@ -144,7 +144,7 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
m_todo.pop_back();
new_args.reset();
bool has_new_args = false;
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
expr * arg = to_app(e)->get_arg(i);
expr * new_arg = nullptr;
@ -175,8 +175,8 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
subst.reserve(m_subst.offsets_capacity(), m_subst.vars_capacity() + num_vars);
var_shifter var_sh(m_manager);
expr_offset r;
for (unsigned i = 0; i < m_subst.offsets_capacity(); i++) {
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
for (unsigned i = 0; i < m_subst.offsets_capacity(); ++i) {
for (unsigned j = 0; j < m_subst.vars_capacity(); ++j) {
if (find(j, i, r)) {
var_sh(r.get_expr(), num_vars, er);
subst.insert(j + num_vars, i, expr_offset(er, r.get_offset()));
@ -311,8 +311,8 @@ bool substitution::acyclic() {
void substitution::display(std::ostream & out, unsigned num_actual_offsets, unsigned const * deltas) {
reset_cache();
for (unsigned i = 0; i < num_actual_offsets; i++)
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
for (unsigned i = 0; i < num_actual_offsets; ++i)
for (unsigned j = 0; j < m_subst.vars_capacity(); ++j) {
expr_offset r;
if (find(j, i, r)) {
expr_ref tmp(m_manager);
@ -323,8 +323,8 @@ void substitution::display(std::ostream & out, unsigned num_actual_offsets, unsi
}
void substitution::display(std::ostream & out) {
for (unsigned i = 0; i < m_subst.offsets_capacity(); i++)
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
for (unsigned i = 0; i < m_subst.offsets_capacity(); ++i)
for (unsigned j = 0; j < m_subst.vars_capacity(); ++j) {
expr_offset r;
if (find(j, i, r))
out << "VAR " << j << ":" << i << " --> " << r.get_offset() << "\n" << mk_pp(r.get_expr(), m_manager) << "\n";