3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-12 10:40:17 +00:00

Centralize and document TRACE tags using X-macros (#7657)

* Introduce X-macro-based trace tag definition
- Created trace_tags.def to centralize TRACE tag definitions
- Each tag includes a symbolic name and description
- Set up enum class TraceTag for type-safe usage in TRACE macros

* Add script to generate Markdown documentation from trace_tags.def
- Python script parses trace_tags.def and outputs trace_tags.md

* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled

* trace: improve trace tag handling system with hierarchical tagging

- Introduce hierarchical tag-class structure: enabling a tag class activates all child tags
- Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag
- Implement initial version of trace_tag.def using X(tag, tag_class, description)
  (class names and descriptions to be refined in a future update)

* trace: replace all string-based TRACE tags with enum TraceTag
- Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals

* trace : add cstring header

* trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py

* trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h.

* trace : Add TODO comment for future implementation of tag_class activation

* trace : Disable code related to tag_class until implementation is ready (#7663).
This commit is contained in:
LeeYoungJoon 2025-05-28 22:31:25 +09:00 committed by GitHub
parent d766292dab
commit 0a93ff515d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
583 changed files with 8698 additions and 7299 deletions

View file

@ -52,7 +52,7 @@ namespace smt {
expr_ref fml(m);
if (lit == true_literal) return;
expr* e = bool_var2expr(lit.var());
TRACE("context", tout << mk_pp(e, m) << "\n";);
TRACE(context, tout << mk_pp(e, m) << "\n";);
index_set s;
if (assumptions.contains(lit.var())) {
s.insert(lit.var());
@ -99,7 +99,7 @@ namespace smt {
void context::justify(literal lit, index_set& s) {
(void)m;
auto add_antecedent = [&](literal l) {
CTRACE("context", !m_antecedents.contains(l.var()),
CTRACE(context, !m_antecedents.contains(l.var()),
tout << "untracked literal: " << l << " "
<< mk_pp(bool_var2expr(l.var()), m) << "\n";);
if (m_antecedents.contains(l.var())) {
@ -167,7 +167,7 @@ namespace smt {
expr* v = kv.m_value;
if (m.is_bool(k)) {
literal lit = get_literal(k);
TRACE("context",
TRACE(context,
tout << "checking " << mk_pp(k, m) << " "
<< mk_pp(v, m) << " " << get_assignment(lit) << "\n";
display(tout);
@ -214,7 +214,7 @@ namespace smt {
// next rounds.
//
unsigned context::extract_fixed_eqs(expr_ref_vector& conseq) {
TRACE("context", tout << "extract fixed consequences\n";);
TRACE(context, tout << "extract fixed consequences\n";);
auto are_equal = [&](expr* k, expr* v) {
return e_internalized(k) &&
e_internalized(v) &&
@ -245,7 +245,7 @@ namespace smt {
literal lit = mk_diseq(k, v);
literals.push_back(~lit);
mk_clause(literals.size(), literals.data(), nullptr);
TRACE("context", display_literals_verbose(tout, literals.size(), literals.data()););
TRACE(context, display_literals_verbose(tout, literals.size(), literals.data()););
}
}
for (expr* e : to_delete) {
@ -339,7 +339,7 @@ namespace smt {
lbool is_sat = check(assumptions.size(), assumptions.data());
if (is_sat != l_true) {
TRACE("context", tout << is_sat << "\n";);
TRACE(context, tout << is_sat << "\n";);
return is_sat;
}
if (m_qmanager->has_quantifiers()) {
@ -347,14 +347,14 @@ namespace smt {
return l_undef;
}
TRACE("context", display(tout););
TRACE(context, display(tout););
model_ref mdl;
get_model(mdl);
expr_ref_vector trail(m);
model_evaluator eval(*mdl.get());
expr_ref val(m);
TRACE("context", model_pp(tout, *mdl););
TRACE(context, model_pp(tout, *mdl););
for (expr* v : vars) {
eval(v, val);
if (m.is_value(val)) {
@ -368,7 +368,7 @@ namespace smt {
unsigned num_units = 0;
extract_fixed_consequences(num_units, _assumptions, conseq);
app_ref eq(m);
TRACE("context",
TRACE(context,
tout << "vars: " << vars.size() << "\n";
tout << "lits: " << num_units << "\n";);
pop_to_base_lvl();
@ -432,14 +432,14 @@ namespace smt {
m_not_l = null_literal;
}
if (is_sat == l_true) {
TRACE("context", display(tout););
TRACE(context, display(tout););
delete_unfixed(unfixed);
}
extract_fixed_consequences(num_units, _assumptions, conseq);
num_fixed_eqs += extract_fixed_eqs(conseq);
IF_VERBOSE(1, display_consequence_progress(verbose_stream(), num_iterations, m_var2val.size(), conseq.size(),
unfixed.size(), num_fixed_eqs););
TRACE("context", display_consequence_progress(tout, num_iterations, m_var2val.size(), conseq.size(),
TRACE(context, display_consequence_progress(tout, num_iterations, m_var2val.size(), conseq.size(),
unfixed.size(), num_fixed_eqs););
}
@ -644,7 +644,7 @@ namespace smt {
for (expr* a : assumptions) {
assert_expr(a);
}
TRACE("context", tout << "checking fixed: " << mk_pp(c, m) << "\n";);
TRACE(context, tout << "checking fixed: " << mk_pp(c, m) << "\n";);
tmp = m.mk_not(c);
assert_expr(tmp);
VERIFY(check() != l_true);
@ -655,7 +655,7 @@ namespace smt {
push();
for (expr* a : assumptions)
assert_expr(a);
TRACE("context", tout << "checking unfixed: " << mk_pp(uf, m) << "\n";);
TRACE(context, tout << "checking unfixed: " << mk_pp(uf, m) << "\n";);
lbool is_sat = check();
SASSERT(is_sat != l_false);
if (is_sat == l_true) {