Enhance the format of the diff tree dumping report

This patch changes the format of the diff tree dumping report emitted
by abidiff --dump-diff-treee to make it more hierachical and also add
two new properties: the address of the diff tree node and the address
of its canonical diff tree node.

	* src/abg-comparison.cc (diff_node_printer::do_indent): New
	method.
	(diff_node_printer::visit): Use diff_node_printer::do_indent().
	Print the addresses of the diff tree node and its canonical node.
	Add some vertical spaces and some indenting to make the report
	more readable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-01-09 14:04:59 +01:00
parent 322b0e7769
commit f9b21d7f80

View File

@ -11901,6 +11901,17 @@ struct diff_node_printer : public diff_node_visitor
ostream& out_;
unsigned level_;
/// Emit a certain number of spaces to the output stream associated
/// to this diff_node_printer.
///
/// @param level half of the numver of spaces to emit.
void
do_indent(unsigned level)
{
for (unsigned i = 0; i < level; ++i)
out_ << " ";
}
diff_node_printer(ostream& out)
: diff_node_visitor(DO_NOT_MARK_VISITED_NODES_AS_TRAVERSED),
out_(out),
@ -11940,14 +11951,22 @@ struct diff_node_printer : public diff_node_visitor
// nothing now.
return true;
// indent
for (unsigned i = 0; i < level_; ++i)
out_ << ' ';
do_indent(level_);
out_ << d->get_pretty_representation();
out_ << " {"
<< "category: "<< d->get_category()
<< "}";
out_ << '\n';
out_ << "\n";
do_indent(level_);
out_ << "{\n";
do_indent(level_ + 1);
out_ << "category: "<< d->get_category() << "\n";
do_indent(level_ + 1);
out_ << "@: " << std::hex << d << std::dec << "\n";
do_indent(level_ + 1);
out_ << "@-canonical: " << std::hex
<< d->get_canonical_diff()
<< std::dec << "\n";
do_indent(level_);
out_ << "}\n";
return true;
}