3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 21:16:02 +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

@ -36,7 +36,7 @@ bool theory_seq::solve_nqs(unsigned i) {
bool theory_seq::solve_ne(unsigned idx) {
TRACE("seq", display_disequation(tout << "solve: ", m_nqs[idx]););
TRACE(seq, display_disequation(tout << "solve: ", m_nqs[idx]););
unsigned num_undef_lits = 0;
return
(!check_ne_literals(idx, num_undef_lits))
@ -50,7 +50,7 @@ bool theory_seq::check_ne_literals(unsigned idx, unsigned& num_undef_lits) {
for (literal lit : n.lits()) {
switch (ctx.get_assignment(lit)) {
case l_false:
TRACE("seq", display_disequation(tout << "has false literal\n", n);
TRACE(seq, display_disequation(tout << "has false literal\n", n);
ctx.display_literal_verbose(tout, lit);
tout << "\n" << lit << " " << ctx.is_relevant(lit) << "\n";
display(tout);
@ -101,13 +101,13 @@ bool theory_seq::propagate_ne2lit(unsigned idx) {
lits.reset();
lits.push_back(~diseq);
dep = dep1;
TRACE("seq", tout << "conflict explained\n";);
TRACE(seq, tout << "conflict explained\n";);
}
}
set_conflict(dep, lits);
}
else {
TRACE("seq", tout << "propagate: " << undef_lit << "\n";);
TRACE(seq, tout << "propagate: " << undef_lit << "\n";);
propagate_lit(n.dep(), lits.size(), lits.data(), ~undef_lit);
}
return true;
@ -167,7 +167,7 @@ bool theory_seq::reduce_ne(unsigned idx) {
new_deps = m_dm.mk_join(deps, new_deps);
bool is_sat = m_seq_rewrite.reduce_eq(ls, rs, eqs, change);
TRACE("seq", display_disequation(tout << "reduced\n", n);
TRACE(seq, display_disequation(tout << "reduced\n", n);
tout << p.first << " -> " << ls << "\n";
tout << p.second << " -> " << rs << "\n";
tout << eqs << "\n";
@ -178,7 +178,7 @@ bool theory_seq::reduce_ne(unsigned idx) {
}
if (!change) {
TRACE("seq", tout << "no change " << p.first << " " << p.second << "\n";);
TRACE(seq, tout << "no change " << p.first << " " << p.second << "\n";);
if (updated) {
new_eqs.push_back(p);
}
@ -194,7 +194,7 @@ bool theory_seq::reduce_ne(unsigned idx) {
if (!ls.empty() || !rs.empty()) {
new_eqs.push_back(decomposed_eq(ls, rs));
}
TRACE("seq",
TRACE(seq,
tout << "num eqs: " << eqs.size() << "\n";
tout << "num new eqs: " << new_eqs.size() << "\n";
tout << eqs << "\n";
@ -229,9 +229,9 @@ bool theory_seq::reduce_ne(unsigned idx) {
}
if (updated) {
TRACE("seq", display_disequation(tout, n););
TRACE(seq, display_disequation(tout, n););
m_nqs.set(idx, ne(n.l(), n.r(), new_eqs, new_lits, new_deps));
TRACE("seq", display_disequation(tout << "updated:\n", m_nqs[idx]););
TRACE(seq, display_disequation(tout << "updated:\n", m_nqs[idx]););
}
return false;
}
@ -275,7 +275,7 @@ lbool theory_seq::branch_nq(ne const& n) {
ctx.mark_as_relevant(eq_len);
switch (ctx.get_assignment(eq_len)) {
case l_false:
TRACE("seq",
TRACE(seq,
display_disequation(tout, n);
ctx.display_literal_smt2(tout << "lengths are different: ", eq_len) << "\n";);
return l_true;
@ -304,7 +304,7 @@ lbool theory_seq::branch_nq(ne const& n) {
ctx.mark_as_relevant(eq_head);
switch (ctx.get_assignment(eq_head)) {
case l_false:
TRACE("seq", ctx.display_literal_smt2(tout << "heads are different: ", eq_head) << "\n";);
TRACE(seq, ctx.display_literal_smt2(tout << "heads are different: ", eq_head) << "\n";);
return l_true;
case l_undef:
return l_undef;