3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-29 21:38:44 +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

@ -174,7 +174,7 @@ bool func_decls::clash(func_decl * f) const {
continue;
unsigned num = g->get_arity();
unsigned i;
for (i = 0; i < num; i++)
for (i = 0; i < num; ++i)
if (g->get_domain(i) != f->get_domain(i))
break;
if (i == num)
@ -208,7 +208,7 @@ bool func_decls::check_signature(ast_manager& m, func_decl* f, unsigned arity, s
if (!domain)
return true;
coerced = false;
for (unsigned i = 0; i < arity; i++) {
for (unsigned i = 0; i < arity; ++i) {
sort* s1 = f->get_domain(i);
sort* s2 = domain[i];
if (s1 == s2)
@ -232,7 +232,7 @@ bool func_decls::check_poly_signature(ast_manager& m, func_decl* f, unsigned ari
return false;
if (f->get_arity() != arity)
return false;
for (unsigned i = 0; i < arity; i++)
for (unsigned i = 0; i < arity; ++i)
if (!sub.match(f->get_domain(i), domain[i]))
return false;
if (!range)
@ -290,7 +290,7 @@ func_decl * func_decls::find(ast_manager & m, unsigned num_args, expr * const *
if (!more_than_one())
first();
ptr_buffer<sort> sorts;
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
if (!args[i])
return nullptr;
sorts.push_back(args[i]->get_sort());
@ -314,7 +314,7 @@ func_decl * func_decls::get_entry(unsigned inx) {
else {
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
auto b = fs->begin();
for (unsigned i = 0; i < inx; i++)
for (unsigned i = 0; i < inx; ++i)
b++;
return *b;
}
@ -1149,7 +1149,7 @@ func_decl * cmd_context::find_func_decl(symbol const & s, unsigned num_indices,
}
else {
buffer<parameter> ps;
for (unsigned i = 0; i < num_indices; i++)
for (unsigned i = 0; i < num_indices; ++i)
ps.push_back(parameter(indices[i]));
f = m().mk_func_decl(fid, k, num_indices, ps.data(), arity, domain, range);
}
@ -1268,12 +1268,12 @@ bool cmd_context::try_mk_declared_app(symbol const &s, unsigned num_args, expr *
unsigned sz = get_array_arity(s);
if (sz != num_args)
return false;
for (unsigned i = 0; i < sz; i++)
for (unsigned i = 0; i < sz; ++i)
if (args[i]->get_sort() != get_array_domain(s, i))
return false;
expr_ref_vector new_args(m());
new_args.push_back(m().mk_const(f));
for (unsigned i = 0; i < num_args; i++)
for (unsigned i = 0; i < num_args; ++i)
new_args.push_back(args[i]);
result = au.mk_select(new_args.size(), new_args.data());
return true;
@ -1290,7 +1290,7 @@ bool cmd_context::try_mk_macro_app(symbol const & s, unsigned num_args, expr * c
TRACE(macro_bug, tout << "well_sorted_check_enabled(): " << well_sorted_check_enabled() << "\n";
tout << "s: " << s << "\n";
tout << "body:\n" << mk_ismt2_pp(_t, m()) << "\n";
tout << "args:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(args[i]->get_sort(), m()) << "\n";);
tout << "args:\n"; for (unsigned i = 0; i < num_args; ++i) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(args[i]->get_sort(), m()) << "\n";);
scoped_rlimit no_limit(m().limit(), 0);
result = rev_subst()(_t, coerced_args);
if (well_sorted_check_enabled() && !is_well_sorted(m(), result))
@ -1649,7 +1649,7 @@ void cmd_context::push() {
}
void cmd_context::push(unsigned n) {
for (unsigned i = 0; i < n; i++)
for (unsigned i = 0; i < n; ++i)
push();
}
@ -2123,7 +2123,7 @@ void cmd_context::complete_model(model_ref& md) const {
}
}
for (unsigned i = 0; i < md->get_num_functions(); i++) {
for (unsigned i = 0; i < md->get_num_functions(); ++i) {
func_decl * f = md->get_function(i);
func_interp * fi = md->get_func_interp(f);
IF_VERBOSE(12, verbose_stream() << "(model.completion " << f->get_name() << ")\n"; );
@ -2135,7 +2135,7 @@ void cmd_context::complete_model(model_ref& md) const {
for (auto& [k, v] : m_func_decls) {
IF_VERBOSE(12, verbose_stream() << "(model.completion " << k << ")\n"; );
for (unsigned i = 0; i < v.get_num_entries(); i++) {
for (unsigned i = 0; i < v.get_num_entries(); ++i) {
func_decl * f = v.get_entry(i);
if (md->has_interpretation(f))
@ -2338,14 +2338,14 @@ void cmd_context::set_solver_factory(solver_factory * f) {
// assert formulas and create scopes in the new solver.
unsigned lim = 0;
for (scope& s : m_scopes) {
for (unsigned i = lim; i < s.m_assertions_lim; i++) {
for (unsigned i = lim; i < s.m_assertions_lim; ++i) {
m_solver->assert_expr(m_assertions[i]);
}
lim = s.m_assertions_lim;
m_solver->push();
}
unsigned sz = m_assertions.size();
for (unsigned i = lim; i < sz; i++) {
for (unsigned i = lim; i < sz; ++i) {
m_solver->assert_expr(m_assertions[i]);
}
}
@ -2493,7 +2493,7 @@ void cmd_context::display_smt2_benchmark(std::ostream & out, unsigned num, expr
out << "(set-logic " << logic << ")" << std::endl;
// collect uninterpreted function declarations
decl_collector decls(m());
for (unsigned i = 0; i < num; i++)
for (unsigned i = 0; i < num; ++i)
decls.visit(assertions[i]);
// TODO: display uninterpreted sort decls, and datatype decls.
@ -2503,7 +2503,7 @@ void cmd_context::display_smt2_benchmark(std::ostream & out, unsigned num, expr
out << std::endl;
}
for (unsigned i = 0; i < num; i++) {
for (unsigned i = 0; i < num; ++i) {
out << "(assert ";
display(out, assertions[i], 8);
out << ")" << std::endl;