3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-27 13:39:49 +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

@ -89,14 +89,14 @@ expr * proto_model::mk_some_interp_for(func_decl * d) {
bool proto_model::eval(expr * e, expr_ref & result, bool model_completion) {
m_eval.set_model_completion(model_completion);
m_eval.set_expand_array_equalities(false);
TRACE("model_evaluator", model_v2_pp(tout, *this, true););
TRACE(model_evaluator, model_v2_pp(tout, *this, true););
try {
m_eval(e, result);
return true;
}
catch (model_evaluator_exception & ex) {
(void)ex;
TRACE("model_evaluator", tout << ex.what() << "\n";);
TRACE(model_evaluator, tout << ex.what() << "\n";);
return false;
}
}
@ -128,7 +128,7 @@ void proto_model::cleanup_func_interp(expr_ref_vector& trail, func_interp * fi,
}
expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl_set& found_aux_fs) {
TRACE("model_bug", tout << "cleaning up:\n" << mk_pp(fi_else, m) << "\n";);
TRACE(model_bug, tout << "cleaning up:\n" << mk_pp(fi_else, m) << "\n";);
trail.reset();
obj_map<expr, expr*> cache;
ptr_buffer<expr, 128> todo;
@ -170,7 +170,7 @@ expr* proto_model::cleanup_expr(expr_ref_vector& trail, expr* fi_else, func_decl
}
func_decl * f = t->get_decl();
if (m_aux_decls.contains(f)) {
TRACE("model_bug", tout << f->get_name() << "\n";);
TRACE(model_bug, tout << f->get_name() << "\n";);
found_aux_fs.insert(f);
}
new_t = m_rewrite.mk_app(f, args.size(), args.data());
@ -210,7 +210,7 @@ void proto_model::remove_aux_decls_not_in_set(ptr_vector<func_decl> & decls, fun
by their interpretations.
*/
void proto_model::cleanup() {
TRACE("model_bug", model_v2_pp(tout, *this););
TRACE(model_bug, model_v2_pp(tout, *this););
func_decl_set found_aux_fs;
expr_ref_vector trail(m);
ptr_buffer<func_interp> finterps;
@ -227,7 +227,7 @@ void proto_model::cleanup() {
register_decl(d, r);
}
}
// TRACE("model_bug", model_v2_pp(tout, *this););
// TRACE(model_bug, model_v2_pp(tout, *this););
// remove auxiliary declarations that are not used.
if (found_aux_fs.size() != m_aux_decls.size()) {
remove_aux_decls_not_in_set(m_decls, found_aux_fs);
@ -235,13 +235,13 @@ void proto_model::cleanup() {
for (func_decl* faux : m_aux_decls) {
if (!found_aux_fs.contains(faux)) {
TRACE("cleanup_bug", tout << "eliminating " << faux->get_name() << " " << faux->get_ref_count() << "\n";);
TRACE(cleanup_bug, tout << "eliminating " << faux->get_name() << " " << faux->get_ref_count() << "\n";);
unregister_decl(faux);
}
}
m_aux_decls.swap(found_aux_fs);
}
TRACE("model_bug", model_v2_pp(tout, *this););
TRACE(model_bug, model_v2_pp(tout, *this););
}
value_factory * proto_model::get_factory(family_id fid) {
@ -371,7 +371,7 @@ void proto_model::complete_partial_funcs(bool use_fresh) {
}
model * proto_model::mk_model() {
TRACE("proto_model", model_v2_pp(tout << "mk_model\n", *this););
TRACE(proto_model, model_v2_pp(tout << "mk_model\n", *this););
model * mdl = alloc(model, m);
for (auto const& kv : m_interp) {
@ -388,7 +388,7 @@ model * proto_model::mk_model() {
unsigned sz = get_num_uninterpreted_sorts();
for (unsigned i = 0; i < sz; i++) {
sort * s = get_uninterpreted_sort(i);
TRACE("proto_model", tout << "copying uninterpreted sorts...\n" << mk_pp(s, m) << "\n";);
TRACE(proto_model, tout << "copying uninterpreted sorts...\n" << mk_pp(s, m) << "\n";);
ptr_vector<expr> const& buf = get_universe(s);
mdl->register_usort(s, buf.size(), buf.data());
}