mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-19 16:30:04 +00:00
3824d8f3c2
Right now, the reporting functionnality is implemented directly in the comparison engine. Being able to emit several kinds of reports is really not practical with the current design. This patch improves that situation by introducing an indirection between the comparison engine and the code that emits the report. A new abigail::comparison::reporter_base type is introduced. That type several contains virtual methods that knows how to implement reporting. Each virtual method reports about changes carried by a kind of diff node. In other words, abigail::comparison::reporter_base is the interface of reporter objects. The current reporting using the current format is thus implemented by the new abigail::comparison::default_reporter type, which implements the abigail::comparison::reporter_base interface. The diff::report methods now "just" get the reporter object from the context of the diff and invoke its right reporting interface. So whenever someone needs to implement a new reporting format, she needs to provide a new implementation of the abigail::comparison::reporter_base interface and set it to the diff_context prior to invoking the abigail::comparison::corpus_diff::report() method. * include/Makefile.am: Add the new abg-reporter.h header file to source distribution. * include/abg-comparison.h: Include the new abg-reporter.h header file. (diff_context::{g,s}et_reporter): Declare new accessors. ({type_diff_base, decl_diff_base, corpus_diff}::priv): Make this be a struct rather than a class. ({decl_diff_base, class_diff, scope_diff, function_type_diff, corpus_diff}): Declare default_reporter a friend class of these. * include/abg-reporter.h: New file. * src/Makefile.am: Add abg-comparison-priv.h, abg-reporter-priv.{h,cc} and abg-default-reporter.cc files to source distribution. * src/abg-comparison-priv.h: New file. * src/abg-comparison.cc (sort_enumerators) (sort_changed_enumerators, sort_data_members) (sort_string_function_ptr_map) (sort_string_function_decl_diff_sptr_map) (sort_string_var_diff_sptr_map, sort_string_elf_symbol_map) (sort_string_var_ptr_map, sort_string_data_member_diff_sptr_map) (sort_unsigned_data_member_diff_sptr_map) (sort_string_diff_sptr_map, sort_string_base_diff_sptr_map) (sort_string_base_sptr_map, sort_string_fn_parm_diff_sptr_map) (sort_string_parm_map, get_leaf_type, sort_enumerators) (sort_changed_enumerators): Make these functions non-static and move them at the beginning of the file. These functions are now declared in abg-compared-priv.h so they can be shared privately with other files in src/. (diff_context::{g,s}et_reporter): Define new accessors. ({diff_context, diff, type_diff_base, decl_diff_base, distinct_diff, pointer_diff, array_diff, reference_diff, qualified_type_diff, enum_diff, class_or_union_diff, class_diff, base_diff, scope_diff, fn_parm_diff, function_type_diff, function_decl_diff, type_decl_diff, typedef_diff, translation_unit_diff, corpus_diff::diff_stats, corpus_diff}::priv) (diff_less_than_functor, enumerator_value_comp) (changed_enumerator_comp, base_spec_comp, base_diff_comp) (data_member_diff_comp, diff_comp, fn_parm_diff_comp, parm_comp) (elf_symbol_comp, function_comp, function_decl_diff_comp) (var_diff_sptr_comp): Move these type definitions to abg-comparison-priv.h (report_size_and_alignment_changes, report_loc_info) (maybe_report_diff_for_member, maybe_report_diff_for_symbol) (represent, represent_data_member) (maybe_show_relative_offset_change, represent) (report_size_and_alignment_changes, report_loc_info) (report_name_size_and_alignment_changes, report_mem_header) (maybe_report_diff_for_member, maybe_report_diff_for_symbol) (show_linkage_name_and_aliases): Move these definitions to abg-reporter-priv.cc. ({distinct_diff, var_diff, pointer_diff, array_diff, reference_diff, qualified_type_diff, enum_diff, class_or_union_diff, class_diff, base_diff, union_diff, scope_diff, fn_parm_diff, function_type_diff, type_decl_diff, typedef_diff, corpus_diff}::report): Use the reporter object to report about the changes carried by the the current diff node. * src/abg-default-reporter.cc: New file. * src/abg-reporter-priv.h: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
abg-comp-filter.h | ||
abg-comparison.h | ||
abg-config.h | ||
abg-corpus.h | ||
abg-diff-utils.h | ||
abg-dwarf-reader.h | ||
abg-fwd.h | ||
abg-hash.h | ||
abg-ini.h | ||
abg-interned-str.h | ||
abg-ir.h | ||
abg-libxml-utils.h | ||
abg-libzip-utils.h | ||
abg-reader.h | ||
abg-reporter.h | ||
abg-sptr-utils.h | ||
abg-suppression.h | ||
abg-tools-utils.h | ||
abg-traverse.h | ||
abg-version.h.in | ||
abg-viz-common.h | ||
abg-viz-dot.h | ||
abg-viz-svg.h | ||
abg-workers.h | ||
abg-writer.h | ||
Makefile.am |