3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-10 09:48:05 +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

@ -90,7 +90,7 @@ private:
explanation ex;
explain_fixed_in_row(r1, ex);
explain_fixed_in_row(r2, ex);
TRACE("eq", print_row(tout, r1); print_row(tout, r2); tout << v1 << " == " << v2 << " = " << val(v1) << "\n");
TRACE(eq, print_row(tout, r1); print_row(tout, r2); tout << v1 << " == " << v2 << " = " << val(v1) << "\n");
add_eq_on_columns(ex, v1, v2, true);
}
@ -162,12 +162,12 @@ public:
found_bound.m_bound = v;
found_bound.m_strict = strict;
found_bound.set_explain(explain_bound);
TRACE("add_bound", lp().print_implied_bound(found_bound, tout););
TRACE(add_bound, lp().print_implied_bound(found_bound, tout););
}
} else {
m_improved_lower_bounds.insert(j, static_cast<unsigned>(m_ibounds.size()));
m_ibounds.push_back(implied_bound(v, j, is_low, strict, explain_bound));
TRACE("add_bound", lp().print_implied_bound(m_ibounds.back(), tout););
TRACE(add_bound, lp().print_implied_bound(m_ibounds.back(), tout););
}
} else { // the upper bound case
unsigned k;
@ -178,12 +178,12 @@ public:
found_bound.m_bound = v;
found_bound.m_strict = strict;
found_bound.set_explain(explain_bound);
TRACE("add_bound", lp().print_implied_bound(found_bound, tout););
TRACE(add_bound, lp().print_implied_bound(found_bound, tout););
}
} else {
m_improved_upper_bounds.insert(j, static_cast<unsigned>(m_ibounds.size()));
m_ibounds.push_back(implied_bound(v, j, is_low, strict, explain_bound));
TRACE("add_bound", lp().print_implied_bound(m_ibounds.back(), tout););
TRACE(add_bound, lp().print_implied_bound(m_ibounds.back(), tout););
}
}
}
@ -217,7 +217,7 @@ public:
SASSERT(je != ke && is_int(je) == is_int(ke));
SASSERT(ival(je) == ival(ke));
TRACE("eq",
TRACE(eq,
tout << "reported idx " << je << ", " << ke << "\n";
lp().print_expl(tout, exp);
tout << "theory_vars v" << lp().local_to_external(je) << " == v" << lp().local_to_external(ke) << "\n";);
@ -247,7 +247,7 @@ public:
}
void explain_fixed_in_row(unsigned row, explanation& ex) {
TRACE("eq", tout << lp().get_row(row) << std::endl);
TRACE(eq, tout << lp().get_row(row) << std::endl);
for (const auto& c : lp().get_row(row))
if (lp().column_is_fixed(c.var()))
lp().explain_fixed_column(c.var(), ex);
@ -255,7 +255,7 @@ public:
unsigned explain_fixed_in_row_and_get_base(unsigned row, explanation& ex) {
unsigned base = UINT_MAX;
TRACE("eq", tout << lp().get_row(row) << std::endl);
TRACE(eq, tout << lp().get_row(row) << std::endl);
for (const auto& c : lp().get_row(row)) {
if (lp().column_is_fixed(c.var())) {
lp().explain_fixed_column(c.var(), ex);
@ -342,7 +342,7 @@ public:
try_add_equation_with_internal_fixed_tables(row_index);
return;
}
TRACE("eq",
TRACE(eq,
tout << "v_j = ";
lp().print_column_info(v_j, tout) << std::endl;
tout << "found j " << j << std::endl; lp().print_column_info(j, tout) << std::endl;
@ -356,7 +356,7 @@ public:
void cheap_eq_on_nbase(unsigned row_index) {
reset_cheap_eq _reset(*this);
TRACE("eq", tout << "row_index = " << row_index << "\n";
TRACE(eq, tout << "row_index = " << row_index << "\n";
print_row(tout, row_index) << "\n";);
if (!check_insert(m_visited_rows, row_index))
return;
@ -378,7 +378,7 @@ public:
SASSERT(lp().is_base(y) == false);
auto& table = y_sign == 1 ? m_row2index_pos : m_row2index_neg;
table.insert(val(x), row_index);
TRACE("eq", tout << "y = " << y << "\n";);
TRACE(eq, tout << "y = " << y << "\n";);
for (const column_cell& c : lp().get_column(y)) {
unsigned i = c.var(); // the running index of the row
@ -406,7 +406,7 @@ public:
continue;
explain_fixed_in_row(found_i, ex);
explain_fixed_in_row(i, ex);
TRACE("eq", {
TRACE(eq, {
print_row(tout, i);
print_row(tout, found_i) << "\n";
lp().print_column_info(base_of_found, tout);