mirror of
https://github.com/Z3Prover/z3
synced 2025-07-31 08:23: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:
parent
d766292dab
commit
0a93ff515d
583 changed files with 8698 additions and 7299 deletions
|
@ -60,15 +60,15 @@ func_decls::func_decls(ast_manager & m, func_decl * f):
|
|||
}
|
||||
|
||||
void func_decls::finalize(ast_manager & m) {
|
||||
TRACE("cmd_context_detail", tout << "finalizing func_decls...\n";);
|
||||
TRACE(cmd_context_detail, tout << "finalizing func_decls...\n";);
|
||||
if (GET_TAG(m_decls) == 0) {
|
||||
m.dec_ref(UNTAG(func_decl *, m_decls));
|
||||
}
|
||||
else {
|
||||
TRACE("func_decls", tout << "finalize...\n";);
|
||||
TRACE(func_decls, tout << "finalize...\n";);
|
||||
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
|
||||
for (func_decl * f : *fs) {
|
||||
TRACE("func_decls", tout << "dec_ref of " << f->get_name() << " ref_count: " << f->get_ref_count() << "\n";);
|
||||
TRACE(func_decls, tout << "dec_ref of " << f->get_name() << " ref_count: " << f->get_ref_count() << "\n";);
|
||||
m.dec_ref(f);
|
||||
}
|
||||
dealloc(fs);
|
||||
|
@ -854,7 +854,7 @@ void cmd_context::init_manager_core(bool new_manager) {
|
|||
m_dt_eh = alloc(dt_eh, *this);
|
||||
m_pmanager->set_new_datatype_eh(m_dt_eh.get());
|
||||
if (!has_logic() && new_manager) {
|
||||
TRACE("cmd_context", tout << "init manager " << m_logic << "\n";);
|
||||
TRACE(cmd_context, tout << "init manager " << m_logic << "\n";);
|
||||
// add list type only if the logic is not specified.
|
||||
// it prevents clashes with builtin types.
|
||||
register_plist();
|
||||
|
@ -896,7 +896,7 @@ void cmd_context::init_external_manager() {
|
|||
}
|
||||
|
||||
bool cmd_context::set_logic(symbol const & s) {
|
||||
TRACE("cmd_context", tout << s << "\n";);
|
||||
TRACE(cmd_context, tout << s << "\n";);
|
||||
if (has_logic())
|
||||
throw cmd_exception("the logic has already been set");
|
||||
if (has_assertions() && m_main_ctx)
|
||||
|
@ -946,13 +946,13 @@ void cmd_context::insert(symbol const & s, func_decl * f) {
|
|||
throw cmd_exception(std::move(msg));
|
||||
}
|
||||
if (s != f->get_name()) {
|
||||
TRACE("func_decl_alias", tout << "adding alias for: " << f->get_name() << ", alias: " << s << "\n";);
|
||||
TRACE(func_decl_alias, tout << "adding alias for: " << f->get_name() << ", alias: " << s << "\n";);
|
||||
m_func_decl2alias.insert(f, s);
|
||||
}
|
||||
if (!m_global_decls) {
|
||||
m_func_decls_stack.push_back(sf_pair(s, f));
|
||||
}
|
||||
TRACE("cmd_context", tout << "new function decl\n" << mk_pp(f, m()) << "\n";);
|
||||
TRACE(cmd_context, tout << "new function decl\n" << mk_pp(f, m()) << "\n";);
|
||||
}
|
||||
|
||||
void cmd_context::insert(symbol const & s, psort_decl * p) {
|
||||
|
@ -966,7 +966,7 @@ void cmd_context::insert(symbol const & s, psort_decl * p) {
|
|||
if (!m_global_decls) {
|
||||
m_psort_decls_stack.push_back(s);
|
||||
}
|
||||
TRACE("cmd_context", tout << "new sort decl\n"; p->display(tout); tout << "\n";);
|
||||
TRACE(cmd_context, tout << "new sort decl\n"; p->display(tout); tout << "\n";);
|
||||
}
|
||||
|
||||
void cmd_context::insert(symbol const & s, unsigned arity, sort *const* domain, expr * t) {
|
||||
|
@ -982,7 +982,7 @@ void cmd_context::insert(symbol const & s, unsigned arity, sort *const* domain,
|
|||
if (contains_func_decl(s, arity, domain, t->get_sort())) {
|
||||
throw cmd_exception("invalid named expression, declaration already defined with this name ", s);
|
||||
}
|
||||
TRACE("insert_macro", tout << "new macro " << arity << "\n" << mk_pp(t, m()) << "\n";);
|
||||
TRACE(insert_macro, tout << "new macro " << arity << "\n" << mk_pp(t, m()) << "\n";);
|
||||
insert_macro(s, arity, domain, t);
|
||||
if (!m_global_decls) {
|
||||
m_macros_stack.push_back(s);
|
||||
|
@ -1055,7 +1055,7 @@ recfun::promise_def cmd_context::decl_rec_fun(const symbol &name, unsigned int a
|
|||
|
||||
void cmd_context::insert_rec_fun(func_decl* f, expr_ref_vector const& binding, svector<symbol> const& ids, expr* rhs) {
|
||||
|
||||
TRACE("recfun", tout<< "define recfun " << f->get_name() << " = " << mk_pp(rhs, m()) << "\n";);
|
||||
TRACE(recfun, tout<< "define recfun " << f->get_name() << " = " << mk_pp(rhs, m()) << "\n";);
|
||||
|
||||
recfun::decl::plugin& p = get_recfun_plugin();
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ bool cmd_context::try_mk_macro_app(symbol const & s, unsigned num_args, expr * c
|
|||
expr_ref _t(m());
|
||||
expr_ref_vector coerced_args(m());
|
||||
if (macros_find(s, num_args, args, coerced_args, _t)) {
|
||||
TRACE("macro_bug", tout << "well_sorted_check_enabled(): " << well_sorted_check_enabled() << "\n";
|
||||
TRACE(macro_bug, tout << "well_sorted_check_enabled(): " << well_sorted_check_enabled() << "\n";
|
||||
tout << "s: " << s << "\n";
|
||||
tout << "body:\n" << mk_ismt2_pp(_t, m()) << "\n";
|
||||
tout << "args:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(args[i]->get_sort(), m()) << "\n";);
|
||||
|
@ -1733,7 +1733,7 @@ void cmd_context::check_sat(unsigned num_assumptions, expr * const * assumptions
|
|||
return;
|
||||
IF_VERBOSE(100, verbose_stream() << "(started \"check-sat\")" << std::endl;);
|
||||
init_manager();
|
||||
TRACE("before_check_sat", dump_assertions(tout););
|
||||
TRACE(before_check_sat, dump_assertions(tout););
|
||||
unsigned timeout = m_params.m_timeout;
|
||||
unsigned rlimit = m_params.rlimit();
|
||||
scoped_watch sw(*this);
|
||||
|
@ -2131,11 +2131,11 @@ void cmd_context::validate_model() {
|
|||
if (is_ground(a)) {
|
||||
r = nullptr;
|
||||
evaluator(a, r);
|
||||
TRACE("model_validate", tout << "checking\n" << mk_ismt2_pp(a, m()) << "\nresult: " << mk_ismt2_pp(r, m()) << "\n";);
|
||||
TRACE(model_validate, tout << "checking\n" << mk_ismt2_pp(a, m()) << "\nresult: " << mk_ismt2_pp(r, m()) << "\n";);
|
||||
if (m().is_true(r))
|
||||
continue;
|
||||
|
||||
TRACE("model_validate", tout << *md << "\n";);
|
||||
TRACE(model_validate, tout << *md << "\n";);
|
||||
|
||||
// The evaluator for array expressions is not complete
|
||||
// If r contains as_array/store/map/const expressions, then we do not generate the error.
|
||||
|
@ -2155,7 +2155,7 @@ void cmd_context::validate_model() {
|
|||
|
||||
analyze_failure(seen, evaluator, a, true);
|
||||
IF_VERBOSE(11, model_smt2_pp(verbose_stream(), *this, *md, 0););
|
||||
TRACE("model_validate", model_smt2_pp(tout, *this, *md, 0););
|
||||
TRACE(model_validate, model_smt2_pp(tout, *this, *md, 0););
|
||||
invalid_model |= m().is_false(r);
|
||||
}
|
||||
}
|
||||
|
@ -2365,7 +2365,7 @@ format_ns::format * cmd_context::pp(sort * s) const {
|
|||
}
|
||||
|
||||
format_ns::format* cmd_context::try_pp(sort* s) const {
|
||||
TRACE("cmd_context", tout << "pp(sort * s), s: " << mk_pp(s, m()) << "\n";);
|
||||
TRACE(cmd_context, tout << "pp(sort * s), s: " << mk_pp(s, m()) << "\n";);
|
||||
return pm().pp(get_pp_env(), s);
|
||||
}
|
||||
|
||||
|
@ -2470,15 +2470,15 @@ cmd_context::dt_eh::dt_eh(cmd_context & owner):
|
|||
}
|
||||
|
||||
void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) {
|
||||
TRACE("new_dt_eh", tout << "new datatype: "; m_owner.pm().display(tout, dt); tout << "\n";);
|
||||
TRACE(new_dt_eh, tout << "new datatype: "; m_owner.pm().display(tout, dt); tout << "\n";);
|
||||
for (func_decl * c : *m_dt_util.get_datatype_constructors(dt)) {
|
||||
TRACE("new_dt_eh", tout << "new constructor: " << c->get_name() << "\n";);
|
||||
TRACE(new_dt_eh, tout << "new constructor: " << c->get_name() << "\n";);
|
||||
m_owner.insert(c);
|
||||
func_decl * r = m_dt_util.get_constructor_recognizer(c);
|
||||
m_owner.insert(r);
|
||||
// TRACE("new_dt_eh", tout << "new recognizer: " << r->get_name() << "\n";);
|
||||
// TRACE(new_dt_eh, tout << "new recognizer: " << r->get_name() << "\n";);
|
||||
for (func_decl * a : *m_dt_util.get_constructor_accessors(c)) {
|
||||
TRACE("new_dt_eh", tout << "new accessor: " << a->get_name() << "\n";);
|
||||
TRACE(new_dt_eh, tout << "new accessor: " << a->get_name() << "\n";);
|
||||
m_owner.insert(a);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ bool paccessor_decl::has_missing_refs(symbol & missing) const {
|
|||
}
|
||||
|
||||
bool paccessor_decl::fix_missing_refs(dictionary<int> const & symbol2idx, symbol & missing) {
|
||||
TRACE("fix_missing_refs", tout << "m_type.kind(): " << (int)m_type.kind() << "\n";
|
||||
TRACE(fix_missing_refs, tout << "m_type.kind(): " << (int)m_type.kind() << "\n";
|
||||
if (m_type.kind() == ptype_kind::PTR_MISSING_REF) tout << m_type.get_missing_ref() << "\n";);
|
||||
if (m_type.kind() != ptype_kind::PTR_MISSING_REF)
|
||||
return true;
|
||||
|
@ -504,7 +504,7 @@ pconstructor_decl::pconstructor_decl(unsigned id, unsigned num_params, pdecl_man
|
|||
m_recogniser_name(r),
|
||||
m_accessors(num_accessors, accessors) {
|
||||
m.inc_ref(num_accessors, accessors);
|
||||
TRACE("pconstructor_decl", tout << "name: " << n << ", recognizer: " << r << "\n";);
|
||||
TRACE(pconstructor_decl, tout << "name: " << n << ", recognizer: " << r << "\n";);
|
||||
}
|
||||
|
||||
void pconstructor_decl::finalize(pdecl_manager & m) {
|
||||
|
@ -651,7 +651,7 @@ std::ostream& pdatatype_decl::display(std::ostream & out) const {
|
|||
}
|
||||
|
||||
bool pdatatype_decl::commit(pdecl_manager& m) {
|
||||
TRACE("datatype", tout << m_name << "\n";);
|
||||
TRACE(datatype, tout << m_name << "\n";);
|
||||
sort_ref_vector ps(m.m());
|
||||
for (unsigned i = 0; i < m_num_params; ++i) {
|
||||
ps.push_back(m.m().mk_uninterpreted_sort(symbol(i), 0, nullptr));
|
||||
|
@ -685,7 +685,7 @@ void pdatatypes_decl::finalize(pdecl_manager & m) {
|
|||
}
|
||||
|
||||
bool pdatatypes_decl::fix_missing_refs(symbol & missing) {
|
||||
TRACE("fix_missing_refs", tout << "pdatatypes_decl::fix_missing_refs\n";);
|
||||
TRACE(fix_missing_refs, tout << "pdatatypes_decl::fix_missing_refs\n";);
|
||||
dictionary<int> symbol2idx;
|
||||
int idx = 0;
|
||||
for (pdatatype_decl* d : m_datatypes)
|
||||
|
@ -697,7 +697,7 @@ bool pdatatypes_decl::fix_missing_refs(symbol & missing) {
|
|||
}
|
||||
|
||||
sort* pdecl_manager::instantiate_datatype(psort_decl* p, symbol const& name, unsigned n, sort * const* s) {
|
||||
TRACE("datatype", tout << name << " "; for (unsigned i = 0; i < n; ++i) tout << s[i]->get_name() << " "; tout << "\n";);
|
||||
TRACE(datatype, tout << name << " "; for (unsigned i = 0; i < n; ++i) tout << s[i]->get_name() << " "; tout << "\n";);
|
||||
|
||||
pdecl_manager& m = *this;
|
||||
sort * r = p->find(s);
|
||||
|
@ -926,7 +926,7 @@ pdecl_manager::~pdecl_manager() {
|
|||
reset_sort_info();
|
||||
for (auto const& kv : m_sort2psort) {
|
||||
del_decl_core(kv.m_value);
|
||||
TRACE("pdecl_manager", tout << "orphan: " << mk_pp(kv.m_key, m()) << "\n";);
|
||||
TRACE(pdecl_manager, tout << "orphan: " << mk_pp(kv.m_key, m()) << "\n";);
|
||||
}
|
||||
for (auto* p : m_table) {
|
||||
del_decl_core(p);
|
||||
|
@ -970,7 +970,7 @@ pconstructor_decl * pdecl_manager::mk_pconstructor_decl(unsigned num_params,
|
|||
}
|
||||
|
||||
pdatatype_decl * pdecl_manager::mk_pdatatype_decl(unsigned num_params, symbol const & s, unsigned num, pconstructor_decl * const * cs) {
|
||||
TRACE("datatype", tout << s << " has " << num_params << " parameters\n";);
|
||||
TRACE(datatype, tout << s << " has " << num_params << " parameters\n";);
|
||||
return new (a().allocate(sizeof(pdatatype_decl))) pdatatype_decl(m_id_gen.mk(), num_params, *this,
|
||||
s, num, cs);
|
||||
}
|
||||
|
@ -1017,7 +1017,7 @@ sort * pdecl_manager::instantiate(psort * p, unsigned num, sort * const * args)
|
|||
|
||||
|
||||
void pdecl_manager::del_decl_core(pdecl * p) {
|
||||
TRACE("pdecl_manager",
|
||||
TRACE(pdecl_manager,
|
||||
tout << "del_decl_core:\n";
|
||||
if (p->is_psort()) static_cast<psort*>(p)->display(tout);
|
||||
else static_cast<psort_decl*>(p)->display(tout);
|
||||
|
@ -1030,7 +1030,7 @@ void pdecl_manager::del_decl_core(pdecl * p) {
|
|||
}
|
||||
|
||||
void pdecl_manager::del_decl(pdecl * p) {
|
||||
TRACE("pdecl_manager", tout << "del psort "; p->display(tout); tout << "\n";);
|
||||
TRACE(pdecl_manager, tout << "del psort "; p->display(tout); tout << "\n";);
|
||||
if (p->is_psort()) {
|
||||
psort * _p = static_cast<psort*>(p);
|
||||
if (_p->is_sort_wrapper()) {
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
labels_vec labels;
|
||||
goal_ref g = alloc(goal, m, ctx.produce_proofs(), ctx.produce_models(), ctx.produce_unsat_cores());
|
||||
assert_exprs_from(ctx, *g);
|
||||
TRACE("check_sat_using", g->display(tout););
|
||||
TRACE(check_sat_using, g->display(tout););
|
||||
model_ref md;
|
||||
proof_ref pr(m);
|
||||
expr_dependency_ref core(m);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue