Commit Graph

184 Commits

Author SHA1 Message Date
Dodji Seketeli
c4e7f9792d Harden debug info path management & better error reporting
* include/abg-dwarf-reader.h (enum status): New enum.
	(read_corpus_from_elf): Return an instance of status above, and
	return the corpus by parameter.
	* src/abg-dwarf-reader.cc (create_default_dwfl): Add a comment
	about elfutils wanting the Dwfl_Callbacks::debuginfo_path to be an
	absolute path.
	(read_corpus_from_elf): Return an instance of status above, and
	return the corpus by parameter.
	* tools/abg-tools-utils.h (make_path_absolute): Declare new function.
	* tools/abg-tools-utils.cc (make_path_absolute): New
	implementation.
	* tools/bidiff.cc (options::di_root_path[12]): Make these be
	shared pointers.
	(parse_command_line): ensure the debug info root paths are
	absolute.
	(main): Adjust.  Give meaningful errors when the debug info or
	symbol files couldn't be read.
	* tools/bidw.cc (options::di_root_path): Make this be a shared
	pointer.
	(parse_command_line): Ensure the debug info root path is absolute.
	(main): Adjust.  Give meaningful errors when the debug info or
	symbol files couldn't be read.
	* tools/bilint.cc (options::di_root_path): Make this be a shared
	pointer.
	(parse_command_line): Ensure the debug info root path is absolute.
	(main): Adjust.  Give meaningful errors when the debug info or
	symbol file couldn't be read.
	* tests/test-diff-dwarf.cc (main): Adjust.
	* tests/test-read-dwarf.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-06-04 16:30:18 +02:00
Dodji Seketeli
76bfae5aac Ensure added/removed member functions have their symbols added/removed
* include/abg-comparison.h (diff_context::{set_corpora,
	get_first_corpus, get_second_corpus}): Declare new member
	functions.
	* src/abg-comparison.cc (diff_context::{set_corpora,
	get_first_corpus, get_second_corpus}): Define them.
	(compute_diff): In the overload for corpus_sptr stick the corpora
	being compared, into the diff context.
	(class_diff::ensure_lookup_tables_populated): If a member function
	is allegedly removed, check that its underlying symbol is removed
	from the corpus as well.  Otherwise, consider that the member
	function hasn't been removed.  Likewise, if a member function is
	allegedly added, check that its underlying symbol has been added
	to the corpus as well.  Otherwise, consider that the member
	function hasn't been added.  The symbols can now be accessed
	through the two corpora that are now present in the diff context.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-29 18:15:48 +02:00
Dodji Seketeli
e2d450176b Add a symbol database to the ABI Corpus & support symbol aliases
* include/abg-corpus.h (corpus::{g,s}et_{fun,var}_symbol_map{_sptr}):
	Declare new accessors.
	(corpus::lookup_{variable,function}_symbol): Declare new member
	functions.
	* src/abg-corpus.cc (corpus::{g,s}et_{fun,var}_symbol_map{_sptr}):
	Define new accessors.
	(corpus::lookup_{variable,function}_symbol): Define new member
	functions.
	* include/abg-ir.h (string_elf_symbol_sptr_map_type)
	(string_elf_symbol_sptr_map_sptr, elf_symbols)
	(string_elf_symbols_map_type, string_elf_symbols_map_sptr): New
	convenience typedefs.
	(elf_symbol::{get_main_symbol, is_main_symbol, get_next_alias,
	has_aliases, add_alias, get_id_string,
	get_name_and_version_from_id, operator=}): Declare new member
	functions.
	* src/abg-ir.cc (elf_symbol::{get_main_symbol, is_main_symbol,
	get_next_alias, has_aliases, add_alias, get_id_string,
	get_name_and_version_from_id, operator=}): Define new member
	functions.
	* include/abg-reader.h (read_corpus_from_file): Take a shared
	pointer to corpus.
	* src/abg-reader.cc (read_context::{g,s}et_corpus): Define these.
	(build_elf_symbol_db, build_elf_symbol_from_reference)
	(read_symbol_db_from_input): Define new functions.
	(read_corpus_from_input): Adjust.  Make it read symbol databases.
	(build_elf_symbol): Harden this.
	(build_{var,function}_decl): Read the symbol reference.  Do not
	read the local symbol serialization anymore.
	(read_corpus_from_archive): Adjust.
	(read_corpus_from_file): Take a reference to a shared pointer to
	corpus, rather than a reference to the corpus.
	(read_corpus_from_native_xml): Only keep the overload that returns
	a corpus.  Set the current context with the corpus.
	* src/abg-dwarf-reader.cc (addr_elf_symbol_sptr_map_type)
	(addr_elf_symbol_sptr_map_sptr): New convenience typedefs.
	(read_context::{fun_sym_addr_sym_index_map_,
	var_sym_addr_sym_index_map_): Remove.
	(read_context::{fun,var}_addr_sym_map_): New.  Replace the above
	that got removed.
	(read_context::{var,fun}_syms_): New.
	(read_context::lookup_elf_{fn,var}_symbol_from_address): Adjust.
	(read_context::{fun,var}_addr_sym_map{_sptr}): New.
	(read_context::{fun,var}_syms{_sptr}): New.
	(read_context::load_symbol_maps): Replace
	read_context::load_symbol_addr_to_index_maps.  Adjust to load all
	the new maps.
	(read_context::maybe_load_symbol_maps): New.
	(read_debug_info_into_corpus): Renamed build_corpus into this.
	Update to load symbol maps and set it to the corpus.
	* src/abg-writer.cc (write_context::get_fun_symbol_map): New
	accessor.
	(write_elf_symbol_aliases, write_elf_symbol_reference)
	(write_elf_symbols_table): Define new static functions.
	(write_var_decl): Write the reference to the underlying symbol of
	the variable.  Do not write the full symbol here anymore.
	(write_function_decl):  Likewise, write the reference to the
	underlying symbol of the function.  Do not write the full symbol
	here anymore.
	(write_corpus_to_native_xml): Write the symbol databases at the
	beginning of the corpus document.
	* src/abg-comparison.cc
	(corpus_diff::priv::ensure_lookup_tables_populated): Now that the
	corpus has symbols, check if a the symbol of an allegedly deleted
	function (resp. variable) is deleted; if not, then do not report
	the function (resp. variable) as deleted.  Similarly, check if the
	symbol of an allegedly added function (resp. variable) is added.
	if not, the do not report the function (resp. variable) as added.
	* tests/test-write-read-archive.cc (main): Adjust.
	* tools/biar.cc (extract_tus_from_archive): Likewise.
	* tests/data/test-diff-filter/test9-report.txt: Adjust.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test2.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-28 16:33:35 +02:00
Dodji Seketeli
cf80e9d378 Support debug info files being outside the expected system directories
* include/abg-dwarf-reader.h (read_corpus_from_elf): Take a
	debug_info_root_path parameter.
	src/abg-dwarf-reader.cc (create_default_dwfl): Take a
	debug_info_root_path.  Use that to initialize the Dwfl_Callbacks
	structure used by dwfl_begin.
	(create_default_dwfl_sptr, read_corpus_from_elf): Likewise, Take a
	debug_info_root_path parameter.
	* tests/test-diff-dwarf.cc (main): Adjust.
	* tests/test-read-dwarf.cc (main): Likewise.
	* tools/bidiff.cc (options::dir_root_path[12]): New member.
	(options::options): Initialize it.
	(display_usage): Add help string for the --debug-info-dir[12]
	options.
	(parse_command_line): Handle the new --debug-info-dir[12] options.
	(main): Pass the debug info directories to read_corpus_from_elf.
	* bidw.cc (options::::di_root_path): New member.
	(options::options): Initialize it.
	(display_usage): Add help string for the new --debug-info-dir
	option.
	(parse_command_line): Handle the new --debug-info-dir.
	(main): Pass the debug info root path to read_corpus_from_elf.
	* tools/bilint.cc (options::di_root_path): New member.
	(options::options): Initialize it.
	(display_usage): Add help string for the new --debug-info-dir.
	(parse_command_line): Handle --debug-info-dir command line option.
	(main): Pass the debug info root path to read_corpus_from_elf.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-22 13:14:44 +02:00
Dodji Seketeli
4d0de72a85 Support decl cloning when seeing DW_AT_abstract_origin
* include/abg-ir.h ({var,function}_decl::clone): New method.
	* src/abg-dwarf-reader.cc (die_die_attribute): Add a flag to avoid
	looking through DW_AT_abstract_origin attribute here.
	(build_function_decl): Set the linkage name from
	DW_AT_linkage_name if it's not set yet.
	(build_ir_node_from_die): For DW_TAG_{variable,subprogram}, when
	we see DW_AT_abstract_origin, clone the decl they refer to.
	Also, avoid dropping the DIE on the floor just because it doesn't
	have die_is_artificial here.
	* src/abg-ir.cc ({var,function}_decl::clone): Implement this.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-20 18:22:14 +02:00
Dodji Seketeli
335d8786b2 Serialize and de-serialize elf symbols for var & function decls
* abg-ir.h (string_to_elf_symbol_type, string_to_elf_symbol_binding):
	Declare new entry points.
	* src/abg-ir.cc (string_to_elf_symbol_type)
	(string_to_elf_symbol_binding): Define new entry points.
	* include/abg-libxml-utils.h (xml_char_sptr_to_string): Declare
	new entry points.
	* src/abg-libxml-utils.cc (xml_char_sptr_to_string): Define new
	entry points.
	* src/abg-reader.cc (read_elf_symbol_type)
	(read_elf_symbol_binding, build_elf_symbol): Define new static
	functions.
	(build_function_decl, build_var_decl): Use the new
	build_elf_symbol and set the symbol to the function.  Flag the
	function as having a public symbol in the symbol table if the
	symbol is public.
	* src/abg-writer.cc (write_elf_symbol_type)
	(write_elf_symbol_binding, write_elf_symbol): Define new static
	functions.
	(write_var_decl, write_function_decl): Use the new
	write_elf_symbol to serialize the symbol for the decl.
	* tests/data/test-read-dwarf/test[01].abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-14 11:19:34 +02:00
Dodji Seketeli
ce1278c3da Initial support for elf symbol (versionning) during decl comparison
* 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>
2014-05-12 16:09:47 +02:00
Dodji Seketeli
bdf9e956d8 Rename decl_base::get_mangled_name into decl_base::get_linkage_name
* include/abg-ir.h (decl_base::get_linkage_name): Renamed
	decl_base::get_mangled_name into this.
	* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated)
	(function_decl_diff::report, type_decl_diff::report)
	(corpus_diff::priv::ensure_lookup_tables_populated)
	(corpus_diff::report, compute_diff): Adjust.
	* src/abg-corpus.cc ({var_comp, func_comp}::operator()): Likewise.
	(corpus::priv::build_symbol_table): Likewise.
	* src/abg-dwarf-reader.cc (die_linkage_name): Renamed
	die_mangled_name into this.
	(die_loc_and_name, build_translation_unit_and_add_to_ir)
	(build_namespace_decl_and_add_to_ir, build_type_decl)
	(build_enum_type, build_class_type_and_add_to_ir)
	(build_typedef_type, build_var_decl, build_function_decl, ): Adjust.
	* src/abg-hash.cc (decl_base:#️⃣:operator()): Likewise.
	* src/abg-ir.cc (decl_base::priv::linkage_name_): Renamed
	decl_base::priv::mangled_name_ into this.
	(decl_base::priv::priv, decl_base::{decl_base, operator==})
	(get_linkage_name, typedef_decl::typedef_decl, var_decl::var_decl)
	(function_decl::function_decl, class_decl::base_spec::base_spec)
	(class_decl::method_decl::method_decl): Adjust.
	(decl_base::{g,s}et_linkage_name): Renamed
	decl_base::{g,s}et_mangled_name into this.
	* src/abg-writer.cc (write_decl, write_typedef_decl)
	(write_var_decl, write_function_decl, dump): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-05-11 19:22:00 +02:00
Dodji Seketeli
12c777681d Support symbol lookups from ELF
* 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>
2014-04-21 17:56:40 +02:00
Dodji Seketeli
2ce2eff68e Add corpus::{s,g}et_origin accessors
* 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>
2014-04-21 17:22:11 +02:00
Dodji Seketeli
0d55047a4e Add a get_linkage_name function.
* 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>
2014-04-21 17:14:30 +02:00
Dodji Seketeli
e2c776f4bc Pimplify decl_base and add decl_base::{s,g}et_is_in_public_symbol_table
* include/abg-ir.h (struct decl_base::priv): New pimpl type.
	(decl_base::priv_): New pimpl.
	(decl_base::{hashing_started, peek_hash_value,
	peek_qualified_name, set_qualified_name}): Declare new protected
	methods.
	(decl_base::{get_context_rel, set_qualified_name, get_location,
	set_location, set_name, set_mangled_name, get_visibility,
	set_visibility}): Move these out-of-line.
	(decl_base::{g,s}et_is_public_symbol_table):
	(class_decl::hashing_started): Remove this as we now have
	decl_base::hashing_started.
	(decl_base::{hash_, hashing_started, location_, context_, name_,
	qualified_parent_name_, qualified_name_, mangled_name_,
	visibility_}): Move all these members into the new ...
	* src/abg-ir.cc (struct decl_base::priv): ... pimpl type.
	(decl_base::decl_base): Move these out-of-line here.  Adjust the
	other overloads.
	(decl_base::{hashing_started, peek_hash_value,
	peek_qualified_name, set_qualified_name}): Define these new
	protected methods.
	(decl_base::{get_context_rel, set_context_rel, get_location,
	set_location, set_name, get_mangled_name, set_mangled_name,
	get_visibility, set_visibility}): Define these out-of-line here.
	(decl_base::{get_hash, set_hash, get_scope,
	get_qualified_parent_name, get_qualified_name, operator==,
	set_scope}): Adjust.
	(qualified_type_def::get_qualified_name): Likewise.
	(pointer_type_def::get_qualified_name): Likewise.
	(reference_type_def::get_qualified_name): Likewise.
	(var_decl::set_scope): Likewise.
	(class_decl::base_spec): Likewise.
	(class_decl::method_decl::set_scope): Likewise.
	(decl_base::{g,s}et_is_in_public_symbol_table): Define new accessors.
	* src/abg-hash.cc ({decl_base, type_decl, scope_decl,
	scope_type_decl, qualified_type_def, pointer_type_def,
	reference_type_def, enum_type_decl, typedef_decl, var_decl,
	class_decl}:#️⃣:operator): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-21 17:13:46 +02:00
Dodji Seketeli
262c39f763 Categorize base class changes as SIZE_OR_OFFSET_CHANGE_CATEGORY
* 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>
2014-04-17 15:37:53 +02:00
Dodji Seketeli
e4820f9e33 File static data member changes in STATIC_DATA_MEMBER_CHANGE_CATEGORY
* 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>
2014-04-17 11:50:45 +02:00
Dodji Seketeli
fc6af95304 Fix typo in comments
* include/abg-comparison.h
	(diff_category::NON_VIRT_MEM_FUN_CHANGE_CATEGORY): Fix typo in
	comments.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-17 11:17:02 +02:00
Dodji Seketeli
c545e58b52 Add dumping routines for declaration location
* 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>
2014-04-16 17:09:49 +02:00
Dodji Seketeli
3ae24bafc3 Provide a robust way of getting the size of a qualified type
* 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>
2014-04-16 11:41:20 +02:00
Dodji Seketeli
8b93472231 Add more pretty printing facilities
* include/abg-comparison.h (get_pretty_representation(diff*)):
	Declare new function.
	* include/abg-fwd.h (get_pretty_representation): Declare functions
	for decl_base*, type_base*, decl_base_sptr and type_base_sptr.
	* src/abg-comparison.cc (get_pretty_representation): Implement
	this for diff*.
	* src/abg-ir.cc (get_pretty_representation): Define
	implementations for decl_base*, type_base*, decl_base_sptr and
	type_base_sptr.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-14 22:46:51 +02:00
Dodji Seketeli
99d3857ddd Recognize virtual member functions better and store them appart
* 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>
2014-04-14 14:56:51 +02:00
Dodji Seketeli
305f18e91e Filter non-virtual member fns insertions/deletions from class changes
* 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>
2014-04-13 23:09:02 +02:00
Dodji Seketeli
7ac2fe072d Make class_decl pimpl and harden comparison infloop prevention
* 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>
2014-04-13 22:09:24 +02:00
Dodji Seketeli
263fb9513c Remove the parent member of the diff node
* include/abg-comparison.h (diff::parent_): Remove.
	(diff::diff): Adjust.
	(diff::{get, set}_parent): Remove.
	* src/abg-comp-filter.cc (harmless_filter::visit): Remove category
	propagation to the parent.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-11 22:14:21 +02:00
Dodji Seketeli
f02768e7a7 Represent a removed+added data member at a given offset as changed
* include/abg-fwd.h (get_data_member_offset): Declare new overload for
	decl_base_sptr.
	* include/abg-comparison.h (unsigned_decl_base_sptr_map)
	(unsigned_changed_type_or_decl_map): New typedefs.
	* src/abg-ir.cc (get_data_member_offset): Define new overload for decl_base_sptr.
	* src/abg-comparison.cc (diff_kind::subtype_change_kind): New
	enumerator for a change about a type or sub-type of a member of a
	structure/enum.
	(report_mem_header): Handle the new enumerator above.
	(class_diff::priv::{deleted_dm_by_offset_, inserted_dm_by_offset_,
	changed_dm_}): New data members.
	(class_diff::priv::subtype_changed_dm_): Renamed
	class_diff::priv::changed_data_members_ into this.
	(class_diff::priv::subtype_changed_dm): Renamed
	class_diff::priv::data_member_has_changed into this. Adjust.
	(class_diff::count_filtered_subtype_changed_dm): Renamed
	count_filtered_data_members into this.  Adjust.
	(class_diff::priv::count_filtered_changed_dm): New member
	function.
	(class_diff::lookup_tables_empty): Adjust.
	(class_diff::ensure_lookup_tables_populated): Adjust.  Detect when
	a data member is deleted and added back to offset N, and be
	prepared to present that as a change of data member at offset N.
	(class_diff::report): Adjust.  Report data members of a given
	offset that have changed.
	* tests/data/test-diff-dwarf/test6-report.txt: New reference
	report for new test input.
	* tests/data/test-diff-dwarf/test6-v0.cc: Source code for new test
	input binary.
	* tests/data/test-diff-dwarf/test6-v0.o: New test input binary.
	* tests/data/test-diff-dwarf/test6-v1.cc: Source code for new test
	input binary.
	* tests/data/test-diff-dwarf/test6-v1.o: New test input binary.
	* tests/test-diff-dwarf.cc: Adjust to include the new test inputs above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-11 21:55:08 +02:00
Dodji Seketeli
13c6c8ebed Ensure that each diff node is traversed just once
* include/abg-comparison.cc (pointer_map): New typedef.
	(diff_context::{has_diff_for}): New overload for diff*.
	(diff_context::{diff_has_been_traversed, mark_diff_as_traversed,
	forget_traversed_diffs}): Declare new methods.
	* src/abg-comparison.cc (ENSURE_DIFF_NODE_TRAVERSED_ONCE)
	(ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): Define new macros.
	(diff_context::priv::traversed_diff_nodes_): New data member.
	(diff_context::has_diff_for): New overload for diff*
	(diff_context::{diff_has_been_traversed, mark_diff_as_traversed,
	forget_traversed_diffs}): Define new member functions.
	(diff_context::maybe_apply_filters): Forget the traversed diffs
	before applying a filter.
	({distinct_diff, var_diff, pointer_diff, reference_diff,
	qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff,
	function_decl_diff, type_decl_diff, typedef_diff,
	translation_unit_diff}::traverse): Ensure that the diff node is
	traversed only once.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-11 21:11:53 +02:00
Dodji Seketeli
bf52d83bfe Consider added/removed data members as changing size or offset
* src/abg-comp-filter.cc (data_member_added_or_removed): New
	static function.
	(harmless_filter::visit): Re-organize logic.  Categorize data
	member addition/removal into SIZE_OR_OFFSET_CHANGE_CATEGORY.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-10 15:07:24 +02:00
Dodji Seketeli
d25c8bbbaa Fix and add missing hashing through the virtual decl_base::get_hash
* include/abg-ir.h (struct {scope_decl, non_type_tparameter,
	type_composition, class_decl}::hash): Declare hashers.
	({scope_decl, var_decl, non_type_tparameter, type_composition,
	class_decl}::get_hash): Provide new overloads of the get_hash.
	* src/abg-hash.cc ({type_decl, scope_type_decl,
	qualified_type_def, pointer_type_def, reference_type_def,
	enum_type_decl, typedef_decl, var_decl,
	function_decl}:#️⃣:operator()): If the hash is being
	calculated, do not use the not-yet fully calculated hash value.
	Rather, calculate the hash, cache it and return the value.
	({class_decl, non_type_tparameter}:#️⃣:operator()): Moved the
	{class_decl, non_type_tparameter}::hash declaration out of here
	and stick it in include/abg-ir.h.  Keep the definition of the
	hashing operators here though.
	(type_composition:#️⃣:operator()): New operator definition.
	* src/abg-ir.cc ({scope_decl, var_decl, class_decl,
	non_type_tparameter, type_composition}::get_hash): Define new
	virtual overload.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-09 17:11:32 +02:00
Dodji Seketeli
793be5e374 Fix mis-hashing of base specifiers and function_decl during comparison
* include/abg-ir.h (function_decl::get_hash): Declare new virtual
	overload.
	* src/abg-hash.cc (class_decl::base_spec:#️⃣:operator()):
	Properly hash the base specifier so that it doesn't collide with
	hashing a class.
	* src/abg-ir.cc (decl_base::get_hash): Abort if we detect a
	missing overload for this;
	(function_decl::get_hash() const): Implement this missing
	overload, allowing using the virtual decl_base::get_hash for
	function_decl.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 15:56:18 +02:00
Dodji Seketeli
435f1520d7 Make type_base::get_{size,alignment}_in_bits virtual
* include/abg-ir.h (type_base::get_{size,alignment}_in_bits): Make
	this virtual.
	(typedef_decl::get_{size,alignment}_in_bits): Add new member
	functions.  Get the size,alignment from the underlying type and
	update the current size/alignment if they differ.  Keep in mind
	that the size of an underlying class_decl can change over its
	lifetime, given how the dwarf reader reads the type information,
	i.e, there can be a DIE for a class type with no size information
	that will lead to the creation of a class_decl with size zero.
	Later during the DWARF reading process, another DIE will
	supplement the type information, adding size information to that
	class_decl.  In between, a typedef_decl might have been created
	with the first version of the class_decl that has a zero size.  I
	guess this should be extended to the other type constructs that
	have an underlying type (qualified types, references and pointers).

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-07 10:08:10 +02:00
Dodji Seketeli
ce1df6ff33 Look through typedefs when setting SIZE_OR_OFFSET_CHANGE_CATEGORY
* include/abg-fwd.h (is_class_type): Declare new functions.
	* src/abg-comp-filter.cc (harmful_filter::visit): Use the above to
	convert a type into a class.
	* src/abg-ir.cc (is_class_type): Define the new function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-07 09:54:52 +02:00
Dodji Seketeli
23b7fa9ac2 Add a new DECL_NAME_CHANGE_CATEGORY change category
* include/abg-comparison.h (enum
	diff_category::DECL_NAME_CHANGE_CATEGORY): New enumerator.
	* src/abg-comparison.cc (report_name_size_and_alignment_changes)
	({enum, typedef}_diff::report): Adjust to avoid emitting name
	change report if the DECL_NAME_CHANGE_CATEGORY category of change
	is currently disallowed.
	* abg-comp-filter.cc (decl_name_changed): New static function.
	(harmless_filter::visit): Detect that the decl name changed and
	put the current diff node (and its parents) into the
	DECL_NAME_CHANGE_CATEGORY category.
	* tools/bidiff.cc (set_diff_context_from_opts): Set the new
	DECL_NAME_CHANGE_CATEGORY category into the harmless_changes group
	of categories.
	* tests/data/test-diff-filter/test6-report.txt: New test input file.
	* tests/data/test-diff-filter/test6-v0.cc: Likewise.
	* tests/data/test-diff-filter/test6-v0.o: Likewise.
	* tests/data/test-diff-filter/test6-v1.cc: Likewise.
	* tests/data/test-diff-filter/test6-v1.o: Likewise.
	* tests/data/test-diff-filter/test7-report.txt: Likewise.
	* tests/data/test-diff-filter/test7-v0.cc: Likewise.
	* tests/data/test-diff-filter/test7-v0.o: Likewise.
	* tests/data/test-diff-filter/test7-v1.cc: Likewise.
	* tests/data/test-diff-filter/test7-v1.o: Likewise.
	* tests/test-diff-filter.cc: Take the new inputs above to run new tests.
	* tests/Makefile.am: Add the new files above to the distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-06 15:59:38 +02:00
Dodji Seketeli
64bbb5ccef Add a COMPATIBLE_TYPE_CHANGE_CATEGORY to bidiff --no-harmless
* include/abg-comparison.h
	(diff_category::COMPATIBLE_TYPE_CHANGE_CATEGORY): New enumerator.
	(operator|=(diff_category&, diff_category)): New declaration.
	* include/abg-fwd.h (is_typedef, strip_typedef)
	(types_are_compatible): New declarations.
	* include/abg-ir.h (operator==(const decl_base_sptr, const
	decl_base_sptr)): Added the consts here.
	(operator==(const type_base_sptr, const type_base_sptr)): New
	declaration.
	* src/abg-comp-filter.cc (is_compatible_change): New static
	function.
	(harmless_filter::visit): Detect compatible changes and add the
	sub-tree into the new COMPATIBLE_TYPE_CHANGE_CATEGORY if
	applicable. Cleanup the logic.
	* src/abg-comparison.cc (operator|=(diff_category&,
	diff_category)): Define new function.
	(operator==(const decl_base_sptr l, const decl_base_sptr r)): Add
	consts.
	(operator==(const type_base_sptr l, const type_base_sptr r)):
	Define new operator.
	(is_typedef, strip_typedef, types_are_compatible): New function
	definitions.
	* tests/data/test-diff-filter/test3-report.txt: New test report
	reference.
	* tests/data/test-diff-filter/test3-v0.cc: Source code for new
	test input.
	* tests/data/test-diff-filter/test3-v0.o: New test input.
	* tests/data/test-diff-filter/test3-v1.cc: Source code for new
	test input.
	* tests/data/test-diff-filter/test3-v1.o: New test input.
	* tests/test-diff-filter.cc: Adjust to consume the new tests
	inputs above.
	* tools/bidiff.cc: Add the new COMPATIBLE_TYPE_CHANGE_CATEGORY
	into the --harmless group.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-02 17:23:56 +02:00
Dodji Seketeli
70d5afdaa2 Compact & intuitive reporting for changed function parameters
* include/abg-comparison.h (unsigned_changed_parm_map)
	(unsigned_parm_map): New typedefs.
	* src/abg-comparison.cc
	(function_decl_diff::subtype_changed_parms): Renamed this from
	changed_parms.
	(function_decl_diff::priv::subtype_changed_parms_}): Renamed this
	from changed_parms_;
	(function_decl_diff::priv::{deleted_parms_by_id_,
	added_parms_by_id_, changed_parms_by_id_}): New members.
	(function_decl_diff::ensure_lookup_tables_populated): Update the
	new priv::changed_parms_by_id_ member to contain the parameters
	that got changed, as opposed to the subtype_changed_parms_ member
	that contain parameters that got a sub-type change.  The other
	priv::*_by_id_ members are helpers for this.  Update them too.
	(function_decl_diff::subtype_changed_parms): Renamed this from
	::changed_parms.
	(function_decl_diff::report): Report separately about parameters
	having a sub-type change, and parameters that got changed.  Note
	that in both cases, the change is necessarily to a compatible
	type.
	* data/test-diff-dwarf/test2-v0.cc: New test file.
	* data/test-diff-dwarf/test2-v0.o: Likewise.
	* data/test-diff-dwarf/test2-v1.cc: Likewise.
	* data/test-diff-dwarf/test2-v1.o: Likewise.
	* data/test-diff-dwarf/test2-report.txt: Likewise.
	* tests/Makefile.am: Add the new test files above to the
	distribution.
	* tests/test-diff-dwarf.cc: Consume the input files above to
	actually perform a regression test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-01 12:38:51 +02:00
Dodji Seketeli
67e6971005 Take filtering in account in diff stats & better categorizing
* include/abg-comparison.h
	(diff_category::ACCESS_CHANGE_CATEGORY): Renamed
	ACCESS_CHANGED_CATEGORY into this.
	(diff_category::SIZE_OR_OFFSET_CHANGE_CATEGORY): Renamed
	SIZE_CHANGED_CATEGORY into this.  Changed its semantics to
	incorporate offset changes as well.
	* src/abg-comparison.cc (struct noop_deleter): Move this up.
	(represent): Do not report filtered out data members.
	(report_mem_header): Add a new num_filtered parameter to take
	filtered-out members in account in members report headers.
	Adjust.
	(class_diff::priv::{count_filtered_bases,
	count_filtered_data_members, count_filtered_member_functions}):
	New member functions.  When a member is filtered, do not report
	it all.
	({enum_diff, class_diff}::report): Adjust.  Take filtered members
	into account in headers.
	(corpus_diff::priv::apply_filters_and_compute_diff_stats): New
	member function.
	(corpus_diff::priv::emit_diff_stats): Renamed
	emit_corpus_diff_stats into this.  Change it to take the stats in
	parameter.
	(corpus_diff::report): Adjust to re-use the above.  Filter
	varibles as well.  Take the filtered functions & variables in
	account in the stats.  Do not report filtered-out functions &
	variables at all.
	* src/abg-comp-filter.cc (type_size_changed, access_changed)
	(data_member_offset_changed): New predicates.
	({harmless, harmful}_filter::visit): Adjust to use the new
	predicates above.  Update the harmful variant for the new
	SIZE_OR_OFFSET_CHANGE_CATEGORY category.
	* tools/bidiff.cc (set_diff_context_from_opts): Adjust for the
	categories name changes.
	* tests/data/test-diff-filter/test0-report.txt: New test input.
	* 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/test-diff-filter.cc: New test harness.
	* tests/Makefile.am: Add the new test files above to the
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-29 10:26:45 +01:00
Dodji Seketeli
802f7cbc92 Initial implementation of diff tree node filtering
* include/abg-comp-filter.h: New file.
	* include/Makefile.am: Add the new include/abg-comp-filter.h to
	the source distribution.
	* include/abg-comparison.h (enum visiting_kind, diff_category): New enums.
	(operator|): Declare new operator declaration for the new
	visiting_kind enum.
	(operator{|,^,&,~}): Declare new operator decl for the new
	diff_category enum.
	(diff_context::{get_allowed_category, set_allowed_category,
	switch_categories_on, switch_categories_off, diff_filters,
	add_diff_filter, maybe_apply_filters}): Declare new member functions.
	(diff::{parent_, category_}): New members.
	(diff::diff): Adjust.
	(diff::{get_parent, set_parent, get_category, add_to_category,
	is_filtered_out, to_be_reported}):  New members.
	(diff_node_visitor::{get_visiting_kind, set_visiting_kind}): New
	members.
	(diff_node_visitor::visit): Add a new flag to saying if the
	visitor is being called in post or pre children traversing mode.
	* src/abg-comparison.cc (operator|): Declare new operator
	declaration for the new visiting_kind enum.
	(operator{|,^,&,~}): Declare new operator decl for the new
	diff_category enum.
	(diff_context::priv::{allowed_category_, filters_}): New members.
	(diff_context::diff_context): Add all known filters.
	(diff_context::{get_allowed_category, set_allowed_category,
	switch_categories_on, switch_categories_off, diff_filters,
	add_diff_filter, maybe_apply_filters}): Define new member
	functions.
	(diff::{is_filtered_out, to_be_reported}): Define new members.
	(*::report): Use the new diff::to_be_reported function.
	(*::traverse): Adjust for pre/post visiting.
	(var_diff::var_diff): Chain the type diff node to its parent.
	({pointer_diff, reference_diff, qualified_type_diff,
	typedef_diff}::underlying_type_diff): Chain the underlying type
	diff node to its parent.
	(enum_diff::enum_diff): Likewise.
	(base_diff::underlying_class_diff): Likewise.
	({class_diff, corpus_diff}::report): Do not report changed
	(member) functions that have been filtered out.  Rather report
	that they have been filtered out.
	({function_decl_diff, class_diff}::traverse): Chain underlying
	type diff nodes to their parent.
	(diff_node_visitor::visit): Add a new flag to saying if the
	visitor is being called in post or pre children traversing mode.
	Make sure to call the default diff::visit overload.
	* src/abg-comp-filter.cc: New file.
	* src/Makefile.am: Add the new abg-comp-filter.cc to the source
	distribution.
	* tools/bidiff.cc (options::show_harm{ful,less}_changes): New
	members.
	(display_usage): Add usage strings for --no-harmless and
	--no-harmful options.
	(parse_command_line): Parse --no-harmless and --no-harmful command
	line options.
	(set_diff_context_from_opts): Populate the diff context
	accordingly.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:18 +01:00
Dodji Seketeli
d2ffdbffca Add missing headers double inclusion guards
* include/abg-comparison.h: Add a missing double inclusion guard.
	* include/abg-diff-utils.h: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:18 +01:00
Dodji Seketeli
9186de3dec Initial diff tree traversal infrastructure
* include/abg-comparison.h (struct diff_traversable_base, struct
	diff_node_visitor): New type.
	(class diff): Extends the new diff_traversable_base.
	({diff, distinct_diff, var_diff, pointer_diff, reference_diff,
	qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff,
	function_decl_diff, type_decl_diff, typedef_diff,
	translation_unit_diff, corpus_diff}::traverse): New methods.
	(function_decl_diff::return_type_diff): New accessor.  Renamed
	return_diff into this.
	(translation_unit_diff::{first, second}_translation_unit): New
	accessors.
	(corpus_diff::{deleted, added, changed}_functions): New accessors.
	* src/abg-comparison.cc ({distinct_diff, var_diff,
	pointer_diff, reference_diff, qualified_type_diff, enum_diff,
	class_diff, base_diff, scope_diff, function_decl_diff,
	type_decl_diff, typedef_diff, translation_unit_diff,
	corpus_diff}::traverse): New function implementations.
	(maybe_report_diff_for_member): Renamed
	maybe_report_diff_for_class_members into this.
	(var_diff::report): Adjust.
	(struct translation_unit_diff::priv): New private type.
	(translation_unit_diff::translation_unit_diff): Instantiate the
	new priv_ member.
	(translation_unit_diff::{first,second}_translation_unit): New
	accessors.
	(corpus_diff::{deleted, added, changed}_functions): New function
	implementations.
	(diff_node_visitor::visit): New function implementations.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +01:00
Dodji Seketeli
88741744e7 Make tree walking preemptive
* include/abg-traverse.h (traversable_base::traversable): Change
	the signature of this to return a boolean.
	* include/abg-ir.h (ir_traversable_base::traverse): Change the
	signature of this to return a boolean.
	(*::traverse): Adjust.
	(ir_node_visitor::visit): Change the signature of this to return a
	boolean.
	* src/abg-corpus.cc (symtab_build_visitor_type::visit): Adjust.
	* src/abg-ir.cc (::traverse): Adjust.
	* tests/test-walker.cc (name_printing_visitor::visit): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +01:00
Jonathan Wakely
12b78c366d Fix comment typos
* include/abg-diff-utils.h (compute_diff): Fix typo in apidoc
	comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-26 15:06:32 +01:00
Dodji Seketeli
5558174054 Dynamically wire class_decl::base_spec hashing
* include/abg-ir.h (decl_base::get_hash): Make this virtual.
	(class_decl::base_spec::get_hash): Declare a new virtual overload.
	* src/abg-ir.cc (class_decl::base_spec::get_hash): Define.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-20 13:34:00 +01:00
Dodji Seketeli
40a0d8c854 Get rid of class_decl::member_function
* include/abg-fwd.h (is_member_function)
	(get_member_function_is_{ctor,dtor,const})
	(get_member_function_vtable_offset): New function declarations.
	* include/abg-ir.h (class_decl::member_function): Remove.
	(class_decl::member_functions): Adjust.  This is now just a vector
	of method_decl_sptr.
	(class_decl::add_member_function): Remove the overload taking
	class_decl::member_function.  Adjust the other overload to take a
	method_decl_sptr.
	(class mem_fn_context_rel): New class.
	(class_decl::method_decl::set_scope): New virtual overload.
	(class_decl::member_function): Remove.
	(operator==): Remove the overload taking a
	class_decl::member_function.
	(class_decl::member_function::hash): Remove.
	(ir_node_visitor::visit): Remove the overload taking a
	class_decl::member_function.
	* include/abg-comparison.h (changed_member_function_sptr)
	(string_member_function_sptr_map): Adjust.
	* src/abg-comparison.cc (represent): Adjust the overload taking a
	class_decl::member_function to take a class_decl::method_decl.
	(class_diff::{report, ensure_lookup_tables_populated}): Adjust.
	* src/abg-corpus.cc (symtab_build_visitor_type::visit): Remove the
	overload taking a class_decl::member_function.
	* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir):
	Adjust.
	* src/abg-hash.cc (decl_base:#️⃣:operator()): Use the fully
	qualified name of the decl in the hash, to increase the likelihood
	of avoiding hash collisions.
	(method_type:#️⃣:operator()): Likewise.
	(function_decl:#️⃣:operator()): Take member functions in
	account.
	(class_decl::member_function:#️⃣:operator()): Remove.
	(class_decl:#️⃣:operator()): Adjust.
	(type_base::dynamic_hash::operator()): Adjust.
	* src/abg-ir.cc (is_member_function)
	(get_member_function_is_{ctor,dtor,const})
	(get_member_function_vtable_offset): New function definitions.
	(function_decl::get_pretty_representation): Adjust.
	(function_decl::operator): Take member functions in account here.
	(class_decl::insert_member_decl): Adjust.
	(mem_fn_context_rel::~mem_fn_context_rel): New definition.
	(class_decl::member_function::*): Remove.
	(class_decl::method_decl::set_scope): New definition.
	(class_decl::get_num_virtual_functions): Adjust.
	(class_decl::add_member_function): Remove overload taking a
	class_decl::member_function.  Define a new overload taking a
	class_decl::method_decl.
	(ir_node_visitor::visit): Remove the overload taking a
	class_decl::member_function.
	* src/abg-reader.cc (build_class_decl): Adjust.
	* src/abg-writer.cc (write_voffset, write_class_decl): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-20 12:21:36 +01:00
Dodji Seketeli
ed5cd14a34 Get rid of class_decl::data_member
* include/abg-fwd.h (has_scope): Delete the overloads for
	type_base.
	(get_member_is_static): Add an overload for decl_base*.
	({is,get,set}_data_member,{get_,set}_data_member_is_laid_out)
	({get,set}_data_member_offset): New access declarations.
	* include/abg-ir.h (class context_rel): Move up.
	(decl_base::set_context_rel): New definition.
	(class dm_context_rel): New type.
	(decl_base::hash_as_member): Remove.
	(var_decl::set_scope): Declare new virtual member.
	(class_decl::data_member): Remove.
	(ir_node_visitor::visit): Remove the overload for
	class_decl::data_member.
	(represent_data_member): Remove the represent overload for
	class_decl::data_member into this.  Make it take a var_decl.
	(represent): Change the overload that takes two
	class_decl::data_member take two var_decl.  And adjust it.
	(class_diff::report): Adjust.
	* src/abg-corpus.cc (symtab_build_visitor_type::visit): Remove the
	overload that takes a class_decl::data_member*.  Adjust the
	overload that takes a var_decl to recognize (static) data members.
	* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir)
	(build_class_type_and_add_to_ir, build_ir_node_from_die):
	Adjust.
	* src/abg-hash.cc (var_decl:#️⃣:operator()): Adjust.
	(class_decl::data_member:#️⃣:operator()): Remove.
	(decl_base:#️⃣:operator()): Take the context relationship in
	account here.
	(decl_base::hash_as_member::operator()): Remove.
	({enum_type_decl,typedef_decl}:#️⃣:operator()): Adjust.
	(class_decl::member_function:#️⃣:operator()): Adjust.
	(type_base::dynamic_hash::operator()): Adjust.
	* src/abg-ir.cc (dm_context_rel::~dm_context_rel): New definition.
	(has_scope): Remove overload for type_base.
	(get_member_is_static): New overload for decl_base*.
	(is_data_member): New function definition.
	({get,set}_data_member_{offset,is_laid_out}): Define new
	accessors.
	(var_decl::set_scope): Define new member function.  Make this set
	a dm_context_rel as the context relationship.
	(var_decl::operator==): Adjust to take in account the new data
	member relationship.
	(class_decl::class_decl): Adjust.
	(class_decl::insert_member_decl): Adjust.
	(class_decl::add_data_member): Remove the overload for
	class_decl::data_member.
	(class_decl::add_data_member): Adjust the overload for var_decl.
	(operator==): Remove overload for class_decl::data_member*.
	(class_decl::data_member::operator==): Likewise.
	(ir_node_visitor::visit): Remove overload for
	class_decl::data_member.
	* src/abg-writer.cc (write_layout_offset, write_class_decl):
	Adjust.
	* tests/data/test-read-write/test20.xml: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-19 21:18:38 +01:00
Dodji Seketeli
661f76c8f4 Better base class diff reporting
* include/abg-comparison.h (class base_diff): New.
	* include/abg-ir.h (function_decl::get_first_non_implicit_parm):
	New member function.
	(function_type::get_first_non_implicit_parm): Likewise.
	* src/abg-comparison.cc (base_has_changed): Change parm to take
	class_decl::base_spec_sptr.
	(class_diff::ensure_lookup_tables_populated): Compare the base
	specs not just the base classes.
	(class_diff::report): Adjust.  Report sub-type changes in the
	member functions.
	(base_diff::*): Define member functions.
	(compute_diff): Define an overload for base_diff_sptr.
	* src/abg-hash.cc ({function_type,
	method_type}:#️⃣:operator()): Do not hash the implicit parm of
	member functions.
	(class_decl:#️⃣:operator()):  Do not hash member types.
	* src/abg-ir.cc (decl_base::decl_base): Initialize the
	hashing_started_ member that got moved here from class_decl.
	(decl_base::get_hash): Do not set the hash if it's being set b/c
	we are in a class_decl.
	(decl_base::operator==) Do not compare hashes for now.  Two decls
	can have different hashes and compare equal; think about an
	incomplete type foo, that compares equal with a complete foo.
	Their hashes will be different though.  So for now, just avoid
	comparing these.
	(compare_function_types): Avoid comparing the implicit parameter
	for member functions.
	({function, method}_type::get_first_non_implicit_parm): New
	definition.
	* tests/data/test-read-write/test20.xml: Update.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-18 11:27:02 +01:00
Dodji Seketeli
ca53b99c5a Use the same representation for member and non-member types
* include/abg-fwd.h (is_at_class_scope): Add new oveloads.
	(as_non_member_type, as_non_member_class_decl): Remove.
	(has_scope, is_member_decl, is_member_type): New function
	declarations.  (get_member_is_static, set_member_is_static):
	Likewise.  * include/abg-ir.h (enum access_specifier): Move to
	the abigail:: namespace, from ...
	(class_decl::access_specifier): ... here.  (class
	context_rel): New type.  (decl_base::hash_as_member): New
	hasher.  (decl_base::context_): Change the type of this to
	context_rel_sptr.  (decl_base::get_context_rel): New protected
	getter.  (decl_base::get_scope): Move this out-of-line.
	(class_decl::member_type): Remove.
	(class_decl::member_types): Adjust this typedef.
	(class_decl::{insert,add}_member_type): Make these take a
	type_base_sptr now.  (class_decl::add_member_type): Change the
	overload that returned a member_type to return a
	type_base_sptr.  (get_member_access_specifier,
	set_member_access_specifier): New function declarations.  *
	include/abg-comparison.h (class member_type_diff): Remove.
	(compute_diff): Remove the overload for member_type_diff.  *
	src/abg-comparison.cc (compute_diff_for_types): Adjust for the
	removal of class_decl::member_type.
	(maybe_report_diff_for_class_members): New static function.
	(report_name_size_and_alignment_changes): Do not report a name
	change just because of a struct -> class change.  ({var_diff,
	enum_diff, function_decl_diff}::report): Use the new
	maybe_report_diff_for_class_members.  (class_diff::report):
	Adjust for the removal of class_decl::member_type.  Use the
	new maybe_report_diff_for_class_members.  (class member_diff):
	Remove.  * src/abg-dwarf-reader.cc (die_access_specifier)
	(get_scope_for_die, build_translation_unit_and_add_to_ir)
	(build_class_type_and_add_to_ir, build_function_decl)
	(build_ir_node_from_die): Adjust.  * abg-hash.cc (struct
	decl_base::hash_as_member): Define.  ({scope_type_decl,
	enum_type_decl, typedef_decl}:#️⃣:operator()): Use the
	decl_base::hash_as_member.
	* src/abg-ir.cc (decl_base::decl_base): Adjust.
	(decl_base::get_scope): New out-of-line getter.
	(decl_base::{operator==, set_scope): Adjust.
	(has_scope, is_member_decl, is_member_type)
	(get_member_access_specifier, set_member_access_specifier)
	(get_member_is_static, set_member_is_static, is_at_class_scope):
	New function definitions.
	(as_non_member_type, as_non_member_class_decl): Remove.
	(get_node_name): Adjust.
	(class_decl::{class_decl, set_earlier_declaration,
	insert_member_decl, insert_member_type, add_member_type):
	Likewise.
	(class_decl::member_type::*) Remove.
	* src/abg-reader.cc (read_access, build_qualified_type_decl)
	(build_reference_type_def, build_typedef_decl)
	(build_class_decl): Adjust.
	* src/abg-writer.cc (write_access, write_member_type)
	(write_class_decl): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-13 11:13:54 +01:00
Dodji Seketeli
df7c672219 Allow adding members to decl-only classes making them defined classes
* include/abg-fwd.h (lookup_type_in_scope)
	(lookup_var_decl_in_scope): New declarations.
	* include/abg-ir.h (class_decl::get_is_declaration_only): Rename
	is_declaration_only on this.
	(class_decl::set_is_declaration_only):
	* src/abg-comparison.cc (try_to_diff<class_decl>)
	(class_diff::ensure_lookup_tables_populated)
	(scope_diff::ensure_lookup_tables_populated): Update for the
	get_is_declaration_only renaming.
	* src/abg-dwarf-reader.cc (get_scope_for_die): Likewize.
	(build_class_type_and_add_to_ir): Make sure that a member type or
	data member is not already present in the class before adding it.
	Also, if a decl-only class gets a data member, it's not a
	decl-only class anymore.
	* src/abg-hash.cc (class_decl:#️⃣:operator()): Update for the
	get_is_declaration_only renaming.
	* src/abg-ir.cc (scope_decl::find_iterator_for_member)
	(look_through_decl_only_class): Likewise.
	(lookup_type_in_scope, lookup_var_decl_in_scope, get_node_name)
	(convert_node_to_decl, lookup_node_in_scope)
	(lookup_type_in_scope): New definitions.
	(class_decl::{set_definition_of_declaration,
	set_earlier_declaration, operator==}): Update for the
	get_is_declaration_only renaming.
	* src/abg-reader.cc (build_class_decl): Likewise.
	* src/abg-writer.cc (write_class_is_declaration_only): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-12 16:26:14 +01:00
Jonathan Wakely
9fcd72ca39 Fixed typos in abg-diff-utils.h
* include/abg-diff-utils.h (compute_diff): Fix typos in the API
	doc.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-12 14:52:41 +01:00
Dodji Seketeli
6667c21fe4 Better support for decl-only classes in diffing and comparison
* include/abg-fwd.h (look_through_decl_only_class): New function
	declaration.
	* src/abg-comparison.cc (class_diff::length): Just compare the two
	classes.
	(compute_diff): Look through the two classes if they are
	decl-only, and use their declaration for the diffing.
	* src/abg-ir.cc (look_through_decl_only_class): Define this new
	entry point.
	(class_decl::set_definition_of_declaration): Allow setting a
	definition that is itself a declaration-only.
	* src/abg-writer.cc (write_class_decl): Declaration-only can now
	have members, namely member types.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-10 23:29:10 +01:00
Dodji Seketeli
1c6f62bad7 Tell struct and class apart
* include/abg-ir.h (class_decl::is_struct_): New member.
	(class_decl::class_decl): Take an additional is_struct member.
	(class_decl::is_struct): New getter.
	* src/abg-ir.cc (class_decl::class_decl): Initialize the new
	is_struct_ data member.
	(class_decl::get_pretty_representation): Tell struct and class
	apart.
	* abg-reader.cc (read_is_struct): New static function.
	(build_class_decl): Capture the struct-ness of the class.
	* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir):
	Likewise.
	* src/abg-writer.cc (write_is_struct): New static function.
	(write_class_decl): Write the struct-ness of the class.
	* tests/data/test-read-dwarf/test1.abi: Update test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-10 10:04:34 +01:00
Dodji Seketeli
bac732ff5a Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file.
	* include/Makefile.am: Add abg-sptr-utils. to the build system.
	* include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove
	these typedefs as there are now in abg-sptr-utils.
	(build_sptr): Likewise for this template and its specializations
	declarations.
	* src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the
	definition of the specializations for xmlTextReader and xmlChar
	into the sptr_utils namespace.
	* include/abg-corpus.h
	(corpus::{get_regex_patterns_of_fns_to_suppress,
	get_regex_patterns_of_vars_to_suppress,
	get_regex_patterns_of_fns_to_keep,
	get_regex_patterns_of_vars_to_keep}): Declare new member
	functions.
	* src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new
	functor.
	(build_sptr) Define new specialization for regex_t.
	(struct array_deleter): Remove unused functor.
	(corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data
	members.
	(symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}):
	Likewise.
	(symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})):
	Likewise.
	(symtab_build_visitor_type::symtab_build_visitor_type): Update the
	signature of this constructor to take regex patterns for functions
	and variables to suppress and to keep.  Also, initialize the data
	members from these new parameters.
	(symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New
	member functions.
	(symtab_build_visitor_type::{add_fn_to_wip_fns,
	add_var_to_wip_vars}): Likewise.
	(symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or
	add_var_to_wip_vars depending on the overload of the visit()
	member.
	(corpus::priv::build_symbol_table): Update for the change of the
	symtab_build_visitor_type constructor signature.
	(corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}):
	Define new member functions.
	* tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}):
	New data member.
	(display_usage): Add help strings for --drop, --drop-fn,
	--drop-var, --keep, --keep-fn, --keep-var
	(parse_command_line): Parse the command lines above.
	(set_corpus_keep_drop_regex_patterns): Define new static function.
	(main): Use the new set_corpus_keep_drop_regex_patterns.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 17:59:39 +01:00
Dodji Seketeli
6c34ffd67e Fix function parameter addition/deletion/change detection
* include/abg-ir.h (function_decl::parameter::get_name_id):
	Declare new entry point.
	* src/abg-comparison.cc
	(function_decl_diff::ensure_lookup_tables_populated): Use the new
	function_decl::parameter::get_name_id() for the unique name of the
	parameter.  Also, fix a little logic error: if a parm is deleted
	and inserted, in all cases, consider it as not deleted.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 15:00:34 +01:00
Dodji Seketeli
fde5a31a2a Add a --stat option to bidiff
* include/abg-comparison.h (diff_context::show_stats_only):
	Declare new accessors.
	* src/abg-comparison.cc
	(diff_context::priv::show_stats_only_): New member.
	(diff_context::show_stats_only): Define new accessors.
	(corpus_diff::report): If showing stats only, quit right after
	showing the summary.
	* tools/bidiff.cc (options::show_stats_only): New data member.
	(options::options): Initialize the new data member.
	(display_usage): Add help string for --stat.
	(parse_command_line): Parse the --stat option.
	(set_diff_context_from_opts): Update to set the show_stats_only
	onto the context.  Cleanup the logic to make it more compact.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-28 13:03:53 +01:00