3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-17 20:45:45 +00:00
z3/src/util/sat_sls.h
davedets 6ac3075022
Remove unnecessary semicolons (Attempt 2) (#10020)
This is another PR towards the goal of getting Z3 to compile cleanly
when included via FetchContents into clang-tidy, which uses a pretty
strict set of warnings.

This is a second version of https://github.com/Z3Prover/z3/pull/9957. I
address @NikolajBjorner 's comments about not changing the semicolons
after macro invocations, because some editors work better with them
present. It now, to the best of my ability, only deletes semis:

* after the closing brace of namespace decl.
* after the closing brace of an extern "C" decl.
* after a function definition.

This PR is very large, but it consists entirely of deletions of
semicolons in these situations.

(If there was a way to update the previous PR, which had been closed,
and that is preferable, please let me know. I couldn't figure it out.)
2026-07-02 12:47:29 -07:00

41 lines
1.1 KiB
C++

/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
sat_sls.h
Abstract:
Base types for SLS.
Author:
Nikolaj Bjorner (nbjorner) 2024-06027
--*/
#pragma once
#include "util/sat_literal.h"
namespace sat {
struct clause_info {
clause_info(unsigned n, literal const* lits, double init_weight): m_weight(init_weight), m_clause(n, lits) {}
double m_weight; // weight of clause
unsigned m_trues = 0; // set of literals that are true
unsigned m_num_trues = 0; // size of true set
literal_vector m_clause;
literal const* begin() const { return m_clause.begin(); }
literal const* end() const { return m_clause.end(); }
bool is_true() const { return m_num_trues > 0; }
void add(literal lit) { ++m_num_trues; m_trues += lit.index(); }
void del(literal lit) { SASSERT(m_num_trues > 0); --m_num_trues; m_trues -= lit.index(); }
};
inline std::ostream& operator<<(std::ostream& out, clause_info const& ci) {
return out << ci.m_clause << " w: " << ci.m_weight << " nt: " << ci.m_num_trues;
}
}