]> git.ipfire.org Git - thirdparty/gcc.git/commit
analyzer: simplify dumps using tree_dump_pretty_printer [PR116613]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 20 Sep 2024 22:51:55 +0000 (18:51 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 20 Sep 2024 22:51:55 +0000 (18:51 -0400)
commit39f7703fffee0c1a8aa999b29ae52b2a31903715
treee620ef021654616b7652f2b89ab566b24398e911
parent725231e16768bd9f16169b3b7e4cb5a98b251d1c
analyzer: simplify dumps using tree_dump_pretty_printer [PR116613]

There are numerous "dump" member functions in the analyzer with
copied-and-pasted logic.  Simplify them by moving the shared code
to a new class tree_dump_pretty_printer.

As well as reducing code duplication, this eliminates numerous
uses of pp_show_color (global_dc->m_printer), which should
ultimately help with supporting multiple diagnostic sinks.

No functional change intended.

gcc/analyzer/ChangeLog:
PR other/116613
* access-diagram.cc (access_range::dump): Simplify using
tree_dump_pretty_printer.
* call-details.cc (call_details::dump): Likewise.
* call-summary.cc (call_summary::dump): Likewise.
(call_summary_replay::dump): Likewise.
* checker-event.cc (checker_event::debug): Likewise.
* constraint-manager.cc (range::dump): Likewise.
(bounded_range::dump): Likewise.
(bounded_ranges::dump): Likewise.
(constraint_manager::dump): Likewise.
* engine.cc (exploded_node::dump): Likewise.
(exploded_path::dump): Likewise.
* program-point.cc (program_point::dump): Likewise.
* program-state.cc (extrinsic_state::dump_to_file): Likewise.
(sm_state_map::dump): Likewise.
(program_state::dump_to_file): Likewise.
* ranges.cc (symbolic_byte_offset::dump): Likewise.
(symbolic_byte_range::dump): Likewise.
* record-layout.cc (record_layout::dump): Likewise.
* region-model-reachability.cc (reachable_regions::dump):
Likewise.
* region-model.cc (region_to_value_map::dump): Likewise.
(region_model::dump): Likewise.
(model_merger::dump): Likewise.
* region.cc (region_offset::dump): Likewise.
(region::dump): Likewise.
* sm-malloc.cc (deallocator_set::dump): Likewise.
* store.cc (uncertainty_t::dump): Likewise.
(binding_key::dump): Likewise.
(bit_range::dump): Likewise.
(byte_range::dump): Likewise.
(binding_map::dump): Likewise.
(binding_cluster::dump): Likewise.
(store::dump): Likewise.
* supergraph.cc (superedge::dump): Likewise.
* svalue.cc (svalue::dump): Likewise.

gcc/ChangeLog:
PR other/116613
* text-art/dump.h (dump_to_file): Simplify using
tree_dump_pretty_printer.
* tree-diagnostic.h (class tree_dump_pretty_printer): New.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
19 files changed:
gcc/analyzer/access-diagram.cc
gcc/analyzer/call-details.cc
gcc/analyzer/call-summary.cc
gcc/analyzer/checker-event.cc
gcc/analyzer/constraint-manager.cc
gcc/analyzer/engine.cc
gcc/analyzer/program-point.cc
gcc/analyzer/program-state.cc
gcc/analyzer/ranges.cc
gcc/analyzer/record-layout.cc
gcc/analyzer/region-model-reachability.cc
gcc/analyzer/region-model.cc
gcc/analyzer/region.cc
gcc/analyzer/sm-malloc.cc
gcc/analyzer/store.cc
gcc/analyzer/supergraph.cc
gcc/analyzer/svalue.cc
gcc/text-art/dump.h
gcc/tree-diagnostic.h