mirror of
https://github.com/Z3Prover/z3
synced 2025-08-26 04:56:03 +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
|
@ -122,7 +122,7 @@ namespace {
|
|||
|
||||
if (m_context.get_random_value() < static_cast<int>(m_params.m_random_var_freq * random_gen::max_value())) {
|
||||
next = m_context.get_random_value() % m_context.get_num_b_internalized();
|
||||
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
if (m_context.get_assignment(next) == l_undef)
|
||||
return;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ namespace {
|
|||
s.m_head_old = m_head;
|
||||
s.m_queue2_trail = m_queue2.size();
|
||||
s.m_head2_old = m_head2;
|
||||
TRACE("case_split", tout << "head: " << m_head << "\n";);
|
||||
TRACE(case_split, tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
|
@ -414,7 +414,7 @@ namespace {
|
|||
m_head2 = s.m_head2_old;
|
||||
m_scopes.shrink(new_lvl);
|
||||
SASSERT(m_head <= m_queue.size());
|
||||
TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";);
|
||||
TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
void next_case_split_core(ptr_vector<expr> & queue, unsigned & head, bool_var & next, lbool & phase) {
|
||||
|
@ -441,19 +441,19 @@ namespace {
|
|||
if (m_manager.has_trace_stream()) {
|
||||
m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n";
|
||||
}
|
||||
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
literal l = m_context.get_literal(undef_child);
|
||||
next = l.var();
|
||||
phase = l.sign() ? l_false : l_true;
|
||||
TRACE("case_split", display(tout););
|
||||
TRACE(case_split, display(tout););
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (val == l_undef) {
|
||||
SASSERT(intern && m_context.get_bool_var(curr) == next);
|
||||
TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";);
|
||||
TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";);
|
||||
phase = l_undef;
|
||||
TRACE("case_split", display(tout););
|
||||
TRACE(case_split, display(tout););
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ namespace {
|
|||
scope & s = m_scopes.back();
|
||||
s.m_queue_trail = m_queue.size();
|
||||
s.m_head_old = m_head;
|
||||
TRACE("case_split", tout << "head: " << m_head << "\n";);
|
||||
TRACE(case_split, tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
|
@ -608,7 +608,7 @@ namespace {
|
|||
m_head = s.m_head_old;
|
||||
m_scopes.shrink(new_lvl);
|
||||
SASSERT(m_head <= m_queue.size());
|
||||
TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";);
|
||||
TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
void next_case_split_core(bool_var & next, lbool & phase) {
|
||||
|
@ -632,19 +632,19 @@ namespace {
|
|||
if ((is_or && val == l_true) || (is_and && val == l_false)) {
|
||||
expr * undef_child = nullptr;
|
||||
if (!has_child_assigned_to(m_context, to_app(curr), val, undef_child, m_params.m_rel_case_split_order)) {
|
||||
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
literal l = m_context.get_literal(undef_child);
|
||||
next = l.var();
|
||||
phase = l.sign() ? l_false : l_true;
|
||||
TRACE("case_split", display(tout););
|
||||
TRACE(case_split, display(tout););
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (val == l_undef) {
|
||||
SASSERT(intern && m_context.get_bool_var(curr) == next);
|
||||
TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";);
|
||||
TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";);
|
||||
phase = l_undef;
|
||||
TRACE("case_split", display(tout););
|
||||
TRACE(case_split, display(tout););
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ namespace {
|
|||
void next_case_split(bool_var & next, lbool & phase) override {
|
||||
if (m_context.get_random_value() < static_cast<int>(0.02 * random_gen::max_value())) {
|
||||
next = m_context.get_random_value() % m_context.get_num_b_internalized();
|
||||
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
if (m_context.get_assignment(next) == l_undef)
|
||||
return;
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ namespace {
|
|||
s.m_queue2_trail = m_queue2.size();
|
||||
s.m_generation = m_current_generation;
|
||||
s.m_goal = m_current_goal;
|
||||
TRACE("case_split", tout << "head: " << m_head << "\n";);
|
||||
TRACE(case_split, tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
void pop_scope(unsigned num_scopes) override {
|
||||
|
@ -857,7 +857,7 @@ namespace {
|
|||
m_current_goal = s.m_goal;
|
||||
|
||||
for (unsigned i = s.m_queue2_trail; i < m_queue2.size(); i++) {
|
||||
//TRACE("case_split", tout << "ld[" << i << "] = " << m_queue2[i].m_last_decided << " cont " <<
|
||||
//TRACE(case_split, tout << "ld[" << i << "] = " << m_queue2[i].m_last_decided << " cont " <<
|
||||
SASSERT((m_queue2[i].m_last_decided == -1) == m_priority_queue2.contains(i));
|
||||
if (m_priority_queue2.contains(i))
|
||||
m_priority_queue2.erase(i);
|
||||
|
@ -877,7 +877,7 @@ namespace {
|
|||
m_queue2.shrink(s.m_queue2_trail);
|
||||
m_scopes.shrink(new_lvl);
|
||||
SASSERT(m_head <= m_queue.size());
|
||||
TRACE("case_split", display(tout); tout << "head: " << m_head << "\n";);
|
||||
TRACE(case_split, display(tout); tout << "head: " << m_head << "\n";);
|
||||
}
|
||||
|
||||
void next_case_split_core(expr * curr, bool_var & next, lbool & phase) {
|
||||
|
@ -900,19 +900,19 @@ namespace {
|
|||
if (m_manager.has_trace_stream()) {
|
||||
m_manager.trace_stream() << "[decide-and-or] #" << curr->get_id() << " #" << undef_child->get_id() << "\n";
|
||||
}
|
||||
TRACE("case_split", tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
TRACE(case_split, tout << "found AND/OR candidate: #" << curr->get_id() << " #" << undef_child->get_id() << "\n";);
|
||||
literal l = m_context.get_literal(undef_child);
|
||||
next = l.var();
|
||||
phase = l.sign() ? l_false : l_true;
|
||||
TRACE("case_split", display(tout););
|
||||
TRACE(case_split, display(tout););
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (val == l_undef) {
|
||||
SASSERT(intern && m_context.get_bool_var(curr) == next);
|
||||
TRACE("case_split", tout << "found candidate: #" << curr->get_id() << "\n";);
|
||||
TRACE(case_split, tout << "found candidate: #" << curr->get_id() << "\n";);
|
||||
phase = l_undef;
|
||||
TRACE("case_split", display(tout););
|
||||
TRACE(case_split, display(tout););
|
||||
return;
|
||||
}
|
||||
next = null_bool_var;
|
||||
|
@ -932,7 +932,7 @@ namespace {
|
|||
|
||||
while (!m_priority_queue2.empty()) {
|
||||
unsigned idx = static_cast<unsigned>(m_priority_queue2.erase_min());
|
||||
TRACE("case_split", tout << "q " << m_queue2.size() << " idx " << idx << "\n"; );
|
||||
TRACE(case_split, tout << "q " << m_queue2.size() << " idx " << idx << "\n"; );
|
||||
SASSERT(idx < m_queue2.size());
|
||||
queue_entry & e = m_queue2[idx];
|
||||
SASSERT(e.m_last_decided == -1);
|
||||
|
@ -989,7 +989,7 @@ namespace {
|
|||
if (!m_manager.is_label_lit(lablit))
|
||||
return;
|
||||
|
||||
TRACE("case_split", tout << "Found goal\n" << mk_pp(e, m_manager) << "\n"; );
|
||||
TRACE(case_split, tout << "Found goal\n" << mk_pp(e, m_manager) << "\n"; );
|
||||
|
||||
set_goal(e);
|
||||
}
|
||||
|
@ -1189,7 +1189,7 @@ namespace {
|
|||
if (m_context.get_random_value() < threshold) {
|
||||
SASSERT(m_context.get_num_b_internalized() > 0);
|
||||
next = m_context.get_random_value() % m_context.get_num_b_internalized();
|
||||
TRACE("random_split", tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
TRACE(random_split, tout << "next: " << next << " get_assignment(next): " << m_context.get_assignment(next) << "\n";);
|
||||
if (m_context.get_assignment(next) == l_undef)
|
||||
return;
|
||||
}
|
||||
|
@ -1209,7 +1209,7 @@ namespace {
|
|||
}
|
||||
|
||||
void add_theory_aware_branching_info(bool_var v, double priority, lbool phase) override {
|
||||
TRACE("theory_aware_branching", tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;);
|
||||
TRACE(theory_aware_branching, tout << "Add theory-aware branching information for l#" << v << ": priority=" << priority << std::endl;);
|
||||
m_theory_vars.insert(v);
|
||||
m_theory_var_phase.insert(v, phase);
|
||||
m_theory_var_priority.insert(v, priority);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue