* src/abg-dwarf-reader.cc (lookup_symbol_from_elf): If in
demangling mode, do not use ELF hash tables.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (find_symbol_table_section): Return the
.symtab if we are looking at an executable or relocatable file and
.dynsym if we are looking at a DSO.
(find_symbol_table_section_index): Likewise. Implement this in
terms of find_symbol_table_section.
(build_{function,var}_decl): Set the linkage_name to the symbol
name, if the symbol name is not empty.
* tests/data/test-diff-filter/test9-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (corpus_diff::report): Remove the
redundant "'" from the linkage names in the diff.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (get_linkage_name): Remove.
* include/abg-dwarf-reader.h (enum symbol_type)
(enum symbol_binding): Move these into abg-ir.h.
(lookup_symbol_from_elf, lookup_public_function_symbol_from_elf):
Adjust.
* src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr):
Declare this before using it.
(die_address_attribute, die_location_address)
(stt_to_elf_symbol_type, stb_to_elf_symbol_binding)
(find_hash_table_section_index, find_symbol_table_section)
(find_symbol_table_section_index, find_text_section)
(find_bss_section, compare_symbol_name)
(get_symbol_versionning_sections get_version_for_symbol)
(lookup_symbol_from_sysv_hash_tab)
(lookup_symbol_from_gnu_hash_tab, get_elf_class_size_in_bytes)
(bloom_word_at, setup_gnu_ht, lookup_symbol_from_elf_hash_tab)
(lookup_symbol_from_symtab, maybe_adjust_fn_sym_address)
(maybe_adjust_var_sym_address): New static functions.
(enum hash_table_kind): New enum.
(struct gnu_ht): New struct.
(read_context::var_decls_to_add_): Renamed var_decls_to_add into
this.
(read_context::{fun, var}_sym_addr_sym_index_map_): New member.
(read_context::{lookup_symbol_from_elf,
lookup_elf_symbol_from_index, lookup_elf_fn_symbol_from_address,
lookup_elf_var_symbol_from_address, fun_sym_addr_sym_index_map,
var_sym_addr_sym_index_map, load_symbol_addr_to_index_maps,
get_function_address, get_variable_address}): New member
functions.
(read_context::lookup_public_{variable,
function}_symbol_from_elf): Adjust.
(op_pushes_constant_value): Fix a bug here.
(lookup_symbol_from_elf): Adjust. Support cases where there is no
elf hash table, e.g, for relocatable files.
(lookup_public_function_symbol_from_elf)
(lookup_public_variable_symbol_from_elf): Adjust.
(build_var_decl): Allow updating the var_decl to associate it with
its underlying symbol. In that case, if the linkage name is not
set, set it to the symbol name.
(build_function_decl): Likewise for function_decl.
(operator<<(std::ostream&, symbol_type)):
(operator<<(std::ostream&, symbol_binding)): Move these do
abg-ir.cc.
* include/abg-ir.h (class elf_symbol): Declare new class. Move
enum symbol_binding and enum symbol_type (from abg-dwarf-reader.h) to
elf_symbol::binding and elf_symbol::type here.
(operator<<(std::ostream&, elf_symbol::type))
(operator<<(std::ostream&, elf_symbol::binding))
(operator==(const elf_symbol_sptr, const elf_symbol_sptr)): New
operators.
(class elf_symbol::version): Declare new class.
(class var_decl): Make this pimpl, and add ...
(var_decl::{g,s}et_symbol): ... new member functions.
(class function_decl): Likewise, make this pimpl and add ...
(function_decl::{g,s}et_symbol): ... new member functions.
* src/abg-ir.cc (struct elf_symbol, elf_symbol::priv): New
types.
(elf_symbol::*): Lots of new members and member functions.
(operator==(const elf_symbol_sptr, const elf_symbol_sptr)): New.
(operator<<(std::ostream&, elf_symbol::type)): New.
(operator<<(std::ostream&, elf_symbol::binding)): New.
(elf_symbol::version::priv): New type.
(elf_symbol::version::*): Lots of member functions.
(get_linkage_name): Removed.
(var_decl::priv): New type. Pimplify the thing.
(var_decl::{s,g}et_symbol): New.
(var_decl::operator==): Take symbols in account in the comparison.
(function_decl::priv): New type.
(function_decl::*): Pimplify.
(function_decl::{s,g}et_symbol): New.
(function_decl::operator==): Take symbols in account in the
comparison.
* include/abg-comparison.h (diff_context::show_linkage_name): New
member function.
* src/abg-comparison.cc (diff_context::priv::show_linkage_name_):
New member.
(diff_context::priv::priv): Initialize it.
(diff_context::show_linkage_names): New member function.
(corpus_diff::report): If the user used --show-linkage-names,
display the linkage name after the name of the functions. Add
missing "'" in the some spots.
* tools/bidiff.cc (options.show_linkage_names): New member.
(display_usage, parse_command_line): Support --linkage-names.
* tools/bisym.cc (show_help): Add '\n' at the end of help string
for --demangle. Add --no-absolute-path option.
(parse_command_line): Support --no-absolute-path.
(main): Adjust for symbol (versionning) support. Consider that
the program successfully completed even when the symbol wasn't
found. Support --no-absolute-path.
* tests/data/test-lookup-syms/test0-report.txt: New.
* tests/data/test-lookup-syms/test01-report.txt: New.
* tests/data/test-lookup-syms/test02-report.txt: New.
* tests/data/test-read-dwarf/test0.abi: Adjust.
* tests/data/test-read-dwarf/test1.abi: Adjust.
* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
* tests/data/test-diff-filter/test10-report.txt: Adjust.
* tests/data/test-diff-filter/test12-report.txt: Adjust.
* tests/data/test-lookup-syms/test1-[123]-report.txt: New.
* tests/data/test-lookup-syms/test1.c: New.
* tests/data/test-lookup-syms/test1.version-script: New.
* tests/test-lookup-syms.cc: Adjust for new tests.
* test/Makefile.am: Adjust makefile.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-corpus.cc (corpus_priv::build_symbol_table): If a
function or variable symbol is not public (global or weak) and
present in an elf symbol table, drop it from the corpus symbol
table. As a result functions are variables (not present in the
elf symbol tables) that we were previously taking in account are
not dropped on the floor, leading to much less noise.
* tests/data/test-diff-dwarf/test0-v0.cc: Update to avoid
generating inline functions.
* tests/data/test-diff-dwarf/test0-v0.o: Likewise.
* tests/data/test-diff-dwarf/test0-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test0-v1.o: Likewise.
* tests/data/test-diff-dwarf/test7-v0.o: Likewise.
* tests/data/test-diff-dwarf/test7-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test7-v1.o: Likewise.
* tests/data/test-diff-dwarf/test8-v0.cc: Likewise.
* tests/data/test-diff-dwarf/test8-v0.o: Likewise.
* tests/data/test-diff-dwarf/test8-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test8-v1.o: Likewise.
* tests/data/test-diff-filter/test0-v0.cc: Likewise.
* tests/data/test-diff-filter/test0-v0.o: Likewise.
* tests/data/test-diff-filter/test0-v1.cc: Likewise.
* tests/data/test-diff-filter/test0-v1.o: Likewise.
* tests/data/test-diff-filter/test10-v0.cc: Likewise.
* tests/data/test-diff-filter/test10-v0.o: Likewise.
* tests/data/test-diff-filter/test10-report.txt: Likewise.
* tests/data/test-diff-filter/test10-v1.o: Likewise.
* tests/data/test-diff-filter/test13-v0.cc: Likewise.
* tests/data/test-diff-filter/test13-v0.o: Likewise.
* tests/data/test-diff-filter/test13-v1.cc: Likewise.
* tests/data/test-diff-filter/test13-v1.o: Likewise.
* tests/data/test-diff-filter/test2-v0.cc: Likewise.
* tests/data/test-diff-filter/test2-v0.o: Likewise.
* tests/data/test-diff-filter/test2-v1.cc: Likewise.
* tests/data/test-diff-filter/test2-v1.o: Likewise.
* tests/data/test-diff-filter/test4-v0.cc: Likewise.
* tests/data/test-diff-filter/test4-v0.o: Likewise.
* tests/data/test-diff-filter/test4-v1.cc: Likewise.
* tests/data/test-diff-filter/test4-v1.o: Likewise.
* tests/data/test-diff-filter/test9-v0.o: Likewise.
* tests/data/test-diff-filter/test9-v1.cc: Likewise.
* tests/data/test-diff-filter/test9-v1.o: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (build_var_decl): Support adding
properties to an existing var_decl. For now just add mangled
name.
(build_ir_node_from_die): Accept DW_TAG_member too. This helps
for when this function is used to add additional properties to an
existing DW_TAG_member representing a static data member. Then,
use build_var_decl to really add the value of the additional
mangled name property.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (corpus_diff::report): Display the pretty
representation of the variable, no matter what.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (build_var_decl, build_function_decl):
Set the "is_in_public_symbol_table" property for the variable or
function decl.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-dwarf-reader.h (symbol_type, symbol_binding): New
enums.
(operator<<): Declare new overloads for the new enums above.
(lookup_symbol_from_elf, lookup_public_function_symbol_from_elf):
Declare new entry points.
* src/abg-dwarf-reader.cc (lookup_symbol_from_elf)
(lookup_public_function_symbol_from_elf)
(lookup_public_variable_symbol_from_elf): Define new static
functions.
(read_context::elf_{module_, handle}_): New data members.
(read_context::{elf_module, elf_handle}): New accessors.
(read_context::load_debug_info): Store the elf module into
read_context::_elf_module_. Adjust.
(read_context::{lookup_symbol_from_elf,
lookup_public_function_symbol_from_elf,
lookup_public_variable_symbol_from_elf}): New member functions.
(lookup_symbol_from_elf, lookup_public_function_symbol_from_elf)
(operator<<): Define public entry points.
* tools/bisym.cc: New tool to lookup a symbol in an elf file.
* tools/Makefile.am: Add the bisym.cc source file to the
distribution and arrange to compile it into a 'bisym' executable.
* tests/test-lookup-syms.cc: New test harness.
* tests/data/test-lookup-syms/test0-report.txt: New test input
for the harness above.
* tests/data/test-lookup-syms/test0.cc: Likewise.
* tests/data/test-lookup-syms/test0.o: Likewise
* tests/data/test-lookup-syms/test01-report.txt: Likewise.
* tests/data/test-lookup-syms/test02-report.txt: Likewise.
* tests/Makefile.am: Build the new runtestlookupsyms test and add
the new files to the distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-corpus.h (enum corpus::origin): New enum.
(corpus::{g,s}et_origin): New accessors.
* src/abg-corpus.cc (corpus::priv::origin): New data member.
(corpus::priv::is_symbol_table_built): Move this up.
(corpus::priv::priv): Adjust.
(corpus::{g,s}et_origin): Define accessors.
* src/abg-dwarf-reader.cc (read_corpus_from_elf): Set the corpus
origin. Also set the path. Oops.
* src/abg-reader.cc (read_corpus_from_input)
(read_corpus_from_archive): Set the corpus origin.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (is_at_global_scope): Declare a new overload.
(get_linkage_name): Declare ...
* src/abg-ir.cc (get_linkage_name): ... these new entry points.
(is_at_global_scope): Define these new overloads useful for the
new get_linkage_name.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h (class_diff::{deleted, inserted,
changed}_bases): Declare new member functions ...
* src/abg-comparison.cc ((class_diff::{deleted, inserted,
changed}_bases)): ... and define them.
* src/abg-comp-filter.cc (base_classes_added_or_removed): Define
new static functions.
(harmless_filter): Categorize base classes added or removed.
* tests/data/test-diff-dwarf/test8-report.txt: New test input.
* tests/data/test-diff-dwarf/test8-v0.cc: Likewise.
* tests/data/test-diff-dwarf/test8-v0.o: Likewise.
* tests/data/test-diff-dwarf/test8-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test8-v1.o: Likewise.
* tests/data/test-diff-filter/test13-report.txt: New test input.
* tests/data/test-diff-filter/test13-v0.cc: Likewise.
* tests/data/test-diff-filter/test13-v0.o: Likewise.
* tests/data/test-diff-filter/test13-v1.cc: Likewise.
* tests/data/test-diff-filter/test13-v1.o: Likewise.
* tests/Makefile.am: Add the new files above to the source distribution.
* tests/test-diff-dwarf.cc: Use the new relevant input above to
run more tests.
* tests/test-diff-filter.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (class_diff::report): For base classes,
report their pretty representation. Do not try to report a the
diff of a changed base class that got filtered out. Avoid
emitting too many vertical white spaces.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comp-filter.cc (harmful_filter::visit): Now that
type_size_changed is correctly geared to not be fulled by
decl-only classes, there is no need for its caller to handle that
case. And data_member_offset_changed ain't affected by decl-only
classes anyway. So the code is now much simpler.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (get_scope_for_die): Do not drop a DIE
on the floor just because it is in the scope of a function. We
were dropping a function parameter because its type is a typedef
defined right before the parameter, in the scope of the function.
Urgh. So with this change, that function parameter is not dropped
anymore. I have seen that happening in a DWARF generated by GCC
4.7.1 on libstdc++.so. Hard to come up with a regression test
case for this one.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (decls_equal::operator()(const decls_type,
const decls_type)): Kill dead code. Note that there is a proper
equality operator for decl_base_sptr already.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-comparison.h
(diff_category::STATIC_DATA_MEMBER_CHANGE_CATEGORY): New category.
(diff_category::EVERYTHING_CATEGORY): Update
* src/abg-comp-filter.cc (static_data_member_type_size_changed)
(static_data_member_added_or_removed): Define new static
functions.
(harmless_filter::visit): Categorize changes to static data
members as STATIC_DATA_MEMBER_CHANGE_CATEGORY.
* tools/bidiff.cc (set_diff_context_from_opts):
STATIC_DATA_MEMBER_CHANGE_CATEGORY is falls into the harmless
group.
* tests/data/test-diff-filter/test12-report.txt: New test input.
* tests/data/test-diff-filter/test12-v0.cc: Likewise.
* tests/data/test-diff-filter/test12-v0.o: Likewise.
* tests/data/test-diff-filter/test12-v1.cc: Likewise.
* tests/data/test-diff-filter/test12-v1.o: Likewise.
* tools/bidiff.cc: Run this test with the additional input data
above.
* tests/Makefile.am: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comp-filter.cc
(non_static_data_member_type_size_changed): Renamed
data_member_offset_changed into this. Make sure the test detects
changes on *non-static* data members only.
(non_static_data_member_added_or_removed): Likewise for
data_member_offset_changed that got renamed into this.
(harmful_filter::visit): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Let's
consider that a data member being not laid out (i.e, not having a
data_member_location) is is a static data member. Otherwise, we
were not detecting static data members at all. Well we were only
inferring their presence from seeing the static variable
definition later on. That means we were missing most of the
static variables. Woops.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Now that we
are really seeing static data members, let's be prepare to the
fact that we can the same static data member being declared
several times in a corpus.
* tests/data/test-diff-dwarf/test7-report.txt: New test input file.
* tests/data/test-diff-dwarf/test7-v0.cc: Likewise.
* tests/data/test-diff-dwarf/test7-v0.o: Likewise.
* tests/data/test-diff-dwarf/test7-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test7-v1.o: Likewise.
* tests/test-diff-dwarf.cc: Update this to consume the new test
input files.
* tests/Makefile.am: Update this to add the missing test files to
the source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (get_global_scope()): New overload for const
decl_base&. Move the other overloads up in the file.
(get_translation_unit): Add an overload for decl_base&. Constify
the others.
(dump_decl_location): Declare new functions.
* src/abg-ir.cc (get_global_scope): Define the overload for const
decl_base&. Write the other overloads in terms of this one.
(get_translation_unit): Likewise, define the overload for const
decl_base&. Write the other overloads in terms of this one.
(dump_decl_location): Define these new overloads.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-writer.cc (dump(const decl_base_sptr, std::ostream&)):
Do not dump the content to cerr here. Rather dump to the output
stream given in parameter. Oops.
(dump(const translation_unit&, std::ostream&)): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comp-filter.cc (has_virtual_mem_fn_change): A virtual
member that gets deleted and added back again to the same vtable
offset is not considered as being a virtual member function change
suitable for VIRTUAL_MEMBER_CHANGE_CATEGORY. Likewise for a
function sub-type change not involving a change in the vtable
offset.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comp-filter.cc (there_is_a_decl_only_class)
(diff_involves_decl_only_class): New static functions.
(type_size_changed, data_member_added_or_removed)
(has_virtual_mem_fn_change, has_non_virtual_mem_fn_change): Bail
out if one of the types involved is a decl-only class.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc
(class_diff::ensure_lookup_tables_populated): If the first version
of the member function decl doesn't have a mangled name while the
second has it, try the lookups using the pretty representation of
the function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (represent_data_member(var_decl_sptr,
ostream&)): If the data member is static, do not try to represent
its offset.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (represent_data_member(var_decl_sptr,
ostream&)): If the data member is static do not check for it
having been laid out.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-ir.cc (var_decl::get_pretty_representation): Prefix
pretty representation of static data members with 'static'.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (qualified_type_def::get_size_in_bits): Declare
new member function ...
* src/abg-ir.cc (qualified_type_def::get_size_in_bits): ... and
define it. Keep in mind that some times the size of the
underlying type can change between the moment the qualified type
is created and the end of its life time. That is because a
subsequent DIE (from DWARF) can alter the size of the underlying
type. This overload allows the user to always query the size of
the underlying type and keep the size of the qualified type in
sync with it.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (pointer_diff::report): If the pointer
diff node is deemed to be reported then the underlying diff node
should be reported as well.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comp-filter.cc (harmful_filter::visit): Factorize the
categorization into SIZE_OR_OFFSET_CHANGE_CATEGORY for data member
adding or removal and for data member type size change.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (diff::is_filtered_out): Now that we seem
to be flagging every changes to a class into a category, we do not
need to dive into reporting a diff not that is categorized as
NO_CHANGE_CATEGORY anymore. So let's have the implementation that
one would expect for this function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comp-filter.cc (has_virtual_mem_fn_change): New static
function.
(harmful_filter): Categorize changes to virtual member functions
into VIRTUAL_MEMBER_CHANGE_CATEGORY.
* src/abg-comparison.cc
(class_diff::priv::count_filtered_changed_dm): Move this up, right
after class_diff::priv::count_filtered_subtype_changed_dm.
(SKIP_MEM_FN_IF_VIRTUALITY_DISALLOWED): New macro.
(class_diff::priv::count_filtered_{changed, inserted,
deleted}_mem_fns): Modify these to properly take member function
virtual-ness in account.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc
(class_diff::ensure_lookup_tables_populated): Use the virtual
member functions here, not the member functions in general.
(compute_diff): Consider virtual member functions only, not
non-virtual ones.
* src/abg-ir.cc (class_decl::operator==): Do not compare
non-virtual member functions. Only compare virtual member
functions.
* tests/data/test-bidiff/test-struct1-report.txt: New test input.
* tests/data/test-diff-dwarf/test0-report.txt: New test input.
* tests/data/test-diff-filter/test0-report.txt: New test input.
* tests/data/test-diff-filter/test01-report.txt: New test input.
* tests/data/test-diff-filter/test10-report.txt: New test input.
* tests/data/test-diff-filter/test11-report.txt: New test input.
* tests/data/test-diff-filter/test2-report.txt: New test input.
* tests/data/test-diff-filter/test9-report.txt: New test input.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (set_member_function_is_virtual): Declare new
function.
* include/abg-ir.h (class class_decl): Declare
set_member_function_is_virtual and member_function_is_virtual as
friends of class_decl.
(class_decl::add_member_function): Take an is_virtual flag.
(class_decl::get_num_virtual_functions): Remove.
(class_decl::get_virtual_mem_fns): New member function.
(mem_fn_context_rel::is_virtual_): New member.
(mem_fn_context_rel::mem_fn_context_rel): Adjust to initialize the
new is_virtual_ member.
(mem_fn_context_rel::is_virtual): New member functions.
* src/abg-comparison.cc (represent): Adjust.
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Adjust.
* src/abg-ir.cc (member_function_is_virtual): Change this to use
mem_fn_context_rel::is_virtual.
(set_member_function_is_virtual): Define this new function.
(class_decl::priv::virtual_mem_fns_): New member to hold virtual
member functions.
(class_decl::get_virtual_mem_fns): Implement this member function.
(class_decl::get_num_virtual_functions): Remove.
(class_decl::add_member_function): Take a new is_virtual flag.
Add virtual member functions to
class_decl::priv::virtual_mem_fns_.
* src/abg-reader.cc (build_class_decl): Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-fwd.h (member_function_is_virtual): Declare new
function.
* include/abg-comparison.h
(diff_category::{NON_VIRT_MEM_FUN_CHANGE_CATEGORY,
VIRTUAL_MEMBER_CHANGE_CATEGORY}): New enumerators.
(diff_category::EVERYTHING_CATEGORY): Adjust.
(class_diff::{changed, deleted, inserted}_member_fns): Declare new
member functions.
* src/abg-comp-filter.cc (data_member_added_or_removed): Add
missing comments.
(has_non_virtual_mem_fn_change): New static predicate function.
(harmless_filter::visit): Categorize non-virtual member function
changes in a diff into NON_VIRT_MEM_FUN_CHANGE_CATEGORY.
* src/abg-comparison.cc
(TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY): New macro.
(report_mem_header): Count filtered functions for added/deleted
functions as well.
(class_diff::priv::count_filtered_changed_mem_fns): Renamed
priv::count_filtered_member_functions into this. Filter out
changes to non-virtual member functions here.
(class_diff::priv::count_filtered_{inserted, deleted}_mem_fns):
New member functions.
(class_diff::{deleted, inserted, changed}_member_fns): Define new
member functions.
(class_diff::report): Adjust count for filtered inserted/deleted
member functions. Do not report NON_VIRT_MEM_FUN_CHANGE_CATEGORY
if it's disallowed.
(class_diff::traverse): Propagate only
VIRTUAL_MEMBER_CHANGE_CATEGORY from member functions to their
enclosing class.
* src/abg-ir.cc (member_function_is_virtual): Define new
functions.
* tools/bidiff.cc (set_diff_context_from_opts): Adjust to add
NON_VIRT_MEM_FUN_CHANGE_CATEGORY into the harmless group and
VIRTUAL_MEMBER_CHANGE_CATEGORY into the harmful one.
* tests/data/test-diff-filter/test0-report.txt: New test input.
* tests/data/test-diff-filter/test10-report.txt: Likewise.
* tests/data/test-diff-filter/test10-v0.cc: Likewise.
* tests/data/test-diff-filter/test10-v0.o: Likewise.
* tests/data/test-diff-filter/test10-v1.cc: Likewise.
* tests/data/test-diff-filter/test10-v1.o: Likewise.
* tests/data/test-diff-filter/test11-report.txt: Likewise.
* tests/data/test-diff-filter/test11-v0.cc: Likewise.
* tests/data/test-diff-filter/test11-v0.o: Likewise.
* tests/data/test-diff-filter/test11-v1.cc: Likewise.
* tests/data/test-diff-filter/test11-v1.o: Likewise.
* tests/data/test-diff-filter/test2-report.txt: Likewise.
* tests/data/test-diff-filter/test9-report.txt: Likewise.
* tests/data/test-diff-filter/test9-v0.cc: Likewise.
* tests/data/test-diff-filter/test9-v0.o: Likewise.
* tests/data/test-diff-filter/test9-v1.cc: Likewise.
* tests/data/test-diff-filter/test9-v1.o: Likewise.
* tests/test-diff-filter.cc: Consume the test input above to run
more tests.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* include/abg-ir.h (class_decl::{priv}): New private data member.
(class_decl::{get_is_declaration_only, set_is_declaration_only,
is_struct, get_definition_of_declaration, get_earlier_declaration,
add_base_specifier, get_base_specifiers, get_member_types,
get_data_members, get_member_functions,
get_member_function_templates, get_member_class_templates}): Move
these methods out-of-line.
(class_decl::{comparison_started_,
declaration_,is_declaration_only_, definition_of_declaration,
is_struct_, bases_, member_types_, data_members_,
member_functions_, member_function_template,
member_class_templates_}): Move these data members into the pimpl
in ...
* src/abg-ir.cc
(class_decl::priv::{declaration_,is_declaration_only_,
definition_of_declaration, is_struct_, bases_, member_types_,
data_members_, member_functions_, member_function_template,
member_class_templates_}): ... here.
(class_decl::priv::classes_being_compared_): New data member.
(class_decl::priv::priv): Initialize the data members.
(class_decl::priv::{mark_as_being_compared,
unmark_as_being_compared, comparison_started): New methods.
(class_decl::{get_is_declaration_only, set_is_declaration_only,
is_struct, get_definition_of_declaration, add_base_specifier,
get_base_specifiers, get_member_types, get_data_members,
get_member_functions, get_member_function_templates,
get_member_class_templates}): Move these out-of-line in here.
(class_decl::{class_decl, set_definition_of_declaration,
set_earlier_declaration, insert_member_type, add_member_type,
add_data_member, add_member_function,
add_member_function_template, add_member_class_template,
has_no_base_nor_member}): Adjust.
(class_decl::operator==): Harden inf-loop prevention during class
comparison using the new priv::mark/unmark_as_being_compared()
functions. Now comparison of a class really compares member
functions again. And it is *slooow*. I should probably change
this to compare only virtual member functions. But at least this
should be correct and robust for now.
* tests/data/test-diff-filter/test0-report.txt: Adjust.
* test01-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>