3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-12 03:44:07 +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

@ -189,7 +189,7 @@ namespace datalog {
void compiler::make_add_unbound_column(rule* compiled_rule, unsigned col_idx, func_decl* pred, reg_idx src, const relation_sort& s, reg_idx & result,
bool & dealloc, instruction_block & acc) {
TRACE("dl", tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager())
TRACE(dl, tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager())
<< " " << m_context.get_rel_context()->get_rmanager().to_nice_string(s) << "\n";);
IF_VERBOSE(3, {
expr_ref e(m_context.get_manager());
@ -219,7 +219,7 @@ namespace datalog {
void compiler::make_full_relation(func_decl* pred, const relation_signature & sig, reg_idx & result,
instruction_block & acc) {
SASSERT(sig.empty());
TRACE("dl", tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager()) << "\n";);
TRACE(dl, tout << "Adding unbound column " << mk_pp(pred, m_context.get_manager()) << "\n";);
if (m_empty_tables_registers.find(pred, result))
return;
@ -271,7 +271,7 @@ namespace datalog {
bool & dealloc,
instruction_block & acc) {
TRACE("dl", tout << mk_pp(head_pred, m_context.get_manager()) << "\n";);
TRACE(dl, tout << mk_pp(head_pred, m_context.get_manager()) << "\n";);
unsigned col_cnt = acis0.size();
reg_idx curr = src;
@ -337,7 +337,7 @@ namespace datalog {
}
else {
SASSERT(acis[i].kind==ACK_UNBOUND_VAR);
TRACE("dl", tout << head_pred->get_name() << " index: " << i
TRACE(dl, tout << head_pred->get_name() << " index: " << i
<< " " << m_context.get_rel_context()->get_rmanager().to_nice_string(acis[i].domain) << "\n";);
make_add_unbound_column(compiled_rule, i, head_pred, curr, acis[i].domain, curr, dealloc, acc);
handled_unbound.insert(acis[i].var_index,bound_column_index);
@ -456,7 +456,7 @@ namespace datalog {
unsigned head_len = h->get_num_args();
func_decl * head_pred = h->get_decl();
TRACE("dl", r->display(m_context, tout); );
TRACE(dl, r->display(m_context, tout); );
unsigned pt_len = r->get_positive_tail_size();
SASSERT(pt_len<=2); //we require rules to be processed by the mk_simple_joins rule transformer plugin
@ -625,7 +625,7 @@ namespace datalog {
} else {
// we have an unbound variable, so we add an unbound column for it
relation_sort unbound_sort = m_free_vars[v];
TRACE("dl", tout << "unbound: " << v << "\n" << filter_cond << " " << mk_pp(unbound_sort, m) << "\n";);
TRACE(dl, tout << "unbound: " << v << "\n" << filter_cond << " " << mk_pp(unbound_sort, m) << "\n";);
make_add_unbound_column(r, 0, head_pred, filtered_res, unbound_sort, filtered_res, dealloc, acc);
src_col = single_res_expr.size();
@ -778,7 +778,7 @@ namespace datalog {
relation_sort unbound_sort = m_free_vars[v];
reg_idx new_reg;
TRACE("dl", tout << mk_pp(head_pred, m_context.get_manager()) << "\n";);
TRACE(dl, tout << mk_pp(head_pred, m_context.get_manager()) << "\n";);
bool new_dealloc;
make_add_unbound_column(r, 0, head_pred, filtered_res, unbound_sort, new_reg, new_dealloc, acc);
@ -902,7 +902,7 @@ namespace datalog {
if (!pos_vars.contains(v)) {
single_res_expr.push_back(e);
make_add_unbound_column(r, v, pred, single_res, e->get_sort(), single_res, dealloc, acc);
TRACE("dl", tout << "Adding unbound column: " << mk_pp(e, m_context.get_manager()) << "\n";);
TRACE(dl, tout << "Adding unbound column: " << mk_pp(e, m_context.get_manager()) << "\n";);
}
}
}
@ -1268,7 +1268,7 @@ namespace datalog {
continue;
}
TRACE("dl",
TRACE(dl,
tout << "Stratum: ";
func_decl_set::iterator pit = strat_preds.begin();
func_decl_set::iterator pend = strat_preds.end();
@ -1332,7 +1332,7 @@ namespace datalog {
acc.set_observer(nullptr);
TRACE("dl", execution_code.display(execution_context(m_context), tout););
TRACE(dl, execution_code.display(execution_context(m_context), tout););
}