2014-11-18 Dodji Seketeli Allow introductory text in commit log and ignore it when generating ChangeLog * gen-changelog.py (process_commit): Everything that comes between the subject line of the commit and the first \t* sequence is considered to be introductory text. Ignore it when generating the ChangeLog entry. * COMMIT-LOG-GUIDELINES: Update the commit log guidelines to reflect the fact that we can now have introductory text in the commit log. 2014-11-18 Dodji Seketeli Initial import of gen-changelog.py * gen-changelog.py: Copy from https://github.com/GNOME/gnet/blob/master/gen-changelog.py. License it under LGPLV v2+ after asking Edward Hervey's kind permission. Ain't Free Software really great? 2014-11-10 Dodji Seketeli Cleanup of the web page * doc/website/libabigail-website.doxy: Remove the redundant information that was appearing on the web page. * doc/website/mainpage.txt: Clean-up the text of the web page, add information for the new IRC channel #libabigail on oftc.net, re-organize the content by putting sections where we had paragraphs. Add a table of content. Also add a web form to subscribe/unsubscribe to the mailing list. 2014-11-08 Dodji Seketeli Sort functions by the their qualified name * src/abg-comparison.cc (function_comp::operator()): Sort the functions by only looking at their qualified name, as opposed to their return type name. 2014-11-08 Dodji Seketeli Remove too tight assert from de-mangling code * src/abg-ir.cc (demangle_cplus_mangled_name): The return length can be zero. That means, no de-mangling was done. 2014-11-08 Dodji Seketeli Sort reported changed declarations & types in a given scope * src/abg-comparison.cc (struct changed_type_or_decl_comp, struct changed_vars_comp): New comparison functors. (sort_changed_type_or_decl, sort_changed_vars): New static functions. (scope_diff::report): Use the above to sort changed declarations, and types in a given scope. (corpus_diff::report): Likewise for the changed variables. * tests/data/test-abidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. 2014-11-08 Dodji Seketeli Sort elf symbols before serializing them * include/abg-corpus.h (corpus::{get_sorted_fun_symbols, get_sorted_var_symbols}): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{sorted_var_symbols, sorted_fun_symbols}): New data members. (struct elf_symbol_comp_functor): Define new comparison functor. (corpus::{get_sorted_fun_symbols, get_sorted_var_symbols}): Define new member functions. * src/abg-writer.cc (write_elf_symbols_table): Take a sorted vector of symbols in parameters, rather than an unsorted map. (write_corpus_to_native_xml): Write a sorted vector of symbols, rather than an unsorted map of symbols. * tests/data/test-read-dwarf/test0.abi: Adjust. * tests/data/test-read-dwarf/test1.abi: Likewise. * tests/data/test-read-dwarf/test2.so.abi: Likewise. * tests/data/test-read-dwarf/test3.so.abi: Likewise. * tests/data/test-read-dwarf/test6.so.abi: Likewise. 2014-11-07 Dodji Seketeli Fix template parameter hashing: make it know about enclosing template * include/abg-ir.h (template_parameter_sptr, template_decl_sptr) (template_decl_wptr): Declare new typedefs. (class template_decl): Make this virtually inherit decl_base and pimpl-ify it. (class template_parameter): Pimpl-ify this. Make the constructor take the enclosing template parameter. (struct template_decl::hash): Declare this here, rather than in src/abg-hash.cc (class type_tparameter, non_type_tparameter, template_tparameter) (class type_composition, function_tdecl, class_tdecl): Pimpl-ify this. * src/abg-hash.cc (template_parameter::hash::operator()): Hash the enclosing template parameter. Avoid infinite recursion due to the loop hash parameter -> hash template -> hash parameter. (template_decl::hash::operator()) Define this here, now that it's declared in abg-ir.h. Also, avoid infinite recursion here; this is complementary to what is done in the hashing for template_parameter. ({type_tparameter, template_tparameter, }::hash::operator()): Cache the calculated hash just as what is done for other types hashed. (template_decl::priv): Define this new type. (template_decl::{add_template_parameter, get_template_parameters, ~template_decl}): Define these here to pimpl-ify template_decl. (template_parameter::priv): Define this new type. (template_parameter::template_parameter): Define this here to pimpl-ify template_parameter. Note also that this now takes the enclosing template decl. (template_parameter::{get_index, get_enclosing_template_decl, get_hashing_has_started, set_hashing_has_started, operator::==}): Define these here to pimpl-ify template_parameter. (type_tparameter::priv): Define this new type. (type_tparameter::type_tparameter): Define this here to pimpl-ify type_tparameter. Also, not that this constructor now takes the enclosing template decl. (class non_type_tparameter::priv): Define new type. (non_type_tparameter::{non_type_tparameter, get_type}): Define these here to pimpl-ify non_type_tparameter. The constructor now takes the enclosing template. (template_tparameter::priv): Define new type. (template_tparameter::template_tparameter): Define this here to pimpl-ify template_tparameter. This constructor now takes the enclosing template. (class type_composition::priv): New type. (type_composition::{type_composition, get_composed_type, set_composed_type}): Define these here to pimpl-ify type_composition. The constructor now takes the enclosing template decl. (class function_tdecl::priv): Define new type. (function_tdecl::{function_tdecl, set_pattern, get_pattern, get_binding}): Define this here to pimpl-ify function_tdecl. (class class_tdecl::priv): Define this new type. (class_tdecl::class_tdecl): Define this here to pimpl-ify class_tdecl. (class_tdecl::set_pattern): Adjust to pimpl-ify. (class_tdecl::get_pattern): Define new pimpl-ified getter. * src/abg-reader.cc (build_function_tdecl, build_class_tdecl): Cleanup. Pass the enclosing template to the template parameters that are built. (build_type_tparameter, build_type_composition) (build_non_type_tparameter, build_template_tparameter) (build_template_parameter): Take the enclosing template declaration and pass it to the template parameter being created. * tests/data/test-read-write/test12.xml: Fix and Adjust. * tests/data/test-read-write/test13.xml: Likewise. 2014-11-06 Dodji Seketeli Style fix * include/abg-ir.h (class location): Remove useless white space. * src/abg-writer.cc (type_has_existing_id): Use type_base_sptr rather than shared_ptr. (write_template_tparameter): Use template_tparameter_sptr rather than shared_ptr. 2014-11-05 Dodji Seketeli Pass -std=gnu++11 to the compiler when --enable-cxx11 for tests * tests/Makefile.am: Pass -std=gnu++11 to the compiler when --enable-cxx11 has been used. 2014-11-05 Dodji Seketeli Make the use of a C++-11 compiler optional * configure.ac: Define a new --enable-cxx11 switch to control the use of the C++-11 compiler. Define a WITH_CXX11 C macro and an automake ENABLE_CXX11 variable. * config.h.in: Initialize the new WITH_CXX11 C macro. * src/Makefile.am: Include the files coded in C++-11 only if the ENABLE_CXX11 automake variable is defined. * tests/Makefile.am: Likewise, build the runtestsvg test program only if C++-11 usage is enabled. * include/abg-diff-utils.h (class d_path_vec): Remove useless usage of the 'typename' keyword. * include/abg-fwd.h (is_enum_type): Renamed is_enum into this, because of a name clash with a tr1 function when not using C++-11. (is_pointer_type): Likewise, renamed is_pointer into this because of a name clash with a tr1 function when not using C++-11. * src/abg-comp-filter.cc (has_harmless_name_change): Adjust for the is_enum -> is_enum_type change. * src/abg-comparison.cc (type_suppression::suppresses_diff): Likewise. (class function_suppression::priv): Add a missing "class" keyword in friend declaration. (diff_context::diff_has_been_traversed) (diff_context::mark_diff_as_traversed): Do not use the C++-11 specific type uintptr_t. * src/abg-dwarf-reader.cc (create_default_dwfl): Do not use designated initializers. Sigh. This is handy though. (expr_result::abs): Cast the argument of std::abs to avoid ambiguous call. (finish_member_function_reading): Adjust for the is_pointer -> is_pointer_type renaming. * src/abg-hash.cc (scope_decl::hash::operator) (class_decl::base_spec::hash::operator) (type_composition::hash::operator): Use std::tr1::hash string, rather than the C++-11 specific std::hash function. * src/abg-ini.cc (read_sections, write_sections): Make std::ifstream constructor take a const char* rather than a string. * src/abg-ir.cc (is_enum_type, is_pointer_type): Renamed is_enum into is_enum_type and is_pointer into is_pointer_type. * src/abg-writer.cc (write_translation_unit): Remove useless typename keyword. Make ofstream take a const char* rather than a string. (write_namespace_decl): Remove useless typename keyword. (write_corpus_to_native_xml_file): Make ofstream take a const char* rather than a string. * tests/test-abidiff.cc (main): Make ofstream take a const char* rather than a string. * tests/test-diff-dwarf.cc (main): Likewise. 2014-11-05 Dodji Seketeli Remove some m4 auto-generated files from version control * m4/ltoptions.m4: Remove from version control. * m4/ltversion.m4: Remove from version control. * m4/lt~obsolete.m4: Remove from version control. 2014-11-03 Dodji Seketeli Add usage examples to the abidiff manual * doc/manuals/abidiff.rst: Add a usage example section along with some small and clean examples. 2014-11-01 Dodji Seketeli Fix the API doc string of the abigail::xml_writer namespace * src/abg-writer.cc: Fix the API doc of the xml_writer namespace. 2014-11-01 Dodji Seketeli Fix an apidoc typo * include/abg-comparison.h (class variable_suppression): Fix a typo in the doc string. 2014-11-01 Dodji Seketeli Update the manual for variable suppression concepts * doc/manuals/libabigail-concepts.rst: Add a section for variable suppression specification in the concepts part of the manual. 2014-11-01 Dodji Seketeli Fix some restructured text doc glitches in the fn suppression manual * doc/manuals/libabigail-concepts.rst: Fix quoting of the syntax of parameter specification string, for the function suppression concepts. 2014-11-01 Dodji Seketeli Cleanup the mainpage of the API doc * include/abg-fwd.h: Cleanup text of the API doc mainpage. 2014-11-01 Dodji Seketeli Make get_binary_load_address static * src/abg-dwarf-reader.cc (get_binary_load_address): Make this function static. 2014-11-01 Dodji Seketeli Initial support for variable suppressions * include/abg-comparison.h (variable_suppression_sptr) (variable_suppressions_type): New convenience typedefs. (class variable_suppression): Declare new type. * src/abg-comparison.cc (is_var_diff): New predicate. (read_variable_suppression): Define new static function. (class variable_suppression::priv): Define type for the private data of the variable_suppression type. (variable_suppression::{variable_suppression, ~variable_suppression, get_name, set_name, get_name_regex_str, set_name_regex_str, get_symbol_name, set_symbol_name, get_symbol_name_regex_str, set_symbol_name_regex_str, get_symbol_version, set_symbol_version, get_symbol_version_regex_str, set_symbol_version_regex_str, get_type_name, set_type_name, get_type_name_regex_str, set_type_name_regex_str, suppresses_diff}): Define new member functions for the variable_suppression type. * tests/data/test-diff-suppr/libtest7-var-suppr-v0.so: Add new test input. * tests/data/test-diff-suppr/libtest7-var-suppr-v1.so: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-2.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-3.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-4.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-5.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-6.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-7.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-8.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-6.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-version-script: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-v0.cc: Source code for the librairie above. * tests/data/test-diff-suppr/test7-var-suppr-v1.cc: Source code for the librairie above. * tests/Makefile.am: Add the new test input data to the source distribution. * tests/test-diff-suppr.cc: Update to make this harness to run over the new test input above. 2014-11-01 Dodji Seketeli Update the suppr-doc.txt file for variable suppressions * doc/suppr-doc.txt: Add the suppress_variable section example. 2014-11-01 Dodji Seketeli Make var_diff and function_decl_diff extend decl_diff_base * include/abg-comparison.h (class var_diff, class function_decl_diff): Make these types inherit the decl_diff_base class. This is like the fact that all kinds of diff inherit the type_diff_base class. * src/abg-comparison.cc (var_diff::var_diff) (function_decl_diff::function_decl_diff): Adjust to initialize the sub-object of decl_diff_base; (is_decl_diff): New predicate to know if a diff is about decls. (is_function_decl): New predicate to know if a diff is about function decls. (function_suppression::suppresses_diff): Adjust to use the new is_function_decl. 2014-11-01 Dodji Seketeli Fix logic of type suppression evaluation * include/abg-comparison.cc (type_suppression::suppresses_diff): Try to evaluate the "type_name_regexp" property only if the "type_name" is empty. 2014-11-01 Dodji Seketeli Remove useless functions from the comparison engine * include/abg-comparison.h (read_type_suppression): Remove this function declaration. * src/abg-comparison.cc (read_type_suppressions): Remove this static function definition. (read_function_suppressions): Remove this static function declaration. 2014-11-01 Dodji Seketeli Spit and polish variables presentation in diff report * src/abg-comparison.cc (corpus_diff::report): Show the full representation of the variable, rather than just its name. Also, show the new representation of the variable only if it has changed. * tests/data/test-diff-dwarf/test9-report.txt: Adjust test. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test15-1-report.txt: Likewise. 2014-11-01 Dodji Seketeli Fix various apidoc typos * include/abg-comparison.h (class function_suppression): Fix typo in the doc string. * src/abg-comparison.cc (is_type_diff, read_suppressions) (diff::reported_once, typedef_diff::report): Fix the doc string. 2014-11-01 Dodji Seketeli Fix regexp escaping section of manual * doc/manuals/libabigail-concepts.rst: Re-indent and fix some typos in the regexp escaping section of the manual. 2014-11-01 Dodji Seketeli Doxygen shouldn't extract doc for static functions or private types * doc/api/libabigail.doxy: Do not extract doc for static functions, local classes. 2014-11-01 Dodji Seketeli Update .gitignore * .gitignore: Ignore *~ emacs files. 2014-10-29 Dodji Seketeli Separate alias targets with a comma * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Separate alias targets by a comma. * tests/data/test-diff-dwarf/test18-alias-sym-v1.cc: Update test to add more than one alias to a given symbol. 2014-10-28 Dodji Seketeli Fix a typo in the manual about function suppressions * doc/manuals/libabigail-concepts.rst: Fix a typo. 2014-10-28 Dodji Seketeli Initial support for function suppressions * include/abg-comparison.h (enum visiting_kind): Change the meaning of this. It was to determine if traversal was to be done in a pre or post manner. But with the recent addition of diff_node_visitor::visit_{begin,end}() notifiers, the pre/post handling is taken care of in a different way. So now the meaning of this enum is changed to handle whether diff node children should be visited or not. So the enumerators are now DEFAULT_VISITING_KIND, and SKIP_CHILDREN_VISITING_KIND. And it's a bit-field. (operator{&,~}): Declare more bit manipulation operators for the enum visiting_kind. (function_suppression_sptr, function_suppressions_type): New typedefs. (function_suppression, function_suppression::parameter_spec): Declare new types. (read_function_suppressions): Declare new function. (diff_node_visitor::diff_node_visitor): Adjust for the enum visiting_kind change. Value-initialize the visiting_kind_ data member. * src/abg-comparison.cc (operator{&,~}): Define these operators for enum visiting_kind. (read_type_suppressions): Forward declare this static function. (read_function_suppression, read_parameter_spec_from_string): Define new static functions. (read_suppressions): Update to read function suppressions too, using the new read_function_suppression function above. (class function_suppression::parameter_spec::priv): Define new type. (function_suppression::parameter_spec::*): Define the member functions of the new function_suppression::parameter_spec type. (class function_suppression::priv): Define new type. (function_suppression::*): Define the member functions of the new function_suppression type. (diff::traverse): There is no more {PRE,POST}_VISITING_KIND enumerator. So nuke the code that was dealing with it. (redundancy_marking_visitor::skip_children_nodes_): New data member flag. (redundancy_marking_visitor::visit_begin): If the current diff node is not be reported (is filtered out), do not bother visit its children nodes for the purpose of marking redundant nodes. So use the new skip_children_nodes_ flag above to know we are in that case. (redundancy_marking_visitor::visit_end): Unset the new skip_children_nodes_ flag above when appropriate. * include/abg-fwd.h (is_function_decl): Declare new function. * include/abg-ir.h (function_type::get_parm_at_index_from_first_non_implicit_parm): Declare new member function. * src/abg-ir.cc (is_function_decl): Define new function. (function_type::get_parm_at_index_from_first_non_implicit_parm): Define new member function. * src/abg-comp-filter.cc (apply_filter): Adjust for the enum visiting_kind change. No need to set it for filters anymore * doc/suppr-doc.txt: Update examples of function suppression. * doc/manuals/libabigail-concepts.rst: Update the manual for the function suppression addition. * tests/data/test-diff-suppr/libtest5-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest5-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-4.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test5-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-version-script: New test input. * tests/Makefile.am: Add the new files above to source the distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test inputs above to the list of tests to be run by this harness. 2014-10-28 Dodji Seketeli Add missing virtual destructor in comparison engine code * include/abg-comparison.h (type_suppression::~type_suppression): Declare missing virtual destructor. * src/abg-comparison.cc (type_suppression::~type_suppression): Define missing virtual destructor. 2014-10-27 Dodji Seketeli Pimplify abigail::ir::function_type * include/abg-ir.h (function_type::priv_): Declare new data member. (function_type::): Move the inline methods out of line in src/abg-ir.cc. (function_type::{return_type_, parms_}): Move these ... * src/abg-ir.cc (function_type::priv::{return_type_, parms_}): ... Here. (struct function_type::priv): New type for the private data of function_type. (function_type::): Move the previously inline methods of function_type here. Adjust them to tap into priv_->* to get the private data members. 2014-10-27 Dodji Seketeli Light style fix * include/abg-ir.h (function_decl::get_type): Change the return type from shared_ptr to function_type_sptr. 2014-10-27 Dodji Seketeli Allow white spaces in ini file property values * src/abg-ini.cc (read_context::char_is_property_value_char): New member function. (read_context::read_next_char): Fix typos. Allow escaping of '[' and ']'. (read_context::read_property_value): Use the new read_context::char_is_property_value_char above. 2014-10-27 Dodji Seketeli Fix typo in suppression specification manual * doc/manuals/libabigail-concepts.rst: Fix name -> name_regexp. 2014-10-22 Dodji Seketeli Support comparing symbols not referenced by debug info * doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug info, abidiff now works but just report about added/removed symbols. Add documentation about the new --no-unreferenced-symbols option. * include/abg-comparison.h (string_elf_symbol_map): New typedef. (diff_context::show_symbols_unreferenced_by_debug_info): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_syms_unreferenced_by_di_): New data member. (diff_context::priv::priv): Adjust. (diff_context::show_symbols_unreferenced_by_debug_info): Implement these accessors. (corpus_diff::priv::{unrefed_fn_syms_edit_script_, unrefed_var_syms_edit_script_, added_unrefed_fn_syms_, deleted_unrefed_fn_syms_, added_unrefed_var_syms_, deleted_unrefed_var_syms_}): New data members. (corpus_diff::priv::diff_stats::{num_func_syms_removed, num_func_syms_added, num_var_syms_removed, num_var_syms_added}): New data members. (corpus_diff::priv::diff_stats::diff_stats): Adjust. (corpus_diff::ensure_lookup_tables_populated): Populate lookup tables for added/removed symbols that are not referenced by any debug info. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for the added/removed symbols not referenced by any debug info. (corpus_diff::priv::emit_diff_stats): Emit stats about added/removed symbols that are not referenced by any debug info. (corpus_diff::length): Adjust to take in account added/removed symbols not referenced by any debug info. (show_linkage_name_and_aliases): New static function. (corpus_diff::report): When emitting a symbol name, emit its version too, and tell if it aliases other symbols. Avoid emitted extra new lines. Report added/removed symbols not referenced by any debug info. (compute_diff): In the overload for corpus_sptr, compute the diffs for symbols not referenced by debug info. * include/abg-corpus.h (corpus::get_unreferenced_{function,variable}_symbols): Declare new member functions. * src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols, unrefed_var_symbols}): New data members. (corpus_priv::build_unreferenced_symbols_tables): Define new member function. (struct comp_elf_symbols_functor): New functor. (corpus::is_empty): Adjust to take in account added/removed symbols not referenced by debug info. (corpus::{get_unreferenced_function_symbols, corpus::get_unreferenced_variable_symbols}): Define these accessors. * include/abg-dwarf-reader.h (enum status): Transform this into bitfields. Add a STATUS_UNKNOWN value that has the value 0. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): New bit-wise operators to manipulate instances of the status bit-field. * src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to avoid returning garbage version sometimes. (read_debug_info_into_corpus): Fix this to return a non-null but empty corpus_sptr when there is no debug info available. (operator|(status, status), operator&(status, status)) (operator|=(status&, status), operator&=(status, status)): Define these new bitwise operators to manipulate instances of the status bit-field. (read_corpus_from_elf): Now that the abigail::dwarf_reader::status is a bit-field, set it to reflect if debug info and/or symbol tables have been found. Do not bail out if debug info hasn't been found. Rather, keep going, and go look for symbols-only; this is a kind of operating in degraded mode. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag that says if the current instance of elf_symbol should be included in the list of aliases or not. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test input. * tools/abidiff.cc (options::show_symbols_not_referenced_by_debug_info): New data member. (options:options): Adjust. (display_usage): Add an info string for the new --no-unreferenced-symbols command line option. (parse_command_line): Parse the new --no-unreferenced-symbols command line. (set_diff_context_from_opts): Set the diff_context according to the presence of --no-unreferenced-symbols. (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field. * tools/abilint.cc (main): Adjust for the fact that abigail::dwarf_reader::status is now a bit-field.. (): * tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test reference output. * tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New test input. * tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New source code for test input. * tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New test input. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Reference output for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-dwarf/test18-alias-sym-version-script: Source code for new test input. * tests/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests above to the array of tests to run by this harness. (main): Emit empty reports for empty resulting diffs. * tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt: Adjust. * tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt: Likewise. * tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt: Likewise. * tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt: Likewise. 2014-10-22 Dodji Seketeli Allow comparison of shared_ptr of things * include/abg-diff-utils.h: Adjust copyright years. (deep_ptr_eq_functor::operator()(const shared_ptr, const shared_ptr)): New comparison operator. 2014-10-17 Dodji Seketeli Use the "standard" equality operator when comparing variables * src/abg-comparison.cc (compute_diff): In the overload for corpus_sptr, use the diff_utils::deep_ptr_eq_functor that is used to compare functions too, rather than the ad-hoc early struct var_eq_type we were using until now. 2014-10-16 Dodji Seketeli Yet another fix to the DWARF method "static-ness" detection heuristic * include/abg-fwd.h (is_pointer, is_qualified_type): Declare new functions. * src/abg-ir.cc (is_pointer, is_qualified_type): Implement these new functions. * src/abg-dwarf-reader.cc (finish_member_function_reading): Sometimes, the this pointer of a non-static method can point to a *qualified* version of its containing type. I am seeing that when comparing libstdc++.so from RHEL 6.5 and RHEL 7. Take that in account when trying to detect that the first parameter of a member function is the this pointer, and thus detect that the function is a non static member function. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: New test input. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so: New test input. * tests/data/test-read-dwarf/test8-qualified-this-pointer.cc: Source code of new test input. * tests/test-read-dwarf.cc: Update copyright year. (in_out_spec): Add the new test inputs to this array, so that this test harness runs on them. * tests/Makefile.am: Add the new test inputs to the source distribution. 2014-10-16 Dodji Seketeli Avoid infinite loops in the comparison code for classes * src/abg-ir.cc (equals): In the overload for classes, make sure to store the name of the lhs of the class and the rhs into the lhs. Also, when we bail out because we detect that there is a comparison underway, do *not* unmark the current class as not being involved in the comparison. Also, break at the first lhs virtual member function that is different from the rhs counter part. 2014-10-15 Dodji Seketeli Update the manual for the suppression specification initial work * doc/manuals/abidiff.rst: Add documentation for the new --suppressions command line switch. (--harmless, --harmful): Refer to the new "concepts" section below, where harmful/harmless concepts are now explained. (Notes): Move the content of the notes section where harmful/harmless concepts were explained, to the newly created 'Concepts' section. * doc/manuals/index.rst: Limit the depth of the table of content to 2. Add the new libabigail-concepts.rst stuff in here. Adjust for the renaming of tools.rst to libabigail-tools.rst. * doc/manuals/libabigail-concepts.rst: New file. 2014-10-13 Dodji Seketeli Properly propagate {REDUNDANT, SUPPRESSED}_CATEGORY wrt local changes * src/abg-comparison.cc (suppression_categorization_visitor::visit_end): If a diff node carries local changes, then, even if all of its children node have been suppressed, this diff node shall not be categorized as suppressed by way of propagation. (redundancy_marking_visitor::visit_end): If a diff node carries local changes, then, even if all of its children nodes are redundant, this diff node shall not be categorized as being redundant by way of propagation. * tests/data/test-diff-suppr/libtest4-local-suppr-v{0,1}.so: New test inputs. * tests/data/test-diff-suppr/test4-local-suppr-0.suppr: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-v{0,1}.{c,h}: Source code of the new tests inputs. * tests/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-suppr.cc (in_out_spec): Run this test harness over the new test input above. 2014-10-13 Dodji Seketeli Gain ability know if a diff node has local changes * include/abg-comparison.h (diff::has_local_changes): Add new pure interface. ({decl_diff_base, type_diff_base, distinct_type_diff, var_diff, pointer_diff, reference_diff, array_diff, qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff, function_decl_diff, type_decl_diff, typedef_diff, translation_unit_diff}::has_local_changes): Declare the implementation of the pure interface above. * src/abg-comparison.cc ({decl_diff_base, type_diff_base, distinct_type_diff, var_diff, pointer_diff, reference_diff, array_diff, qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff, function_decl_diff, type_decl_diff, typedef_diff, translation_unit_diff}::has_local_changes): Define the implementation of the pure interface above. 2014-10-13 Dodji Seketeli Write comparison functions that hint at the kind of changes they see * include/abg-ir.h (enum change_kind): Declare new enum. (operator|(change_kind, change_kind), operator&(change_kind, change_kind), operator|=(change_kind&, change_kind)): Declare new bit-wise operators for the new enum change_kind. (equals): Declare this new comparison function for decl_base, scope_decl, type_base, type_decl, scope_type_decl, qualified_type_def, pointer_type_def, reference_type_def, array_type_def, enum_type_decl, typedef_decl, var_decl, function_decl, function_type, class_decl, and class_decl::base_spec. (class_decl::base_spec::operator(const decl_base&)): Declare new equality operator. * src/abg-ir.cc (operator|(change_kind l, change_kind r)) (operator&(change_kind l, change_kind r), operator|=(change_kind& l, change_kind r), operator&=(change_kind& l, change_kind r)): Define these new operators. (equals): Define this new comparison function for decl_base, scope_decl, type_base, type_decl, scope_type_decl, qualified_type_def, pointer_type_def, reference_type_def, array_type_def, enum_type_decl, typedef_decl, var_decl, function_decl, function_type, class_decl, and class_decl::base_spec. ({decl_base, scope_decl, type_base, type_decl, scope_type_decl, qualified_type_def, pointer_type_def, reference_type_def, array_type_def, enum_type_decl, typedef_decl, var_decl, function_decl, function_type, class_decl, class_decl::base_spec}::operator==): Re-write these comparison operators in terms of their relevant equal() functions. 2014-09-22 Dodji Seketeli Fix struct type kind suppression support * src/abg-comparison.cc (type_suppression::suppresses_diff): Do not crash on diff nodes that are not about struct/classes, when "type_kind = struct" has been specified. * tests/data/test-diff-suppr/test2-struct-suppr-{0,1}.suppr: New test input. * tests/data/test-diff-suppr/test2-struct-suppr-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test2-struct-suppr-v{0,1}.o: Likewise * tests/data/test-diff-suppr/test2-struct-suppr-v{1,0}.cc: Source code for binary test input. * tests/test-diff-suppr.cc (in_out_spec): Run this harness on the new test input above. * tests/Makefile.am: Add the new test input files to source distribution. 2014-09-22 Dodji Seketeli Replace is_typedef by type_kind property in type suppressions * doc/suppr-doc.txt: Add type_kind property "documentation" in the type suppression. * include/abg-comparison.h (type_suppression::type_kind): New enum. (type_suppression::{get_consider_typedefness, set_consider_typedefness, get_is_typedef, set_is_typedef}): Remove. (type_suppression::{get_consider_type_kind, set_consider_type_kind, get_type_kind, set_type_kind}): Declare new methods. * Include/abg-fwd.h (is_type_decl): Declare new function. (is_enum): Declare new overload that takes a type_base_sptr. * src/abg-comparison.cc (type_suppression::priv::{consider_typedefness_, is_typedef_}): Remove these data members. (type_suppression::priv::{consider_type_kind_, type_kind_}): New data members. (type_suppression::priv::priv): Adjust. (type_suppression::{get_consider_typedefness, set_consider_typedefness, get_is_typedef, set_is_typedef}): Remove these member functions. (type_suppression::{get_consider_type_kind, set_consider_type_kind, get_type_kind, set_type_kind}): Define these new member functions. (type_suppression::suppresses_diff): Adjust to consider the kind of types more generally than just considering typedef-ness. (read_type_kind_string): New static function. (read_type_suppression): Use the above to parse the value of the new type_kind property. Adjust the creation of the resulting type_suppression object. * src/abg-ir.cc (is_type_decl): Define new function. * tests/data/test-diff-suppr/test1-typedef-suppr-0.suppr: Adjust. * tests/data/test-diff-suppr/test1-typedef-suppr-1.suppr: Adjust. 2014-09-19 Dodji Seketeli Initial support for type suppressions * include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY): New enumerator. (diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for these. (diff::EVERYTHING_CATEGORY): Adjust. (suppression_base, type_suppression): Declare new types. (suppression_ptr, suppressions_type, type_suppression_sptr) (type_suppressions_type): New typedefs. (read_type_suppressions, read_suppressions): Declare new functions. (diff_context::{suppressions, add_suppression, add_suppressions}): Declare new methods. (diff::is_suppressed): Declare new member function. (apply_suppressions): Declare new function & overloads. * src/abg-comparison.cc (is_type_diff): Define new static function. ({suppression_base, type_suppression}::priv): Define new types. ({suppression_base, type_suppression}::*): Define the methods of the new suppression_base, type_suppressions types. (read_type_suppression, read_type_suppressions, read_suppressions) (read_type_suppressions): Define new static functions. (diff_context::priv::supprssions_): New data member. (diff_context::{suppressions, add_suppression, add_suppressions}): New methods. (diff::is_filtered_out): Consider that a diff node that is in the SUPPRESSED_CATEGORY is filtered out. (diff::is_suppressed): Define new member function. (operator<<(ostream& o, diff_category c)): Support the SUPPRESSED_CATEGORY category. (corpus_diff::report): Apply suppressions before reporting anything. (category_propagation_visitor::visit_end): Do not propagate SUPPRESSED_CATEGORY. This is just like what we do for REDUNDANT_CATEGORY. (struct suppression_categorization_visitor): New visitor. (apply_suppressions): Define function & overloads. * include/abg-ini.h (config::section::find_property): New method. (config::section): Fix end of class comment. * src/abg-ini.cc (config::section::find_property): Define new method. * tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New test input files. * tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code for new test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise * tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/test-diff-suppr.cc: New test harness to run type suppression tests using the input files above. * tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise. * tests/Makefile.am: Build the new runtestdiffsuppr test harness from the test-diff-filter.cc file. Add the new test files to the build system and source distribution. * tools/bidiff.cc (options::suppressions): New data member. (display_usage): Add a help string for the new --suppressions command line switch. (parse_command_line): Parse the --suppressions command line switch. (set_diff_context_from_opts): Read the suppressions provided by the --suppression command line switch and stuff them into the diff context. 2014-09-19 Dodji Seketeli Make all type diff types extend new type_diff_base type * include/abg-comparison.h (type_diff_base, decl_diff_base): New types. (type_diff_base_sptr): New typedef. (pointer_diff, reference_diff, array_diff, qualified_type_diff) (enum_diff, class_diff, type_decl_diff, typedef_diff): Make this extend the new type_diff_base. * src/abg-comparison.cc (type_diff_base::priv, type_diff_base): Define these new types and their methods. (pointer_diff::pointer_diff, array_diff::array_diff) (reference_diff::reference_diff) (qualified_type_diff::qualified_type_diff, enum_diff::enum_diff) (class_diff::class_diff, type_decl_diff::type_decl_diff) (typedef_diff::typedef_diff): Adjust. 2014-09-18 Dodji Seketeli Rename abigail::ini::config::section_vector to sections_type * include/abg-ini.h (abigail::ini::config::sections_type): Renamed section_vector into this. (config::{get_sections, set_sections, read_sections, write_sections}): Adjust. * src/abg-ini.cc (config::priv::sections_): Adjust. (config::priv::priv): Likewise. (config::{config, get_sections}): Likewise. (read_sections, read_config, write_sections): Likewise. 2014-09-08 Dodji Seketeli Implement the abigail::ini::config abstraction * include/abg-ini.h (config::config): Add an overload that take a path and sections. (config::{get,set}_sections): New accessors. (read_sections): Rename the previous read_config() functions into these. (read_config): Add these function declarations to really act on instances of abigail::ini::config. (write_section): Rename the previous write_config functions into these. (write_config): Add these function declarations to really act on instances of abigail::ini::config. * src/abg-ini.cc (class config::priv): Implement this. (config::{config, ~config, get_path, set_path, get_sections, set_sections}): Define these new methods. (read_sections): Rename the former read_config into this. (read_config): Add this function definitions to really act on instances of abigail::ini::config. (write_sections): Rename the former write_config into this. (write_config):: Add this function definitions to really act on instances of abigail::ini::config. * tools/binilint.cc (main): Adjust. 2014-09-05 Dodji Seketeli Initial support of ini-style file parsing * include/abg-ini.h: New file. * include/Makefile.am: Add include/abg-ini.h to the source distribution. * src/abg-ini.cc: New file. * src/Makefile.am: Add src/abg-ini.cc to the source distribution. * tools/binilint.cc: New testing tool. * tools/Makefile.am: Add tools/binilint.cc to the source distribution. 2014-09-03 Dodji Seketeli Initial examples of suppression list specifications * doc/suppr-doc.txt: New file. 2014-10-11 Dodji Seketeli Put IR artifacts in the abigail::ir namespace * include/abg-fwd.h: Wrap IR artifacts into abigail::ir namespace. Inject that new abigail::ir namespace into the abigail namespace. * include/abg-ir.h: Wrap IR artifacts into abigail::ir namespace. (function_decl::parameter::get_type_name): Adjust the call to abigail::get_type_name. It's now a call to abigail::ir::get_type_name. * src/abg-ir.cc: Wrap IR artifacts into abigail::ir namespace. * include/abg-traverse.h: Wrap the ir traversing artifact into the abigail::ir namespace too. * src/abg-traverse.cc: Adjust. * include/abg-corpus.h: Wrap corpus type stuff into abigail::ir. * include/abg-dwarf-reader.h: Inject namespace abigail::ir stuff into the abigail::dwarf_reader namespace. * include/abg-reader.h: Inject namespace abigail::ir stuff into the abigail::xml_reader namespace. * src/abg-reader.cc: Adjust. * include/abg-writer.h: Inject namespace abigail::ir stuff into the abigail::xml_writer namespace. * src/abg-writer.cc: Inject namespace abigail::ir stuff into abigail namespace here too. * src/abg-hash.cc: Inject the abigail::ir namespace into the abigail namespace. * tools/abg-tools-utils.cc: Adjust for the injection of abigail::function_decl. It's now abigail::ir::function_decl. 2014-10-13 Dodji Seketeli Misc style cleanups * src/abg-comparison.cc: ({pointer_diff, reference_diff}::length): Add some vertical spaces here. 2014-10-13 Dodji Seketeli constify dm_context_rel::operator== * include/abg-ir.h (dm_context_rel::operator==): Make this const. 2014-10-13 Dodji Seketeli A distinct_diff node has no children node * src/abg-comparison.cc (distinct_diff::chain_into_hierarchy): Do not append any children node here. 2014-10-13 Dodji Seketeli Remove useless redundant_filter * include/abg-comp-filter.h (class redundant_filter): Remove this now useless type declaration * src/abg-comparison.cc (filtering::redundant_filter::visit): Remove this useless member function definition. 2014-10-10 Dodji Seketeli Sort diff reports about function parameters by their indexes * include/abg-comparison.h (changed_parms_type): New convenience typedef. * src/abg-comparison.cc (struct changed_parm_comp): New comparison functor. (sort_changed_parm_map): New sorting function. (function_decl_diff::report): Use the new sort_changed_parm_map to sort the diffs for function parameters by their indexes. 2014-10-10 Dodji Seketeli Don't be too eager to use distinct_diff * src/abg-comparison.cc (try_to_diff): For this to actually select a diff kind, the two diff subject must be of type 'DiffType'. (compute_diff_for_types, compute_diff_for_decls): Use distinct_diff in last resort. 2014-10-10 Dodji Seketeli Implement generic diff tree walking and port categorization over it * include/abg-comp-filter.h (apply_filter): Declare new overload that takes a corpus_diff_sptr ... * src/abg-comp-filter.cc (apply_filter): ... and define it. On the existing overload for diff_sptr, make sure to traverse all diff nodes, even those that have already been traversed. * include/abg-comparison.h (enum diff_category): Remove NOT_REDUNDANT_CATEGORY, add REDUNDANT_CATEGORY. (operator&=, +operator<<): Declare new operators for enum diff_category. (diff_context::{forbid_traversing_a_node_twice, traversing_a_node_twice_is_forbidden): (diff_context::categorizing_redundancy): Remove this declaration. (diff_context::maybe_apply_filters): Declare a new overload that takes a corpus_diff_sptr. And a take a new flag that says if it should visit all nodes including those that have already been visited. (diff::priv_): Make this data member protected. (diff::{begin_traversing, is_traversing, end_traversing, finish_diff_type, children_nodes, append_child_node, get_pretty_representation, chain_into_hierarchy, traverse}): Declare new member functions. (distinct_diff::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Likewise. (distinct_diff::traverse): Remove. (pointer_diff::pointer_diff): Take the underlying type diff in parameter. (pointer_diff::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. (pointer_diff::traverse): Remove. (reference_type_def::reference_type_def): Take the underlying type diff in parameter. ({array_type_def, reference_type_def}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({array_type_diff, reference_type_def}::traverse): Remove. (qualified_type_diff::qualified_type_diff): Take the underlying type diff in parameter. ({enum_diff, qualified_type_diff, class_diff}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({enum_diff, qualified_type_diff, class_diff}::traverse): Remove. (is_class_diff): Declare new function. (base_diff::base_diff): Take the underlying type diff in parameter. ({scope_diff, base_diff}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({scope_diff, base_diff}::traverse): Remove. (function_decl_diff::function_decl_diff): Take the return type diff as parameter. ({function_decl_diff, type_decl_diff}::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({function_decl_diff, type_decl_diff}::traverse): Remove. (typedef_diff::typedef_diff): Take the underlying type diff as parameter. (typedef::{finish_diff_type, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. ({typedef, translation_unit_diff}::traverse): Remove member function. (corpus_diff::{finish_diff_type, children_nodes, append_child_node, changed_variables, get_pretty_representation, chain_into_hierarchy}): Declare new member functions. (class diff_node_visitor::{visit_begin, visit_end}): Declare new member functions. (propagate_categories, print_diff_tree, categorizing_redundancy) (clear_redundancy_categorization, apply_filters): New functions and function overloads. * src/abg-comparison.cc (TRY_PRE_VISIT, TRY_PRE_VISIT_CLASS_DIFF) (TRY_POST_VISIT, TRY_POST_VISIT_CLASS_DIFF) (CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE) (UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE) (TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY) (ENSURE_DIFF_NODE_TRAVERSED_ONCE) (ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): Remove these macros. Hurrah. (diff_context::priv::categorizing_redundancy_): Remove. (diff_context::priv::forbid_traversing_a_node_twice_): Add new data member. (diff_context::priv::priv): Adjust. (diff_context::{forbid_traversing_a_node_twice, traversing_a_node_twice_is_forbidden}): Define new member functions. (diff_context::maybe_apply_filters): Once filters are applied (and categories are set to the relevant diff tree nodes, run a pass over the diff tree to propagate the categories to the relevant diff tree parent nodes. Add an overload for corpus_diff_sptr. (diff_context::categorizing_redundancy): Remove member function. (diff_context::maybe_apply_filters): Define a new overload for corpus_diff_sptr (struct diff::priv::{finished_, traversing_, children_, pretty_representation_}): New data members. (diff::priv::priv): Adjust. (diff::{begin_traversing, is_traversing, end_traversing, finish_diff_type, children_nodes, append_child_node, traverse, set_category, get_pretty_representation, chain_into_hierarchy}): Define new member functions. (diff::is_filtered_out): Do not refer to NOT_REDUNDANT_CATEGORY anymore. Rather, use the new REDUNDANT_CATEGORY. ({distinct_diff, var_diff, pointer_diff, array_diff, reference_diff, qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff, function_decl_diff, type_decl_diff, typedef_diff}::{get_pretty_representation, chain_into_hierarchy, finish_diff_type}): Define new member functions. ({distinct_diff, var_diff, pointer_diff, array_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): Remove member functions. (operator&=, operator<<): Define new operators for diff_category. ({function_decl_diff, typedef_diff}::priv::priv): Add a new constructor. (pointer_diff::{priv::priv, pointer_diff}) (reference_diff::{priv::priv, reference_diff}) (qualified_type_diff::{priv::priv, qualified_type_diff}) (enum_diff::{priv::priv, enum_diff}, base_diff::{priv::priv, base_diff}, function_decl_diff::function_decl_diff): Take the underlying type diff in parameter. (compute_diff): Adjust the pointer_diff, reference_diff, qualified_type_diff, base_diff, function_decl_diff overloads. (class_diff::priv::{count_filtered_bases, count_filtered_subtype_changed_dm, count_filtered_changed_dm, count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns}): Adjust for the call to diff_context::maybe_apply_filters. (corpus_diff::priv::{finished_, pretty_representation_}): New data member. (corpus_diff::priv::priv): New constructor. (corpus_diff::priv::clear_redundancy_categorization): Define new member function. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Adjust for call to diff_context::maybe_apply_filters. Also, call clear_redundancy_categorization at the end. (corpus_diff::priv::categorize_redundant_changed_sub_nodes): Revisit logic. (corpus_diff::{chain_into_hierarchy, finish_diff_type, children_nodes, append_child_node, changed_variables, get_pretty_representation}): Define new member functions. (corpus_diff::report): Categorize redundancy for every top level function/variable diff. (corpus_diff::traverse): Adjust to the new traversing interface. (diff_node_visitor::{visit_begin, visit_end}): Define new member functions. (struct category_propagation_visitor, struct diff_node_printer) (struct redundancy_marking_visitor, struct redundancy_clearing_visitor): New diff tree node visitors. (propagate_categories, print_diff_tree, categorize_redundancy) (clear_redundancy_categorization, apply_filters): Define new functions. * tests/Makefile.am: Add the new tests/print-diff-tree.cc to the source distribution. Build it into a tests/printdifftree binary. * tools/abidiff.cc (print_diff_tree): Add debugging functions to call from within the debugger. By default, this function and its overloads are not compiled. 2014-10-10 Dodji Seketeli Update copyright notice for tests/test-diff2.cc * tests/test-diff2.cc: Update copyright year. 2014-10-09 Dodji Seketeli Do not crash on function_decl_diff for fns that have no symbol * src/abg-comparison.cc (function_decl_diff::report): If a function decl has no associated elf symbol, do not crash while trying to report about its elf symbol aliases. 2014-10-09 Dodji Seketeli Avoid broken output for virtual member fns w/o symbols * src/abg-comparison.cc (represent): When a virtual member function has no associated elf symbol, do not emit garbage in lieu of the linkage name. Just emit no linkage name; * tests/data/test-abidiff/test-struct1-report.txt: Adjust. 2014-10-02 Dodji Seketeli Sort added/removed/changed functions reported by the comparison engine * src/abg-comparison.cc (struct function_comp, struct changed_function_ptr_comp): New comparison functors. (sort_string_function_ptr_map) (sort_string_changed_function_ptr_map): Define new static functions. (corpus_diff::report): Sort the added/removed/changed functions that are reported. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. 2014-10-02 Dodji Seketeli Mention virtual-ness of member function in their pretty representation * include/abg-fwd.h (get_member_function_is_virtual): Declare new overload for pointers. * src/abg-ir.cc (get_member_function_is_virtual): Define it. (function_decl::get_pretty_representation): Print virtual-ness of the function_decl being pretty printed. 2014-10-02 Dodji Seketeli Do not crash when reporting diffs about virtual member fns that have no symbol * src/abg-comparison.cc (represent): If a virtual member function has no symbol do not crash. 2014-10-02 Dodji Seketeli Fixup member functions which virtual-ness has just been set * include/abg-ir.h (fixup_virtual_member_function): Declare new function. (class_decl): Declare fixup_virtual_member_function() as a member. * src/abg-ir.cc (set_member_function_is_virtual): Ensure that the member function that has seen its virtualness set is also put correctly put in the vector of virtual member functions of its class. 2014-10-02 Dodji Seketeli Assert that only decls with elf symbols are part of comparison * src/abg-corpus.cc (corpus::priv::build_public_decl_table): Assert that when read from DWARF, only decls with elf symbols are part of the public decls table. 2014-10-02 Dodji Seketeli Emit all virtual member functions in group * src/abg-writer.cc (write_class_decl): Emit virtual member functions contiguously. 2014-10-02 Dodji Seketeli Always emit vtable offset for virtual member function * src/abg-writer.cc (write_voffset): Emit the vtable offset of virtual function even when the offset is zero. 2014-10-02 Dodji Seketeli Do not forget priv_->in_pub_sym_tab_ when copying decl_base * src/abg-ir.cc (decl_base::decl_base(const decl_base& d)): Do not forget to copy priv_->in_pub_sym_tab_. 2014-10-01 Dodji Seketeli Fix reading several clones of the same member function from DWARF * include/abg-fwd.h (set_member_function_is_ctor) (set_member_function_is_dtor, set_member_function_is_const) (set_member_function_vtable_offset): Declare new functions. * include/abg-ir.h (class_decl::sort_virtual_mem_fns): Declare new member function. (mem_fn_context_rel::{vtable_offset, is_constructor is_destructor, is_const}): Add these setters. (set_member_function_is_ctor, set_member_function_is_dtor) (set_member_function_is_static, set_member_function_is_const) (set_member_function_vtable_offset) (set_member_function_is_virtual): Declare these new friend function to class class_decl::method_decl. * src/abg-dwarf-reader.cc (finish_member_function_reading): Split this out from build_class_type_and_add_to_ir. Use the new setters for member functions properties introduced above. (build_class_type_and_add_to_ir): Factorize the creation of member function by using build_ir_node_from_die. Once that function has created the member function in a rather generic way, use the new finish_member_function_reading to set the remaining specific properties for member functions. (build_function_decl): When called to read additional properties of a function_decl, allow this to read and update the elf symbol properties too. This is useful for building a clone of a function that already has an elf symbol. (build_ir_node_from_die): When building a function decl, consider the case of a DIE that has both DW_AT_specification and DW_AT_abstract_origin set. That is, DW_AT_abstract_origin is set, and the origin has DW_AT_specification set. This is basically a clone of a function that implements an interface (this happens for destructors, for instance). In this case, really do the cloning of the interface implementation. If the cloned function happens to be member function, use finish_member_function_reading to read the properties relevant to its method-ness. * src/abg-ir.cc (set_member_function_is_ctor) (set_member_function_is_dtor, set_member_function_is_const) (set_member_function_vtable_offset) (class_decl::sort_virtual_mem_fns): Define new functions. (sort_virtual_member_functions): Define new static function. (struct virtual_member_function_less_than): New functor. (class_decl::add_member_function): Keep virtual member functions vector sorted. * data/test-read-dwarf/test1.abi: Adjust. Now, both the cdtor specification and all the clones that implements the different are emitted. * data/test-read-dwarf/test2.so.abi: Likewise. 2014-10-01 Dodji Seketeli Do not crash when comparing functions that have no symbol * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): Just skip functions that have no ELF symbol. 2014-09-30 Dodji Seketeli Rename member_function_is_virtual to get_member_function_is_virtual * include/abg-fwd.h (get_member_function_is_virtual): Renamed the declaration of member_function_is_virtual into this. * src/abg-ir.cc (get_member_function_is_virtual): Likewise for its definition. * include/abg-ir.h (class decl_base): Adjust the friend function member_function_is_virtual references. * src/abg-comp-filter.cc (has_virtual_mem_fn_change) (has_non_virtual_mem_fn_change): Adjust. * src/abg-comparison.cc (represent) (SKIP_MEM_FN_IF_VIRTUALITY_DISALLOWED, class_diff::report): Likewise. * src/abg-hash.cc (class_decl::hash::operator()): Likewise. (function_decl::clone, class_decl::add_member_function): Adjust. 2014-09-30 Dodji Seketeli Factorize a no-op deleter for shared pointer * include/abg-sptr-utils.h (struct noop_deleter): Move this here from ... * src/abg-comparison.cc (struct noop_deleter): ... here. 2014-09-30 Dodji Seketeli Link manuals from the main web page * doc/website/mainpage.txt: Add a link to the manuals. 2014-09-26 Dodji Seketeli Initial documentation for libabigail * doc/manuals/Makefile: New file, generated by sphinx-quickstart. * doc/manuals/abidiff.rst: New manual for abidiff. * doc/manuals/abidw.rst: New manual for abidw. * doc/manuals/abilint.rst: New manual for abilint. * doc/manuals/conf.py: New configuration file generated by sphinx-quickstart. * doc/manuals/index.rst: The root of the this documentation. * doc/manuals/libabigail-overview.rst: The overview of libabigail. * doc/manuals/tools.rst: The root of the tools manuals. 2014-09-26 Dodji Seketeli Do not install the abisym program * tools/Makefile.am: Do not install abisym. It's really there just for testing purposes and is of almost no use for generic users. 2014-09-26 Dodji Seketeli Rename bi* tools to abi* tools * tests/data/test-bidiff: Rename this directory to tests/data/test-abidiff. * tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc. * tools/biar.cc: Renamed to tools/abiar.cc * tools/bidiff.cc: Renamed to tools/abidiff.cc * tools/bidw.cc: Renamed to tools/abidw.cc * tools/bilint.cc: Renamed to tools/abilint.cc * tools/bisym.cc: Renamed to tools/abisym.cc * tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*. * tests/test-diff-filter.cc: Renamed references to bidiff to abidiff. * tests/test-lookup-syms.cc: Renamed references to bisym to abisym. * tools/Makefile.am: Adjust. * tests/Makefile.am: Likewise. 2014-09-19 Dodji Seketeli Light cleanup in abg-corpus.cc * src/abg-corpus.cc (symtab_build_visitor_type::regex_fns_suppress): use sptr_utils::build_sptr, rather than building the shared_ptr of regex_t by hand. 2014-09-18 Dodji Seketeli Pimplify abigail::comparison::diff type * include/abg-comparison.h (diff::{priv, sptr}): New types. (diff::priv_): New member. (diff::*): Remove all the other previous data members and transform the inline member function definition into declarations only. * src/abg-comparison.cc (class diff::priv): New private data type. (diff::*): Define the previous inline member functions as out-of-line here. 2014-09-18 Dodji Seketeli Rename shared_ptr into regex_t_sptr * include/abg-sptr-utils.h (build_sptr()): Rename the return type from shared_ptr to regex_t_sptr. 2014-09-19 Dodji Seketeli Fix a comment in abg-comparison.h * include/abg-comparison.h (class base_diff): Fix comment. 2014-09-05 Dodji Seketeli Light style cleanup in tools/bidiff.cc * tools/bidiff.cc (display_usage): Remove useless space before '&'. 2014-09-05 Dodji Seketeli src/Makefile.am cleanup * src/Makefile.am: Remove the unused 'headers' variable. 2014-09-16 Dodji Seketeli Emit reports about not-yet categorized diff nodes * include/abg-comparison.h (NO_CHANGE_CATEGORY): Better comment this enumerator. * src/abg-comparison.cc (diff::is_filtered_out): Not-yet categorized changes are not filtered out anymore. (distinct_diff::report): Avoid extraneous new line here. 2014-09-16 Dodji Seketeli Better support for inline related diffs * include/abg-comparison.h (diff_category::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY): New enumerator. (diff_category::EVERYTHING_CATEGORY): Adjust. * include/abg-ir.h (elf_symbol::get_aliases_id_string) (elf_symbol::does_alias, elf_symbols_alias) (compute_aliases_for_elf_symbol): Declare new functions ... * src/abg-ir.cc (elf_symbol::get_aliases_id_string) (elf_symbol::does_alias, elf_symbols_alias) (compute_aliases_for_elf_symbol): ... and define them. (function_decl::operator==): Take in account elf symbol aliases. * src/abg-comp-filter.cc (function_name_changed_but_not_symbol): Define new static functions. (harmless_filter::visit): Categorize function name changes that n doesn't impact underlying elf symbols (or the fact that two symbols were aliases and are not anymore) as harmless. * src/abg-comparison.cc (function_decl_diff::report): Properly report function name changes, or symbol aliases changes for that matter. Also report inline-ness declaration changes. * src/abg-dwarf-reader.cc (die_is_declared_inline): New static function. (build_function_decl): Use the above. * tools/bidiff.cc (set_diff_context_from_opts): Add abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY into the harmless change camp. * tests/data/test-diff-dwarf/test14-inline-report.txt: New test input. * tests/data/test-diff-dwarf/test14-inline-v0.o: Likewise. * tests/data/test-diff-dwarf/test14-inline-v1.o: Likewise. * tests/data/test-diff-dwarf/test14-inline-v0.cc: Source code for test input. * tests/data/test-diff-dwarf/test14-inline-v1.cc: Source code for test input. * tests/test-diff-dwarf.cc: Run this test harness over the new input above. * tests/data/test-diff-filter/test20-inline-report-0.txt: Likewise. * tests/data/test-diff-filter/test20-inline-report-1.txt: Likewise. * tests/data/test-diff-filter/test20-inline-v0.o: New test input. * tests/data/test-diff-filter/test20-inline-v1.o: New test input. * tests/data/test-diff-filter/test20-inline-v0.cc: Source code for test input. * tests/data/test-diff-filter/test20-inline-v1.cc: Likewise. * tests/test-diff-filter.cc: Run this test harness over the new input above. 2014-09-16 Dodji Seketeli Better support for enum diffs * include/abg-comparison.h (changed_enumerator_type): New typedef. (diff_category::{HARMLESS_ENUM_CHANGE_CATEGORY}): New enumerator. * src/abg-comp-filter.cc (has_type_size_change) (has_enumerator_insertion, has_enumerator_removal_or_change) (has_harmful_enum_change): New functions. (harmless_filter::visit): Categorize enumerator insertions that don't change the size of the type into HARMLESS_ENUM_CHANGE_CATEGORY. (harmful_filter::visit): Categorize enumerator removal or any enum change that changes the size of the type into SIZE_OR_OFFSET_CHANGE_CATEGORY. * src/abg-comparison.cc (enumerator_value_comp) (changed_enumerator_comp): New types. (sort_enumerators, sort_changed_enumerators): New static functions. (enum_diff::report): Sort enum related reports by the value of the enumerators. * src/abg-dwarf-reader.cc (build_enum_type): Name anonymous enums as __anonymous_enum__. * tools/bidiff.cc (set_diff_context_from_opts): Add abigail::comparison::HARMLESS_ENUM_CHANGE_CATEGORY into the harmless stuff camp. * tests/data/test-diff-dwarf/test15-enum-report.txt: New test input. * tests/data/test-diff-dwarf/test15-enum-v1.o: Likewise. * tests/data/test-diff-dwarf/test15-enum-v0.o: Likewise. * tests/data/test-diff-dwarf/test15-enum-v0.cc: Source code for test input. * tests/data/test-diff-dwarf/test15-enum-v1.cc: Likewise. * tests/data/test-diff-filter/test19-enum-report-0.txt: New test input. * tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise. * tests/data/test-diff-filter/test19-enum-v0.o: Likewise. * tests/data/test-diff-filter/test19-enum-v1.o: Likewise. * tests/data/test-diff-filter/test19-enum-v0.cc: Source code for test input. * tests/data/test-diff-filter/test19-enum-v1.cc: Likewise. * tests/test-diff-dwarf.cc: Run this test harness on the new test inputs above. * tests/test-diff-filter.cc: Likewise. * tests/Makefile.am: Add the new files above to the source distribution. 2014-09-16 Dodji Seketeli Add constness to elf_symbol::operator== * include/abg-ir.h (elf_symbol::operator==): Add a const to the declaration ... * src/abg-ir.cc (elf_symbol::operator==): ... and to the definition. 2014-09-15 Dodji Seketeli Misc style cleanups * src/abg-comparison.cc (ChangedDataMemberComp): Rename this to changed_data_member_comp (sort_changed_data_members): Adjust. (DataMemberComp): Rename this to data_member_comp. (sort_data_members): Adjust. 2014-09-15 Dodji Seketeli Constify some function parameters in abg-comp-filter.cc * src/abg-comp-filter.cc (type_size_changed): Now take const parameters. 2014-09-09 Jan Engelhardt Add .gitignore files. * .gitignore: Add new file. * m4/.gitignore: Likewise. * tools/.gitignore: Likewise. 2014-09-09 Jan Engelhardt Place -L/-l flags into *_LIBADD/*_LDADD * src/Makefile.am: -L and -l ought to be in LIBADD/LDADD because that is the only place guaranteed to be in the right spot. So add Them to libabigail_la_LIBADD. * tools/Makefile.am: Likewise. 2014-09-09 Jan Engelhardt Add libelf to libabigail.la's linker line * configure.ac: Check for the existence of libelf at configure time by looking at the presence of the elf_end symbol. Add the libelf to the link command line. 2014-09-09 Jan Engelhardt Drop hardcoded substitutions * doc/Makefile.am: Do not use @docdir@. It's indeed replaced at configure time. But there is no need for this limitation with automake, as $(docdir) is available and replaceable anytime. * src/Makefile.am: Likewise for @DEPS_LIBS@ and @DEPS_CFLAGS@. 2014-09-09 Jan Engelhardt Replace indirect variable assignments * configure.ac(DEVEL_CFLAGS, DEVEL_CXXFLAGS): Remove these useless variables. (CFLAGS, CXXFLAGS): Set these variables directly. * include/Makefile.am (pkginclude_HEADERS): Use this predefined variable. (publicheaders_DATA, publicheadersdir): Remove these. 2014-09-09 Jan Engelhardt Remove empty and autogenerated files from git repository * ChangeLog: Remove this empty file for now. It'll be added back right before the first release by automatic generation from the commit logs. * INSTALL: Remove this empty file for now. * NEWS: Remove this empty file for now. It'll be added back right before the first release. * configure.ac (AM_INIT_AUTOMAKE): As the mandatory but empty files above are being removed for now, let's put in the 'foreign' mode of automake for the moment. We'll likely remove it at release time. 2014-09-09 Jan Engelhardt Set automake options globally * configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option here .. * src/Makefile.am: ... not here. * tests/Makefile.am: Likewise. * tools/Makefile.am: Likewise. 2014-09-09 Jan Engelhardt Stash some autogenerated tools in build-aux/ * configure.ac: Reduce the pollution in the top-level directory a bit. 2014-09-10 Dodji Seketeli Fix memory leaks due to cycles in types ownership * include/abg-fwd.h (std::tr1::weak_ptr): Inject this type in the abigail namespace. * include/abg-ir.h: Write a memory management guideline for the IR artifacts. (Type_base_wptr, function_type_wptr) (class_decl_wptr): New typedefs. (translation_unit::get_canonical_function_type): Declare new member function. (qualified_type_def::underlying_type_) (reference_type_def::pointed_to_type_) (typedef_decl::underlying_type_, function_decl::parameter::type_) (function_type::return_type_, method_type::class_type_) (non_type_tparameter::type_, type_composition::type_): Make this a weak pointer. (qualified_type_def::get_pointed_to_type) (reference_type_def::get_pointed_to_type) (array_type::get_element_type, typedef_decl::get_underlying_type) (var_decl::get_type, function_decl::parameter::get_type) (function_type::get_return_type, method_type::get_class_type) (non_type_tparameter::get_type) (type_composition::get_composed_type): Adjust to make this return a shared pointer initialized with the content of the weak pointer. (function_decl::function_decl, method_decl::method_decl): Remove the overload that doesn't take a type. This is because now, function types need to be registered to their containing translation unit. (struct function_type::hash): Declare here. * src/abg-hash.cc (struct function_type::hash): Declare this in abg-ir.h and just define the methods here. * src/abg-ir.cc (fn_type_ptr_map): New typedef. (translation_unit::priv::canonical_types_): Remove this unused member. (translation_unit::priv::canonical_function_types_): New member. (translation_unit::get_canonical_function_type): Define this function. (array_type_def::priv::element_type_, var_decl::priv::type_) (function_decl::priv::type_): Make this a weak pointer. (qualified_type_def::get_underlying_type) (pointer_type_def::get_pointed_to_type) (reference_type_def::get_pointed_to_type) (array_type_def::get_element_type) (typedef_decl::get_underlying_type, var_decl::get_type) (function_decl::get_type): Adjust to make this return a shared pointer initialized with the content of the weak pointer. (qualified_type_def::build_name) (pointer_type_def::get_qualified_name) (reference_type_def::get_qualified_name): Adjust. (method_type::set_class_type): Cleanup the logic. (function_decl::priv::priv): Remove the overload that takes a bare pointer to a type. This should not be used now that we need the function type to registered with the translation unit. (function_decl::function_decl): Remove the overload that doesn't take a type. This is because now, function types need to be registered to their containing translation unit. * src/abg-dwarf-reader.cc (build_function_decl): Register the function type within its translation type and use its canonical version. This complies with the new memory management rules. * src/abg-reader.cc (build_function_decl): Likewise. 2014-09-10 Dodji Seketeli Compare class names when comparing methods * src/abg-ir.cc: 2014-09-10 Dodji Seketeli Slight white space fix * src/abg-hash.cc (method_type::hash::operator()(const method_type&)): White space fix. 2014-09-10 Dodji Seketeli Update copyright notice * include/abg-ir.h: Update year of copyright notice. 2014-07-05 Ondrej Oprala Unite help output for tools * tools/biar.cc (std::ostream): Add a using directive. (display_usage): Make it take a string reference and an ostream as parameters. Use the ostream argument as an output stream instead of a hard-coded cout. Prettify output. (main): Call display_usage with new parameters. * tools/bidiff.cc (display_usage): Declare it static. Prettify output. * tools/bidw.cc (display_usage): Prettify output. * tools/bilint.cc (display_usage): Declare it static. Prettify output. * tools/bisym.cc (std::cerr): Add a using directive. (prog_name): Rename progname into this. (display_usage): Rename show_help into this. Add an ostream as a parameter. Use the ostream argument as output stream insted of a hard-coded cout. 2014-09-03 Dodji Seketeli Adjust copyright year * tests/test-diff-dwarf.cc: Adjust year in copyright notice. 2014-09-03 Dodji Seketeli Sort reported changed data members by increasing offset * include/abg-comparison.h (changed_type_or_decl_vector): New typedef. * include/abg-fwd.h (is_data_member): Change the overload that takes a decl_base_sptr to make it return the real var_decl_sptr rather than just a bool. * src/abg-comparison.cc (ChangedDataMemberComp, DataMemberComp): New comparison functors. (sort_changed_data_members, sort_data_members): Sorting functions for changed data members and data members. (class_diff::report): Sort reports for deleted, inserted and change data members by the increasing value of the offsets of said data members. * src/abg-ir.cc (is_data_member): Change the overload that takes a decl_base_sptr to make it return the real var_decl_sptr rather than just a bool. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test13-report.txt: New test input. * tests/data/test-diff-dwarf/test13-v0.cc: Source code for new test input. * tests/data/test-diff-dwarf/test13-v0.o: New test input. * tests/data/test-diff-dwarf/test13-v1.cc: Source code for new test input. * tests/data/test-diff-dwarf/test13-v1.o: New test input. * tests/Makefile.am: Add the new test inputs above to the source distribution. * tests/test-diff-dwarf.cc: Run this test harness on the new test input. 2014-09-03 Dodji Seketeli Do not filter out diff nodes that are only in NOT_REDUNDANT_CATEGORY * src/abg-comparison.cc (diff::is_filtered_out): If a diff not is only in the NOT_REDUNDANT_CATEGORY category consider it as not being filtered. * tests/data/test-diff-filter/test18-report.txt: New test input. * tests/data/test-diff-filter/test18-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test18-v0.o: New test input. * tests/data/test-diff-filter/test18-v1.cc: Source code for new test input. * tests/data/test-diff-filter/test18-v1.o: New test input. * tests/Makefile.am: Add the new test inputs to the source distribution. * tests/test-diff-filter.cc: Run this test harness on the new test input above. 2014-09-03 Dodji Seketeli White space cleanup * src/abg-ir.cc (get_data_member_offset): Remove useless horizontal white space. 2014-09-03 Dodji Seketeli Add some comments in the comparison engine * src/abg-comparison.cc: Add a comment for the file. (struct class_diff::priv::{subtype_changed_dm_,changed_dm_}): Add comment for these data members. 2014-09-02 Dodji Seketeli Remove useless new line from comparison engine's report * src/abg-comparison.cc (class_diff::report): Do not emit new lines after reporting about inserted data members. * tests/data/test-bidiff/test-qual-type0-report.txt: Adjust. * tests/data/test-bidiff/test-struct0-report.txt: Adjust. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-dwarf/test1-report.txt: Adjust. * tests/data/test-diff-dwarf/test3-report.txt: Adjust. * tests/data/test-diff-dwarf/test7-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test1-report.txt: Adjust. * tests/data/test-diff-filter/test11-report.txt: Adjust. * tests/data/test-diff-filter/test14-0-report.txt: Adjust. * tests/data/test-diff-filter/test14-1-report.txt: Adjust. * tests/data/test-diff-filter/test15-0-report.txt: Adjust. * tests/data/test-diff-filter/test15-1-report.txt: Adjust. * tests/data/test-diff-filter/test16-report.txt: Adjust. * tests/data/test-diff-filter/test17-0-report.txt: Adjust. * tests/data/test-diff-filter/test17-1-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test3-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. 2014-09-01 Dodji Seketeli Adjust copyright years * src/abg-corpus.cc: Adjust copyright years. * src/abg-libzip-utils.cc: Likewise. * src/abg-writer.cc: Likewise. 2014-09-01 Dodji Seketeli Factorize basic redundancy detection in diff report * src/abg-comparison.cc (RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER) (RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER{2,3}): New macros. ({pointer_diff, array_diff, reference_diff, qualified_type_diff, class_diff, typedef_diff}::report): Use the new macros above. * tests/data/test-bidiff/test-qual-type0-report.txt: Adjust because type pretty representation are now always quoted. * tests/data/test-bidiff/test-struct1-report.txt: Adjust likewise. 2014-08-31 Dodji Seketeli Display package configuration at the end of configure * configure.ac: Display the configure of the package at the end of the configure script. 2014-08-31 Dodji Seketeli Make zip archive support optional * configure.ac: Support a new --enable-zip-archive option. By default its value is set to the 'auto', meaning that if libzip is installed, that turns the option on -- just like if --enable-zip-archive was called with the value 'yes'; if libzip is not installed, that turns the option off -- just like if --enable-zip-archive was called with the value 'no'. If libzip is detected, the pre-processor macro HAVE_LIBZIP is set to 1. If --enable-zip-archive is turned on, the pre-processor macro WITH_ZIP_ARCHIVE is set to 1. * config.h.in (HAVE_LIBZIP, WITH_ZIP): New define. * src/abg-corpus.cc: Include config.h. Guard the inclusion of abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro. Likewise for the use of declarations coming from abg-libzip-utils.h. * src/abg-libzip-utils.cc: Include config.h. Guard the file's content with the WITH_ZIP_ARCHIVE macro. * src/abg-reader.cc: Include config.h. Guard the inclusion of abg-libzip-utils.h with the WITH_ZIP_ARCHIVE. Likewise for the use of declarations coming from abg-libzip-utils.h. * src/abg-writer.cc: Likewise. * tests/Makefile.am: Build runtestwritereadarchive and runtestdot only if zip archives are supported. * tools/Makefile.am: The biar program is built only if zip archives are supported. * tools/bidiff.cc: Handle zip archives only if the WITH_ZIP_ARCHIVE macros is defined. * tools/bilint.cc: Likewise. 2014-08-28 Dodji Seketeli Tell bidiff --help, wrong options and missing argument apart * tools/bidiff.cc (options::{display_usage,missing_operand}): New data members. (options::options): Initialize them. (parse_command_line): Flag missing operands. Return false only when an option could not be parsed. Flag when the user wants us to display help. (main): Tell --help, wrong options and missing argument apart and give an appropriate message on stderr. The help string goes to stdout though. Just like what GNU diff does. 2014-08-28 Dodji Seketeli In bidiff, don't emit a report when the binaries have the same ABI * tools/bidiff.cc (main): For differences of zero length, do not emit any report. 2014-08-29 Dodji Seketeli Take variables in account in corpus changes detection * src/abg-comparison.cc (corpus_diff::length): Take changes about variables into account. 2014-08-28 Dodji Seketeli During redundancy marking start with the current node as non redundant * src/abg-comparison.cc (ENSURE_DIFF_NODE_TRAVERSED_ONCE): If the diff node is being traversed for the first time, mark it as being in the NOT_REDUNDANT_CATEGORY. I don't know why I was doing this only for classes and basic types. Update comments. * tests/data/test-diff-filter/test16-report.txt: New test input. * tests/data/test-diff-filter/test16-v0.cc: Source code of new test input. * tests/data/test-diff-filter/test16-v0.o: New test input. * tests/data/test-diff-filter/test16-v1.cc: Source code of new test input. * tests/data/test-diff-filter/test16-v1.o: New test input. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. * tests/data/test-diff-filter/test17-1-report.txt: Likewise. * tests/data/test-diff-filter/test17-v0.cc: Source code of new test input. * tests/data/test-diff-filter/test17-v0.o: Likewise. * tests/data/test-diff-filter/test17-v1.cc: Source code of new test input. * tests/data/test-diff-filter/test17-v1.o: Likewise. * tests/Makefile.am: Add the new files to the source distribution. * tests/test-diff-filter.cc (in_out_spec): Run this test harness over the new test inputs. 2014-08-28 Dodji Seketeli Give anonymous struct the name "__anonymous_struct__" * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Set the name of anonymous structs to '__anonymous_struct_'. 2014-08-28 Dodji Seketeli Style fix in the comparison engine * src/abg-comparison.cc (represent): Remove useless white space. 2014-08-27 Dodji Seketeli In bidiff, change --no-linkage-names to --no-linkage-name * tools/bidiff.cc (display_usage): Change--no-linkage-names -o --no-linkage-name in the help string. (parse_command_line): Adjust the command line parsing accordingly. * tests/test-diff-filter.cc (in_out_specs): Adjust. 2014-08-27 Dodji Seketeli In diff reports, show symbol version info in linkage names * src/abg-comparison.cc (represent, corpus_diff::report): show symbol version info in linkage name info. 2014-08-27 Dodji Seketeli In diff reports, fns & members add/remove at the top, changes later. * src/abg-comparison.cc (class_diff::report): Put virtual member function adding/removal/change first, then data members add/removal, then the rest (including data members changes). (corpus_diff::report): Put function adding/removal first, then function changes. Likewise for variables. * tests/data/test-bidiff/test-struct0-report.txt: Adjust. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-dwarf/test1-report.txt: Adjust. * tests/data/test-diff-dwarf/test12-report.txt: Adjust. * tests/data/test-diff-dwarf/test8-report.txt: Adjust. * tests/data/test-diff-dwarf/test9-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test1-report.txt: Adjust. * tests/data/test-diff-filter/test13-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test3-report.txt: Adjust. * tests/data/test-diff-filter/test9-report.txt: Adjust. 2014-08-27 Dodji Seketeli Consider symbol versions' public-ness during comparison * src/abg-ir.cc (elf_symbol::operator==): Rather than comparing bindings, compare public-ness here. That is, if two symbol versions' differ because one is GLOBAL and the other one is WEAK, they should still be considered equal, from an ABI standpoint. 2014-08-27 Dodji Seketeli Lookup proper names of symbol during determination of deleted/added decls * src/abg-comparison.cc ({class,corpus}_diff::ensure_lookup_tables_populated): Now that in the intermediate maps we store symbol *ids* rather than symbol names, make sure to really refer to symbol names for symbol lookups, rather than (wrongly) referring to symbol ids. 2014-08-26 Dodji Seketeli Cleanup bidiff help string some more * tools/bidiff.cc (display_usage): Add help strings for --harmless and --no-harmful. (main): Emit the help string to stdout, not stderr. 2014-08-26 Dodji Seketeli bidiff --no-harmless is no more * tools/bidiff.cc (display_usage): Remove the help string for the --no-harmless option that doesn't exist anymore, as it's on by default. 2014-08-26 Dodji Seketeli During comparison use symbol name + version as decl ID * include/abg-ir.h ({var,function}_decl::get_id): New member function declarations. * src/abg-ir.cc ({var,function}_decl::get_id): New member function definitions. * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): Use the ::get_id() function to get an identifier for the function or variable. * src/abg-corpus.cc (symtab_build_visitor_type::build_id): Use the get_id of the function/variable. 2014-08-26 Dodji Seketeli Fix access to alternate die -> decl map * src/abg-dwarf-reader.cc (read_context::alternate_die_decl_map): Return the real alternate die decl map, rather than what we was doing previously b/c of a stupid copy/paste. Oh well. 2014-08-25 Dodji Seketeli Take symbol versions in account when computing added/removed decls * include/abg-corpus.h (corpus::lookup_{function,variable}_symbol): Add an overload declaration that takes the version of the symbol to lookup. * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): So when looking up the corpora for symbols, take their versions in account. * src/abg-corpus.cc (corpus::lookup_{function,variable}_symbol): Add an overload definition that takes the version of the symbol to lookup. (symtab_build_visitor_type::build_id): New member functions. (corpus::priv::build_public_decl_table): Use the new member functions above. * src/abg-ir.cc (elf_symbol::version::operator==): Do not take the is_default flag in account when comparing two symbol versions. * libtest12-v{0,1}.so: New test input files. * libtest12-v{0,1}.c: Source code for the test input files. * test12-version-script: Version script to build the files above. * test12-report.txt: Test input file. * tests/Makefile.am: Add the new test input files above to the source distribution. * tests/test-diff-dwarf.cc (in_out_specs[]): Add an entry to this table for the new test input files. 2014-08-25 Dodji Seketeli Misc style cleanups * include/abg-corpus.h (corpus::lookup_function_symbol) (corpus::lookup_variable_symbol): Add the name of the function parameter in the declaration. * include/abg-ir.h (elf_symbol::version::version): Properly indent this constructor declaration. * src/abg-corpus.cc (symtab_build_visitor_type::symtab_build_visitor_type): Properly indent constructor parameters. * src/abg-ir.cc (function_decl::operator==): Fix typo in comments. 2014-08-25 Dodji Seketeli bidiff --harmful is not supported anymore * tools/bidiff.cc (display_usage): remove the '--harmful' line from the help string as this option is now activated by default. It's --harmless that exists now. 2014-08-22 Dodji Seketeli A builtin type name change is not harmless - fix that * include/abg-comp-filter.h (has_harmless_name_change): New function declaration. * include/abg-comparison.h (diff_category::DECL_NAME_CHANGE_CATEGORY): Renamed this into HARMLESS_DECL_NAME_CHANGE_CATEGORY. (diff_category::EVERYTHING_CATEGORY): Update. * include/abg-fwd.h (is_enum): New function declaration. (is_var_decl): Return the shared_ptr rather than a bool. (is_data_member): New overload that takes a shared_ptr. * src/abg-comp-filter.cc (decl_name_changed): Consider the qualified name here. (has_harmless_name_change): Define new function declaration. (harmless_filter::visit): Use the new has_harmless_name_change function. * src/abg-comparison.cc (represent) (report_name_size_and_alignment_changes, enum_diff::report) (typedef_diff::report, is_data_member): Use the new filtering::has_harmless_name_change function to simplify logic of emitting the name change related diff * tools/bidiff.cc (set_diff_context_from_opts): Adjust DECL_NAME_CHANGE_CATEGORY -> HARMLESS_DECL_NAME_CHANGE_CATEGORY. * src/abg-ir.cc (is_data_member, is_enum): New function definitions. (is_var_decl): Return the var_decl_sptr rather than just a bool. * tests/data/test-diff-filter/test13-report.txt: Adjust. * tests/data/test-diff-filter/test6-report.txt: Adjust. 2014-08-18 Ondrej Oprala Support C and C++ array type. * include/abg-comparison.h (array_diff): Declare new class. (array_diff_sptr): Shared pointer to type array_diff. (compute_diff): Overload the function to take type array_diff_sptr as the first two arguments. * include/abg-fwd.h (array_type_def): Declare new class. (subrange_type): Likewise. (is_array_def): Declare new function. * include/abg-ir.h (array_type_def_sptr): Shared pointer to type array_type_def. (array_type_def): Declare new class. (ir_node_visitor::visit): Declare a new virtual function taking a pointer to type array_type_def as an argument. * src/abg-comparison.cc (compute_diff_for_types): Add try_to_diff for two instances of type array_type_def. (array_diff::priv): declare struct for holding private members of type array_diff. (array_diff::array_diff): Define constructor. (array_diff::{first,second}_array):Define new member functions. (array_diff::element_type_diff): Likewise. (array_diff::{length,report,traverse}): Likewise. (compute_diff): Define function overloaded in include/abg-comparison.h. * src/abg-dwarf-reader.cc (build_array_type): Define new function. Handle DW_TAG_array_type and DW_TAG_subrange type. (build_ir_node_from_die): Amend case DW_TAG_array_type with a call to build_array_type. * src/abg-hash.cc (array_type_def::hash): Declare new struct. (type_base::dynamic_hash::operator()): Attempt to dynamic_cast the argument to type array_type_def as well. (array_type_def::hash): Declare new struct. * src/abg-ir.cc (array_type_def::array_type_def): Define constructors. (array_type_def::priv): declare struct for holding private members of type array_type_def. (array_type_def::operator==(const decl_base&): Define new operator. (array_type_def::operator==(const type_base&): Likewise. (array_type_def::append_subrange{,s}): Define new functions. (array_type_def::{set,get}_size_in_bits): Likewise. (array_type_def::get_dimension_count): Likewise. (array_type_def::get_qualified_name): Likewise. (array_type_def::get_pretty_representation): Likewise. (array_type_def::get_subrange_representation): Likewise. (array_type_def::traverse): Likewise. (array_type_def::get_{element_type,location,subranges}): Likewise. (array_type_def::is_infinite): Likewise. (array_type_def::~array_type_def): Define destructor. (ir_node_visitor::visit): Define function, taking pointer to array_type_def as an argument. * src/abg-reader.cc (map_id_and_node): Check if node is an array. (is_array_def): Check if object is an array. (handle_element_node): Handle array_type_def as well. (build_subrange_type): Define new function. (build_array_type_def): Likewise. (build_type): Build type array_type_def as well. (build_type_composition): Likewise. (handle_array_type_def): Define new function. * src/abg-writer.cc: (write_decl): Output arrays as well. (write_member_type): Likewise. (write_type_composition): Likewise. (write_array_type_def): Define new function. * tests/data/test-diff-dwarf/test{10,11}-v{0,1}.{cc,o}: New test source files * tests/data/test-diff-dwarf/test{10,11}-report.txt: Likewise. * tests/data/test-diff-dwarf/test10-report.txt: New test input. * tests/data/test-read-dwarf/test7.cc: New test source file. * tests/data/test-read-dwarf/test7.so: New input binary to read. * tests/data/test-read-dwarf/test7.so.abi: New reference test to compare against. * tests/data/test-read-write/test25.xml: New test source file. * tests/test-diff-dwarf.cc: Adjust to launch the new test. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * test/Makefile.am: Add the new test inputs to the source distribution. 2014-08-19 Dodji Seketeli Ignore variables which type couldn't be read from DWARF * src/abg-dwarf-reader.cc (build_var_decl): Drop the var on the floor if its type couldn't be built. 2014-08-19 Dodji Seketeli Support TLS variables * src/abg-ir.cc (elf_symbol::is_variable): Accept TLS objects as variables too. * src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr) (die_location_address): Add an output parameter to say if the resulting constant value is a tls address or not. (lookup_public_variable_symbol_from_elf): Use the proper elf_symbol::is_variable() method, rather than trying to figure out the low levels of what a variable is here. Also, cleanup the condition. (read_context::load_symbol_maps): Consider symbols of type STT_TLS, when loading symbols for variables. Also, to avoir symbols that are for versions, filter out symbols of type STT_OBJECT and with a SHN_ABS section index. (read_context::get_variable_address): If the address is for a tls variable, do no try to adjust the address to arrange for things like prelink. As that doesn't seem to affect TLS variables. (dwarf_expr_eval_context::set_tls_addr): New data member. (dwarf_expr_eval_context::dwarf_expr_eval_context): Initialize it. (dwarf_expr_eval_context::set_tls_address): New accessors. (dwarf_expr_eval_context::op_manipulates_stack): Handle DW_OP_GNU_push_tls_address, a bit like DW_OP_form_tls_address, but then, its result is a constant. Set the dwarf_expr_eval_context::set_tls_addr flag when these two OPs are run. (die_member_offset): Adjust to the new signature of eval_last_constant_dwarf_sub_expr. * tests/data/test-diff-dwarf/libtest9-v0.so: New test input. * tests/data/test-diff-dwarf/libtest9-v1.so: Likewise. * tests/data/test-diff-dwarf/test9-report.txt: Likewise * tests/data/test-diff-dwarf/test9-v0.cc: Source code for the first input. * tests/data/test-diff-dwarf/test9-v1.cc: Source code for the second input. * tests/test-diff-dwarf.cc: Run this harness on the two new inputs above. * tests/Makefile.am: Add the new inputs to the source distribution. 2014-08-18 Dodji Seketeli Update copyright for abg-dwarf-reader.cc * src/abg-dwarf-reader.cc: Update copyright year. 2014-08-18 Dodji Seketeli Make the link to the alt debug info file relative * tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug: Make this link be relative. 2014-08-15 Dodji Seketeli White space fix * tests/test-lookup-syms.cc: Remove useless white space. 2014-08-15 Dodji Seketeli Update copyright notice * tests/test-lookup-syms.cc: Update year in copyright notice. * tools/bidw.cc: Likewise. 2014-08-15 Dodji Seketeli Support alternate debug info sections * include/abg-dwarf-reader.h (class read_context) (typedef read_context_sptr, create_read_context) (has_alt_debug_info): Declare these. (read_corpus_from_elf): Declare new overload. * src/abg-dwarf-reader.cc (find_alt_debug_info) (is_die_attribute_resolved_through_gnu_ref_alt) (build_primary_die_parent_relations_under) (build_alternate_die_parent_relations_under): Define new static functions. (read_context::{alt_dwarf_, alt_debug_info_path_, alternate_die_decl_map_, alternate_die_parent_map_}): New data members. (read_context::{alt_dwarf, alt_debug_info_path, alternate_die_decl_map, associate_die_to_decl_primary, associate_die_to_decl_alternate, associate_die_to_decl, lookup_decl_from_die_offset_primary, lookup_decl_from_die_offset_alternate, lookup_decl_from_die_offset, alternate_die_parent_map}): New member functions. (read_context::load_debug_info): Painfully Get a handle on the alternate debug info section too. We shouldn't have to do all this work; we could use the new dwarf_getalt() function from libdw, but we cannot as we want to support supports that predate that api. When a version of elfutils gets released with that api though, we should conditionally use that instead. (build_ir_node_from_die, get_parent_die, get_scope_for_die) (build_namespace_decl_and_add_to_ir) (build_class_type_and_add_to_ir, build_qualified_type) (build_pointer_type_def, build_reference_type, build_typedef_type) (build_var_decl, build_function_decl): Take a new parameter that tells if the input DIE is from alternate debug info. Adjust their code accordingly. (die_die_attribute): Take a new output parameter that tells if the resolved DIE is from alternate debug info. Also take a new parameter that tells if the input DIE is from alternate debug info sections. (build_die_parent_relations_under): Take the DIE -> parent map to act upon. Also, add a new overload that takes a flag saying if the DIE is from alternate debug info or not, and act upon that. (build_die_parent_maps): Renamed build_die_parent_map into this and make it build DIE -> parent DIE relationship for the alternate debug info file as well. (find_last_import_unit_point_before_die, ): Adjust to use the information about if the relevant DIEs are in alternate debug info or not. (build_translation_unit_and_add_to_ir): Clear the alternate DIE -> decl map, that is per TU just as the primary DIE -> decl map. Adjust to use the information about if the relevant DIEs are in alternate debug info or not. (read_debug_info_into_corpus): Build the two DIE -> DIE parent maps (one for the primary debug info and one for the alternate debug info). (create_read_context, has_alt_debug_info): Define new public entry points. (read_corpus_from_elf): New entry point overload that takes a read_context. * tools/bidw.cc (options::{check_alt_debug_info_path, show_base_name_alt_debug_info_path}): New data members. (display_usage): Update for the two new options --check-alternate-debug-info and check-alternate-debug-info-base-name. (parse_command_line): Parse the two options above. (main) Handle the two new options above. * tests/Makefile.am: Build the new runtestaltdwarf test. Add the new data/test-alt-dwarf-file/* files to the build system. * tests/test-alt-dwarf-file.cc: New test driver. * tests/data/test-alt-dwarf-file/test0-common.cc: New test input files. * tests/data/test-alt-dwarf-file/libtest0-common.so: Likewise. * tests/data/test-alt-dwarf-file/test0.cc: Likewise. * tests/data/test-alt-dwarf-file/libtest0.so: Likewise. * tests/data/test-alt-dwarf-file/test0.h: Likewise. * tests/data/test-alt-dwarf-file/test0-common-dwz.debug: Likewise. * tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug: Likewise. * tests/data/test-alt-dwarf-file/test0-debug-dir/test0-common-dwz.debug: Likewise. * tests/data/test-read-dwarf/test1.abi: Adjust. bidw doesn't emit an abstract constructor/destructor anymore. It emits just the functions matching the cdtor symbols found in the binary. * tests/data/test-read-dwarf/test2.so.abi: Likewise. 2014-07-26 Dodji Seketeli Better handle corner cases of void* DWARF parsing * src/abg-dwarf-reader.cc (build_pointer_type_def): Better support cases where the underlying type of the pointer is not know. In that case, the pointer should not be created. 2014-07-20 Dodji Seketeli Support finding symbols with bias wrt DWARF references * src/abg-dwarf-reader.cc (get_binary_load_address): New function definition. (read_context::elf_handle): Add comment. (read_context::{dwarf_elf_handle, dwarf_is_splitted, maybe_adjust_address_for_exec_or_dyn}): New method definitions. (maybe_adjust_fn_sym_address) (maybe_adjust_var_sym_address): Move these so they become members of read_context. Also, For shared libraries and executable (that could have been e.g prelinked), consider their loading address when trying to find which symbol resides at a given place in memory. (read_context::{get_function_address, get_variable_address): Adjust. (build_translation_unit_and_add_to_ir): Fix comment. 2014-07-20 Dodji Seketeli Reset the scope of void_type_decl for each new translation unit * src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir): Clear the void_type_decl on new translation units. 2014-07-18 Dodji Seketeli Update INSTALL file * INSTALL: Adjust the copyright year information because autotools 2.69 did. 2014-07-18 Dodji Seketeli Correctly write the name of a const reference type * src/abg-dwarf-reader.cc (maybe_strip_qualification): Define new function. (build_ir_node_from_die): Use the maybe_strip_qualification when building a qualified type. * src/abg-ir.cc (qualified_type_def::build_name): Fix the representation of the name of a reference that is const. * tests/data/test-read-dwarf/test1.abi: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test1-report.txt: Likewise. * tests/data/test-diff-dwarf/test6-report.txt: Likewise. * tests/data/test-diff-dwarf/test7-report.txt: Likewise. * tests/data/test-diff-dwarf/test8-report.txt: Likewise. * tests/data/test-diff-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test3-report.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test13-report.txt: Likewise. * tests/data/test-diff-filter/test14-0-report.txt: Likewise. * tests/data/test-diff-filter/test14-1-report.txt: Likewise. 2014-07-01 Sinny Kumari Consider symbols with STB_GNU_UNIQUE binding as public * src/abg-ir.cc (is_public): Change in function to consider symbols with STB_GNU_UNIQUE binding as public * tests/data/test-read-dwarf/test6.cc: Test file to generate STB_GNU_UNIQUE binding symbols * tests/data/test-read-dwarf/test6.so: Test shared library having STB_GNU_UNIQUE binding symbols * tests/data/test-read-dwarf/test6.so.abi: XML file containing dwarf information from test6.so * tests/test-read-dwarf.cc (in_out_specs): Add the new test above * tests/Makefile.am: Add tests/data/test-read-dwarf/test6.cc, tests/data/test-read-dwarf/test6.so and tests/data/test-read-dwarf/test6.so.abi to the distribution 2014-07-01 Dodji Seketeli Add comment to test-read-write.cc * tests/test-read-write.cc: Update copyright notice and add a meaningful comment for the file. 2014-06-23 Dodji Seketeli Support reading void* type from DWARF * include/abg-ir.h (type_decl::get_void_type_decl): Declare new static method. * src/abg-ir.cc (type_decl::get_void_type_decl): Define it. * src/abg-dwarf-reader.cc (build_ir_node_for_void_type): Define new static function. (build_pointer_type_def): Support void* type nodes here. * tests/data/test-read-dwarf/test5.cc: Source code for new test input. * tests/data/test-read-dwarf/test5.o: New test input. * tests/data/test-read-dwarf/test5.o.abi: Likewise. * tests/Makefile.am: Add the above to the source distribution. 2014-06-23 Dodji Seketeli Update a comment in abg-dwarf-reader.cc * src/abg-dwarf-reader.cc (build_ir_node_from_die): Update a comment here. 2014-06-23 Mark Wielaard Handle C99 restrict qualifier and DWARFv3 DW_TAG_restrict_type. * src/abg-dwarf-reader.cc (build_qualified_type): Handle DW_TAG_restrict_type by adding CV_RESTRICT. (build_ir_node_from_die): Call build_qualified_type for DW_TAG_restrict_type. * src/abg-reader.cc (build_qualified_type_decl): Handle "restrict" attribute by adding CV_RESTRICT. * src/abg-writer.cc (write_qualified_type_def): Output "restrict" attribute for CV_RESTRICT. * tests/data/test-read-dwarf/test4.c: New test file. * tests/data/test-read-dwarf/test4.so: Likewise. * tests/data/test-read-dwarf/test4.so.abi: Likewise. * tests/data/test-read-write/test24.xml: Likewise. * tests/test-read-dwarf.cc (in_out_specs): Add test4. * tests/test-read-write.cc (in_out_specs): Add test24.xml. 2014-06-23 Dodji Seketeli Add subdir-objects automake option where it is needed * src/Makefile.am: Add the subdir-object automake option here. Do not specify absolute paths for the input files as Automake now takes care of that just fine. * tests/Makefile.am: Likewise. * tools/Makefile.am: Likewise. 2014-06-23 Dodji Seketeli Remove autotools artifacts from the repository * config.guess: Remove from revision control system. * config.sub: Likewise. * depcomp: Likewise. * m4/libtool.m4: Likewise. * missing: Likewise. 2014-06-23 Dodji Seketeli Avoid reporting diff nodes that have already been reported * include/abg-comp-filter.h (class harmful_filter): Update comment. (class redundant_filter): Declare new filter. * include/abg-comparison.h (enum diff_category::NOT_REDUNDANT_CATEGORY): New category. Update the values of the other enumerators. (diff_context::{add_diff, diff_has_been_traversed}): New overloads. (diff_context::{categorizing_redundancy, show_redundant_changes}): Declare new methods. (diff_context::remove_from_category): Define new inline method. * src/abg-comparison.cc (noop_deleter::operator()): Constify the parameter. (CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE) (UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE): New macros. (TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY): Use the new CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE and UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE macros above. (ENSURE_DIFF_NODE_TRAVERSED_ONCE) (ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): If the (type_decl or class) node hasn't been yet traversed, mark it as non-redundant. (diff_context::priv::categorizing_redundancy): New member. (diff_context::priv::priv): Initialize it. (diff_context::{add_diff, diff_has_been_traversed): Define new overloads. (diff_context::mark_diff_as_traversed): Intern a diff node that is marked as being traversed. (diff_context::{categorizing_redundancy, show_redundant_changes}): Define new methods. (diff::is_filtered_out): A redundant function or top-level variable is considered filtered-out. Otherwise, the new NOT_REDUNDANT_CATEGORY doesn't play any role when comparing allowed categories with the set of categories a diff node belongs to. (corpus::priv::categorize_redundant_changed_sub_nodes): Define new member function. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Change this to first walk the changed functions and variables to apply filters, then categorize redundant changed functions, and then walk the changed functions and variables again to count filtered-out diff nodes. (filtering::redundant_filter::visit): Define new member function. * tools/bidiff.cc (options::show_redundant_changes): New data member. (options::options): Initialize it. (display_usage): Add help string for the --redundant command line option. (parse_command_line): Add support for the --redundant command line option. (set_diff_context_from_opts): Take the --redundant command line option in account. * tests/test-diff-filter.cc: Update this to add new test inputs. * tests/data/test-diff-filter/test14-0-report.txt: New test input. * tests/data/test-diff-filter/test14-1-report.txt: Likewise. * tests/data/test-diff-filter/test14-v0.cc: Likewise. * tests/data/test-diff-filter/test14-v0.o: Likewise. * tests/data/test-diff-filter/test14-v1.cc: Likewise. * tests/data/test-diff-filter/test14-v1.o: Likewise. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test15-1-report.txt: Likewise. * tests/data/test-diff-filter/test15-v0.cc: Likewise. * tests/data/test-diff-filter/test15-v0.o: Likewise. * tests/data/test-diff-filter/test15-v1.cc: Likewise. * tests/data/test-diff-filter/test15-v1.o: Likewise. * tests/Makefile.am: Add the above to the build system. 2014-06-23 Dodji Seketeli A name that couldn't be demangled remains the same * src/abg-ir.cc (demangle_cplus_mangled_name): When the demangler fails to demangle a name, just return the input name as-is. 2014-06-23 Dodji Seketeli Update copyright notice for a bunch of files * include/abg-comp-filter.h: Update copyright notice. * include/abg-comparison.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-ir.cc: Likewise. * tools/bidiff.cc: Likewise. * tests/test-diff-filter.cc: Likewise. 2014-06-19 Sinny Kumari Keep symbol's multiple aliases within single attribute separated by comma * src/abg-writer.cc (write_elf_symbol_aliases): Changing function to keep multiple symbol aliases within one alias attribute * src/abg-reader.cc (build_elf_symbol_db): Changing function to read symbol's alias attribute and split if multiple alias exist with comma(,) asi a delimiter and add all aliases to main symbol * tests/data/test-read-dwarf/test3.c: Test file to generate multiple aliases * tests/data/test-read-dwarf/test3.so: Test shared library having multiple aliases of a symbol * tests/data/test-read-dwarf/test3.so.abi: XML file containing dwarf information from test3.so * tests/test-read-dwarf.cc (in_out_specs): Add the new test above * tests/Makefile.am: Add tests/data/test-read-dwarf/test3.c, tests/data/test-read-dwarf/test3.so and tests/data/test-read-dwarf/test3.so.abi to the distribution 2014-06-18 Mark Wielaard DW_TAG_mutable_type doesn't exist. * src/abg-dwarf-reader.cc (is_type_tag): Remove DW_TAG_mutable_type. (build_ir_node_from_die): Likewise. 2014-06-05 Dodji Seketeli Look at first parm type and artificial-ness to detect static-ness * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): To tell if a member function is static, look if the first parm is a pointer to the type of the enclosing class, and if it's artificial. Don't bother trying to be smart by looking at the non-presence of DW_AT_object_pointer b/c that attribute wasn't emitted by GCC 4_4. 2014-06-04 Dodji Seketeli 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. 2014-06-02 Dodji Seketeli Do not choke on AR archives * tools/abg-tools-utils.h (file_type::FILE_TYPE_AR): New enumerator. * tools/abg-tools-utils.cc (guess_file_type): Recognize AR archive files. * tools/bidiff.cc (main): Support AR archives. * tools/bidw.cc (main): Likewise. * tools/bilint.cc (main): Likewise. 2014-05-30 Dodji Seketeli Honor linkage name showing when displaying added/removed member functions * src/abg-comparison.cc (represent): Take a diff_context. If instructed to show linkage names, show the linkage name of the member function. (class_diff::report): Adjust for the new signature of represent(). 2014-05-30 Dodji Seketeli Make bidiff filter output and display symbol names by default * tools/bidiff.cc (options::options): Initialize options::show_linkage_names to true and options::show_harmful_changes to false. (parse_command_line): Change --linkage-names into --no-linkage-names as the linkage names are now displayed by default. Change --no-harmless into --harmless as harmless changes are now filtered by default. (display_usage): Update help string for the --linkage-names -> --no-linkage-names and --no-harmful -> --harmful change. * tests/test-diff-filter.cc: Adjust. 2014-05-29 Dodji Seketeli 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. 2014-05-29 Dodji Seketeli Fix scope for DIEs with specification or abstract_origin attributes * src/abg-dwarf-reader.cc (get_scope_for_die): If the DIE has a DW_AT_specification or DW_AT_abstract_origin attribute, get the scope of the referred-to DIE. (build_ir_node_from_die): For a variable DIE that has a DW_AT_{specification,abstract_origin} attribute, do not add the built variable IR node to its scope because it is already in a scope. It's in a scope because that built variable is for the DIE that is referred-to by the DW_AT_{specification,abstract_origin} attribute. Likewise for member functions. Also, now, get_scope_for_die can return a class for a function DIE because get_scope_for_die now returns the *logical* scope of the DIE; that is, it follows DW_AT_{specification,abstract_origin} attributes. * tests/data/test-read-dwarf/test1.abi: Adjust. 2014-05-28 Dodji Seketeli 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. 2014-05-21 Dodji Seketeli Rename 'symbol' in fn names to 'public decl' in abg-corpus.{cc,h} * src/abg-corpus.cc (lots of places): Rename references to 'symbol' in function & variable names to 'public_decl'. 2014-05-22 Dodji Seketeli 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. 2014-05-21 Dodji Seketeli Fix detection of destructors * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Simply detect that the destructor starts with a '~'. 2014-05-21 Dodji Seketeli Add clone in the scope of the cloned decl they logically belong to * src/abg-dwarf-reader.cc (build_ir_node_from_die): Do not try to add the cloned function/variable to the current scope because cloning should have added the decl into the scope of the cloned target. * src/abg-ir.cc ({var,function}_decl::clone): Insert the clone decl into the scope of the cloned decl. My understanding is that it's where they belong. * tests/data/test-read-dwarf/test1.abi: Update this to incorporate all the abstract constructors/destructors *and* their clones into the classes where they belong. * tests/data/test-read-dwarf/test1.abi: Adjust for the abstract cdtor being added to the class, as well as their cloned concrete instances. * tests/data/test-read-dwarf/test2.so.abi: Likewise. 2014-05-20 Dodji Seketeli 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. 2014-05-19 Dodji Seketeli Don't share types across TUs when DW_TAG_partial_unit are involved * src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir): Clear the part of the context that needs to be per TU. (build_ir_node_from_die): Assert that this should not be called for partial and imported unit because for now our practical assumption is that DIEs under partial unit are lazily read only when referenced by DIEs that are under DW_TAG_compile_unit. * tests/Makefile.am: Add the new test files to the build system. * tests/data/test-read-dwarf/test2.so.abi: Fix the reference output here to avoid sharing types across TUs, making the output valid for bilint. 2014-05-19 Dodji Seketeli Initial support for DW_TAG_partial_unit * src/abg-dwarf-reader.cc (read_context::cur_tu_die_): New member. (read_context::read_context): Initialize the new member. (read_context::cur_tu_die): New accessors. (find_last_import_unit_point_before_die): New static function. (get_parent_die): Take a logical current die offset parameter. If the die we want the parent for is a partial unit, then find the last DW_TAG_imported_unit that imports that partial unit before the logical current die and return the parent of that DW_TAG_imported_unit die. (get_scope_for_die): Take a logical current die offset parameter. Adjust. (build_translation_unit_and_add_to_ir): Set/unset the current translation unit DIE in the context. Adjust. (build_namespace_decl_and_add_to_ir) (build_class_type_and_add_to_ir, build_qualified_type) (build_pointer_type_def, build_reference_type, build_typedef_type) (build_var_decl, build_function_decl, build_ir_node_from_die): Take a logical current die offset parameter. Adjust. (build_corpus): Accept that we can have DIE that are not DW_TAG_compile_unit at the top level, because, well, we can now have DW_TAG_partial_unit too. * tests/data/test-read-dwarf/test2-{0,1}.cc: New test source files. * tests/data/test-read-dwarf/test2.h: Likewise. * tests/data/test-read-dwarf/test2.so: New input binary to read. * tests/data/test-read-dwarf/test2.so.abi: New reference test to compare against. * tests/test-read-dwarf.cc: Adjust to launch the new test. 2014-05-14 Dodji Seketeli Re-build a test input file with debug info * tests/data/test-lookup-syms/test1.so: Rebuild this with debug info. 2014-05-14 Dodji Seketeli 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. 2014-05-14 Dodji Seketeli Don't crash when de-serializing an empty function parm xml node * src/abg-reader.cc (build_function_parameter): Do not crash if the xml node is NULL. 2014-05-14 Dodji Seketeli Fix a typo in serializing a decl_base::binding * src/abg-ir.cc (operator<<(std::ostream&, decl_base::binding)): Fix a typo here. 2014-05-14 Dodji Seketeli Add a help string for the --no-absolute-path option of bisym * tools/bisym.cc (show_help): Add a missing help string. 2014-05-13 Dodji Seketeli Do not try to use ELF hash tables in demangling lookup mode * src/abg-dwarf-reader.cc (lookup_symbol_from_elf): If in demangling mode, do not use ELF hash tables. 2014-05-13 Dodji Seketeli Use the proper symbol table for and set linkage_name to symbol name * 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. 2014-05-13 Dodji Seketeli Remove redundant "'" around linkage names in diff reports * src/abg-comparison.cc (corpus_diff::report): Remove the redundant "'" from the linkage names in the diff. 2014-05-08 Dodji Seketeli 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. 2014-05-07 Dodji Seketeli 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::hash::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. 2014-04-21 Dodji Seketeli Drop symbols not global in a symtab from corpus symtab * 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. 2014-04-21 Dodji Seketeli Fix mangled name setting for static data members from DWARF * 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. 2014-04-21 Dodji Seketeli Always show pretty representation of variables in report * src/abg-comparison.cc (corpus_diff::report): Display the pretty representation of the variable, no matter what. 2014-04-21 Dodji Seketeli Set "is_in_public_symbol_table" property for vars & fns * 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. 2014-04-21 Dodji Seketeli 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. 2014-04-21 Dodji Seketeli 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. 2014-04-21 Dodji Seketeli 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. 2014-04-21 Dodji Seketeli 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}::hash::operator): Adjust. 2014-04-17 Dodji Seketeli 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. 2014-04-17 Dodji Seketeli Fix class diff reporting issues for base classes * 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. 2014-04-17 Dodji Seketeli Simplify SIZE_OR_OFFSET_CHANGE_CATEGORY categorizing * 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. 2014-04-17 Dodji Seketeli Fix API doc for static_data_member_type_size_changed * src/abg-comp-filter.cc (static_data_member_type_size_changed): Fix API doc comment. 2014-04-17 Dodji Seketeli Don't blindly drop DIEs defined in the scope of a function * 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. 2014-04-17 Dodji Seketeli Useless code killing * 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. 2014-04-17 Dodji Seketeli 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. 2014-04-17 Dodji Seketeli Fix typo in comments * include/abg-comparison.h (diff_category::NON_VIRT_MEM_FUN_CHANGE_CATEGORY): Fix typo in comments. 2014-04-17 Dodji Seketeli Only non-static data member changes are SIZE_OR_OFFSET_CHANGE_CATEGORY * 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. 2014-04-17 Dodji Seketeli Fix comments in categorization code * src/abg-comp-filter.cc (data_member_added_or_removed): Fix comments. 2014-04-16 Dodji Seketeli Really detect static-ness of data members. Oops. * 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. 2014-04-16 Dodji Seketeli 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. 2014-04-16 Dodji Seketeli Fix dumping function to make them use generic ostream * 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. 2014-04-16 Dodji Seketeli Misc style fixes * src/abg-ir.cc (get_translation_unit): Remove useless vertical white space. (is_global_scope): Add missing API doc. 2014-04-16 Dodji Seketeli A virt mem fn deleted and added to the same offset is not harmful * 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. 2014-04-16 Dodji Seketeli Do not categorize size/offset changes when a decl-only class is involved * 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. 2014-04-16 Dodji Seketeli Work around "mangled name vanishing from one version of mem fn decl" bug * 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. 2014-04-16 Dodji Seketeli Do not try to represent the offset for a static data member * src/abg-comparison.cc (represent_data_member(var_decl_sptr, ostream&)): If the data member is static, do not try to represent its offset. 2014-04-16 Dodji Seketeli A static data member shouldn't be checked for having been laid out * 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. 2014-04-16 Dodji Seketeli Prefix pretty representation of static data members with 'static' * src/abg-ir.cc (var_decl::get_pretty_representation): Prefix pretty representation of static data members with 'static'. 2014-04-16 Dodji Seketeli 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. 2014-04-16 Dodji Seketeli Add an assert to the pointer diff reporting code * 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. 2014-04-16 Dodji Seketeli Little style adjustment in diff node categorization code * 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. 2014-04-15 Dodji Seketeli If a diff node is in NO_CHANGE_CATEGORY do not report it anymore * 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. 2014-04-15 Dodji Seketeli Categorize changes to virt mem fncts as VIRTUAL_MEMBER_CHANGE_CATEGORY * 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. 2014-04-15 Dodji Seketeli Do not hash non-virtual member functions when hashing a class * src/abg-hash.cc (class_decl::hash::operator): Do not hash non-virtual member functions. 2014-04-15 Dodji Seketeli Fix a missing new line in the reports * src/abg-comparison.cc (represent(class_decl::method_decl_sptr, ostream&)): Add a missing new line. * tests/data/test-bidiff/test-struct1-report.txt: Adjust. 2014-04-14 Dodji Seketeli 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. 2014-04-14 Dodji Seketeli Don't compare non-virtual member functions in class comparison * 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. 2014-04-14 Dodji Seketeli 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. 2014-04-13 Dodji Seketeli 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. 2014-04-13 Dodji Seketeli 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. 2014-04-11 Dodji Seketeli 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. 2014-04-11 Dodji Seketeli Update the decl_base copy constructor for forgotten members * src/abg-ir.cc (decl_base::decl_base): Copy forgotten decl_base members hashing_started_, qualified_parent_name_, qualified_name_. 2014-04-11 Dodji Seketeli Comment fix in filtering code * src/abg-comp-filter.cc (harmful_filter::visit): Fix comment typos. 2014-04-11 Dodji Seketeli Put data member type size changes in SIZE_OR_OFFSET_CHANGE_CATEGORY * src/abg-comp-filter.cc (type_size_changed): New overload for type_base_sptr. (data_member_type_size_changed): New predicate. (harmful_filter::visit): Use the new predicate to categorize data member type size changes into the SIZE_OR_OFFSET_CHANGE_CATEGORY. 2014-04-11 Dodji Seketeli 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. 2014-04-11 Dodji Seketeli Unmark class_diff node as being traversed once traversal is finished * src/abg-comparison.cc (class_diff:traverse): Unmark class_diff node as being traversed once traversal is finished 2014-04-11 Dodji Seketeli Do not use the parent diff node link for category propagation * src/abg-comparison.cc (class_diff::traverse): Use the new TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY macro to propagate categorization from the children diff nodes to the current one for bases, data members and member functions. (scope_diff::traverse): Likewise, use the TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY to propagate categorization from the children diff nodes to the current one. 2014-04-11 Dodji Seketeli 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. 2014-04-11 Dodji Seketeli Factorize diff sub-tree traversal and category propagation code * src/abg-comparison.cc (TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY): New macros. ({distinct_diff, pointer_diff, reference_diff, qualified_type_diff, enum_diff, base_diff, function_decl_diff, typedef_diff}::traverse): Use the new macro above in lieu of the duplicated sub-tree traversal code in there. 2014-04-11 Dodji Seketeli Style fixes in the diff nodes traversing code * src/abg-comparison.cc (TRY_{PRE, PRO}_VISIT, TRY_{PRE, PRO}_VISIT_CLASS_DIFF, ): Add a white space. 2014-04-10 Dodji Seketeli Supporting reporting data member name change * src/abg-comparison.cc (represent): Support reporting data member name change. 2014-04-10 Dodji Seketeli 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. 2014-04-10 Dodji Seketeli Add missing comment * src/abg-ir.cc (non_type_tparameter::get_hash): Add missing api doc. 2014-04-09 Dodji Seketeli 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}::hash::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}::hash::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::hash::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. 2014-04-08 Dodji Seketeli 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::hash::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. 2014-04-08 Dodji Seketeli Properly place opening quote and add missing closing quote in report * src/abg-comparison.cc (corpus_diff::report): Move the [{A,D}] marker before the opening quote. And add a closing quote. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. 2014-04-08 Dodji Seketeli Drive-by indentation fix * src/abg-dwarf-reader.cc (build_ir_node_from_die): Fix indentation. 2014-04-08 Dodji Seketeli Drop ABI artifacts that are local to a function * src/abg-dwarf-reader.cc (get_scope_for_die): If the parent die is DW_TAG_subprogram then just drop the whole thing on the floor. (build_ir_node_from_die): When the scope is NULL, just drop the whole thing on the floor. 2014-04-08 Dodji Seketeli Fix the static data member recognition hack * src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir): When trying to recognize the global var_decl as being definition variables for static data members, lookup the declaration for the data member in the relevant class. If found, then just flag the var_decl for the data member as being static; no need to add a var_decl as data member in that case, that would duplicate the data member. 2014-04-08 Dodji Seketeli Fix looking up a node inside a class * src/abg-ir.cc (lookup_node_in_scope): Do not forget to actually look at the class members. Sigh. 2014-04-07 Dodji Seketeli Work around old dwarf producers forgetting mangled names for functions * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): If lookup using mangled name for a deleted function yields nada, try the lookup with the pretty representation for the function. 2014-04-07 Dodji Seketeli 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). 2014-04-07 Dodji Seketeli 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. 2014-04-06 Dodji Seketeli 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. 2014-04-05 Dodji Seketeli Emit qualified name for typedefs * src/abg-comparison.cc (typedef_diff::report): Emit qualified names for typedefs in diff reports about typedef name changes. 2014-04-05 Dodji Seketeli Fix indentation in distinct type diff report * src/abg-comparison.cc (distinct_diff::report): Do not forget to change line. 2014-04-05 Dodji Seketeli Really compare return types for function types * src/abg-ir.cc (compare_function_types): Compare return types, unless this is a method and the return type is the same type as the containing class type. * tests/data/test-diff-dwarf/test5-report.txt: Reference report for the comparison of the two input binaries below. * tests/data/test-diff-dwarf/test5-v0.cc: Source code for the input binary below. * tests/data/test-diff-dwarf/test5-v0.o: Test input binary. * tests/data/test-diff-dwarf/test5-v1.cc: Source code for the input binary below. * tests/data/test-diff-dwarf/test5-v1.o: Test input binary. 2014-04-05 Dodji Seketeli Add missing tests for previous commits * tests/data/test-diff-dwarf/test4-report.txt: Adjust. * tests/test-diff-dwarf.cc: Run tests for data/test-diff-dwarf/test3-report.txt" and data/test-diff-dwarf/test4-report.txt. 2014-04-05 Dodji Seketeli Categorize through compatible distinct type diffs * src/abg-comparison.cc (report_size_and_alignment_changes): Split this static function out of ... (report_name_size_and_alignment_changes): ... this one. (distinct_diff::report): If the typedef-stripped variants of the diff subjects are of the same kind, display their diff. Otherwise, tell explicitly is the distinct type diff involves a type size change. (distinct_diff::traverse): If the typedef-stripped variants of the diff subjects are of the same kind, traverse that underlying diff sub-tree and propagate the categorizing possibly resulting from that traversal. * tests/data/test-diff-dwarf/test4-v0.o: New test input binary. * tests/data/test-diff-dwarf/test4-v0.cc: Source code for the input binary above. * tests/data/test-diff-dwarf/test4-v1.o: New test input binary. * tests/data/test-diff-dwarf/test4-v1.cc: Source code for the input binary above. * tests/data/test-diff-dwarf/test4-report.txt: Reference report for the difference between the two binaries above. * tests/data/test-diff-filter/test5-v0.o: New test input binary. * tests/data/test-diff-filter/test5-v0.cc: Source code for the input binary above. * tests/data/test-diff-filter/test5-v1.o: New test input binary. * tests/data/test-diff-filter/test5-v1.cc: Source code for the input binary above. * tests/data/test-diff-filter/test5-report.txt: Reference report for the difference between the two binaries above. * tests/test-diff-filter.cc: Adjust to produce a filtered diff for the two input binaries above. * tests/Makefile.am: Adjust to add missing test files to the distribution. 2014-04-04 Dodji Seketeli Slight run-by fixes * src/abg-comparison.cc (corpus_diff::priv::apply_filters_and_compute_diff_stats) (corpus_diff::report): Use compute_diff for types which it has an overload rather than going through the compute_diff_for_decls that would use dynamic casting. 2014-04-04 Dodji Seketeli Do not hook type diff nodes to a parent * abg/comparison.cc (var_diff::var_diff): Do not set parent node for the type diff of the var_diff. (var_diff::traverse): Handle category propagation from the type diff node to the var_diff node. (pointer_diff::underlying_type_diff) (reference_diff::underlying_type_diff) (qualified_type_diff::underlying_type_diff, enum_diff::enum_diff) (base_diff::get_underlying_class_diff) (typedef_diff::underlying_type_diff): Do not set the parent node here. ({pointer_diff, reference_diff, qualified_type, enum_diff, class_diff, base_diff, function_decl_diff, typedef_diff}::traverse): Handle category propagation here. * tests/data/test-diff-filter/test4-v0.o: New input binary. * tests/data/test-diff-filter/test4-v0.cc: Source code for the input binary above. * tests/data/test-diff-filter/test4-v1.o: New input binary. * tests/data/test-diff-filter/test4-v1.cc: Source code for the input binary above. * tests/data/test-diff-filter/test4-report.txt: Reference diff report for the input binaries above. * tests/test-diff-filter.cc:: Run bidiff --no-harmless on the binaries above. 2014-04-04 Dodji Seketeli Fix off-by one comparison bug in comparing function parameters * src/abg-comparison.cc (function_decl_diff::ensure_lookup_tables_populated): Function parameters that are diff'ed start at the first non-implicit parameter, not at the first parameter. Oops. * tests/data/test-diff-dwarf/test3-v0.o: New test input binary. * tests/data/test-diff-dwarf/test3-v0.cc: Source code for the binary above. * tests/data/test-diff-dwarf/test3-v1.o: New test input binary. * tests/data/test-diff-dwarf/test3-v1.cc: Source code for the binary above. * tests/data/test-diff-dwarf/test3-report.txt: Reference report for the diff of the new test inputs. * tests/test-diff-dwarf.cc: Use the test inputs above to run new tests. 2014-04-03 Dodji Seketeli Do not forget parm sub-type changes as opposed to parm changes * src/abg-comparison.cc (function_decl_diff::ensure_lookup_tables_populated): A parm change is valid only when the added parm has a different name from the removed parm. Both have the same index, of course. In that case, do not try to remove the corresponding parm sub-type change. * tests/data/test-bidiff/test-enum0-report.txt: Adjust. * tests/data/test-bidiff/test-enum1-report.txt: Adjust. * tests/data/test-bidiff/test-qual-type0-report.txt: Adjust. * tests/data/test-bidiff/test-struct0-report.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. * tests/data/test-diff-dwarf/test1-report.txt: Adjust. * tests/data/test-diff-filter/test0-report.txt: Adjust. * tests/data/test-diff-filter/test01-report.txt: Adjust. * tests/data/test-diff-filter/test1-report.txt: Adjust. * tests/data/test-diff-filter/test2-report.txt: Adjust. * tests/data/test-diff-filter/test3-report.txt: Adjust. 2014-04-03 Dodji Seketeli Remove useless white space * src/abg-ir.cc (look_through_decl_only_class): Remove useless white space. 2014-04-02 Dodji Seketeli Use mangled name for decl comparison when it's present * src/abg-ir.cc (decl_base::operator==(const decl_base& other) const): Use the mangled name of the decl in priority. * src/abg-hash.cc (struct decl_base::hash::operator()): Likewise. * src/abg-comparison.cc (function_decl_diff::report): Do not report a function name change if it doesn't involve a mangled name change. This might change when we start dealing with templates. 2014-04-02 Dodji Seketeli A change involving a decl-only class is not SIZE_OR_OFFSET_CHANGE_CATEGORY * src/abg-comp-filter.cc (harmful_filter::visit): If a size change involves a decl-only class, it certainly shouldn't trigger putting the sub-tree into the SIZE_OR_OFFSET_CHANGE_CATEGORY category. 2014-04-02 Dodji Seketeli Fix heuristics to detect function static-ness for DWARF < 3 * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Make the heuristics work for functions with no parameters. 2014-04-02 Dodji Seketeli Avoid emitting local filtered-out changes in more spots * src/abg-comparison.cc (maybe_report_diff_for_member): Take the diff_context in parameter. Use that to check if local changes of category ACCESS_CHANGE_CATEGORY are filtered-out and do not report the change in that case. ({var_diff, enum_diff, class_diff, base_diff, function_decl_diff}::report): Adjust. 2014-04-02 Dodji Seketeli 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. 2014-04-01 Dodji Seketeli Don't emit local filtered-out changes * src/abg-comparison.cc (represent): For var_decl, do not emit filtered-out local size/offset/access changes. (report_name_size_and_alignment_changes): Take the diff context. Do not report filtered-out local size/offset changes. ({var_diff, enum_diff, class_diff, type_decl_diff}::report): Adjust. * test0-report.txt: Adjust. * test01-report.txt: New reference report for the same inputs test0-v{1,0}.o, but called without the --no-harmless command line. * tests/data/test-diff-filter/test2-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test2-v1.cc: Likewise. * tests/data/test-diff-filter/test2-v0.o: New test input. * tests/data/test-diff-filter/test2-v1.o: Likewise. * tests/data/test-diff-filter/test2-report.txt: Reference report for new test input. * tests/test-diff-filter.cc: Consume the test inputs above. * tests/Makefile.am: Add the new test inputs above to the distribution. 2014-04-01 Dodji Seketeli 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. 2014-03-31 Dodji Seketeli Fix thinko class_diff traversing. * src/abg-comparison.cc (class_diff::traverse): Fix thinking in introduced by commit "6709478 Fix infinite loop when traversing classes and their members" * tests/data/test-diff-filter/test1-v{0,1}.o: New test binary input files. * tests/data/test-diff-filter/test1-v{0,1}.cc: Source code for the above. * tests/data/test-diff-filter/test1-report.txt: Reference report for the diffing of the two binary input files above. * tests/test-diff-filter.cc: Make the test run on the new input above. * tests/Makefile.am: Add the new material to the distribution. 2014-03-31 Dodji Seketeli Add forgotten test output adjustment * tests/data/test-diff-filter/test0-report.txt: Adjust for the commit "a8d5284 Fix diff report indentation issue" * tests/data/test-diff-dwarf/test{0,1}-report.txt: Likewise. 2014-03-31 Dodji Seketeli Add forgotten source file for binary test input * tests/data/test-diff-dwarf/test1-v0.cc: New file. * tests/data/test-diff-dwarf/test1-v1.cc: Likewise. 2014-03-31 Dodji Seketeli Fix diff report indentation issue * abg-comparison.cc (corpus_diff::report): Indent the details of function changes. 2014-03-31 Dodji Seketeli Fix infinite loop when traversing classes and their members * src/abg-comparison.cc (TRY_{PRE,POST}_VISIT_CLASS_DIFF): New macros. (class_diff::priv::traversing_): New flag. (class_diff::priv::priv): New constructor to initialize the new flag above. (class_diff::traversing): Do not traverse the diff again if it's being traversed already. 2014-03-31 Dodji Seketeli Fix access_changed and data_member_offset_changed predicates * src/abg-comp-filter.cc (access_changed) (data_member_offset_changed): Fix detection of membership. 2014-03-29 Dodji Seketeli 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. 2014-03-29 Dodji Seketeli Fix var_diff length determination * src/abg-comparison.cc (var_diff::length): Just compare the two diff subjects. 2014-03-29 Dodji Seketeli Fix typos in the test-diff-dwarf.cc source code * tests/test-diff-dwarf.cc: Fix various typos. 2014-03-27 Dodji Seketeli 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. 2014-03-26 Dodji Seketeli Add missing headers double inclusion guards * include/abg-comparison.h: Add a missing double inclusion guard. * include/abg-diff-utils.h: Likewise. 2014-03-26 Dodji Seketeli Add a missing apostrophe to access reporting * src/abg-comparison.cc (represent): For member var_decls, add a missing apostrophe after the access. * tests/data/test-diff-dwarf/test0-report.txt: Update test report. 2014-03-21 Dodji Seketeli Fix diff emptiness detection for function_decl_diff nodes * src/abg-comparison.cc (function_decl_diff::length): Just compare the two functions here, damit. * tests/data/test-diff-dwarf/test0-report.txt: Adjust. 2014-03-21 Dodji Seketeli Fixlets in the bidiff regression testing harness * tests/test-bidiff.cc (main): Fix a typo. Fix the path to the output path. 2014-03-21 Dodji Seketeli Initial regression test for dwarf diffing * tests/test-diff-dwarf.cc: New dwarf diffing regression test harness. * tests/data/test-diff-dwarf/test0-report.txt: New test input. * tests/data/test-diff-dwarf/test0-v0.cc: Likewise. * 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/Makefile.am: Add the new test inputs from tests/test-diff-dwarf.cc and tests/data/test-diff-dwarf/* to the build system. 2014-03-21 Dodji Seketeli Rename test-walker.cc into test-ir-walker.cc * tests/test-ir-walker.cc: Renamed test-walker.cc into this. * tests/Makefile.am: Adjust. The generated binary is now testirwalker. 2014-03-21 Dodji Seketeli 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. 2014-03-19 Dodji Seketeli 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. 2014-03-26 Jonathan Wakely Fix comment typos * include/abg-diff-utils.h (compute_diff): Fix typo in apidoc comment. 2014-03-24 Dodji Seketeli Follow DW_AT_abstract_origin and add missing mangled name * src/abg-dwarf-reader.cc (build_function_decl): Change signature to take function_decl to which one shall add properties that got added by subsequent DIEs later. (build_class_type_and_add_to_ir): Adjust. (build_function_decl): Allow adding new properties to an existing function_decl. Add the mangled name in particular. * tests/data/test-read-dwarf/test1.abi: Update test. 2014-03-20 Dodji Seketeli Fix destructor naming. * src/abg-ir.cc (function_decl::get_pretty_representation): In DWARF at least, the destructor function name already contains the '~'. No need to add it. 2014-03-20 Dodji Seketeli Better static function determination heuristic * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Better heuristic. 2014-03-20 Dodji Seketeli 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. 2014-03-20 Dodji Seketeli Slight indentation fix in the diff report * src/abg-comparison.cc (class_diff::report): Indentation fix for member function changes report. 2014-03-20 Dodji Seketeli 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::hash::operator()): Use the fully qualified name of the decl in the hash, to increase the likelihood of avoiding hash collisions. (method_type::hash::operator()): Likewise. (function_decl::hash::operator()): Take member functions in account. (class_decl::member_function::hash::operator()): Remove. (class_decl::hash::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. 2014-03-19 Dodji Seketeli 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::hash::operator()): Adjust. (class_decl::data_member::hash::operator()): Remove. (decl_base::hash::operator()): Take the context relationship in account here. (decl_base::hash_as_member::operator()): Remove. ({enum_type_decl,typedef_decl}::hash::operator()): Adjust. (class_decl::member_function::hash::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. 2014-03-18 Dodji Seketeli 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}::hash::operator()): Do not hash the implicit parm of member functions. (class_decl::hash::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. 2014-03-13 Dodji Seketeli Do not report change in typedef underlying type is there is none * src/abg-comparison.cc (typedef_diff::report): Do not forget to check the length of the diff of the underlying type before sending its diff report down the wire. 2014-03-13 Dodji Seketeli Avoid hashing a access & static-ness of member types twice * src/abg-hash.cc (class_decl::hash::operator()): Do hash the 'member' part of the member types here, it has been hashed already. 2014-03-13 Dodji Seketeli Set class {size,loc} when adding members to a decl-only class * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Do not forget to set class size and location when adding members to a declaration-only class, turning it into a definition class. 2014-03-13 Dodji Seketeli 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}::hash::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. 2014-03-12 Dodji Seketeli Avoid more static_casts in the (comparison) code * src/abg-ir.cc (class_decl::insert_member_type, operator==): Remove static_casts. (class_decl::member_type::operator==): Likewise. (class_decl::member_class_template::operator==): Likewise. 2014-03-12 Dodji Seketeli 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_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::hash::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. 2014-03-12 Jonathan Wakely Fixed typos in abg-diff-utils.h * include/abg-diff-utils.h (compute_diff): Fix typos in the API doc. 2014-03-11 Dodji Seketeli Initialize a variable * tools/bilint.cc (main): Initialize the 'r' variable. 2014-03-11 Dodji Seketeli Do not declare classes before defining them anymore * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Do not declare classes before defining them because both the declaration and the definition now compare equal. * tests/data/test-read-dwarf/test1.abi: Update test. * tests/data/test-read-write/test20.xml: Likewise. 2014-03-11 Dodji Seketeli Little style fix * src/abg-comparison.cc (class_diff::report): Slight style fix. 2014-03-10 Dodji Seketeli 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. 2014-03-10 Dodji Seketeli Fix comparison wrt hash number * src/abg-ir.cc (decl_base::operator==): Do not consider empty hashes. (class_decl::operator==): Better support for comparing decl-only classes against non-decl-only classes. 2014-03-10 Dodji Seketeli Better support of class DIEs with DW_AT_specification * src/abg-dwarf-reader.cc (get_scope_for_die): The definition of a declaration-only class can be NULL. Do not look through in that case. (build_class_type_and_add_to_ir): Support adding class members to an existing class. (build_ir_node_from_die): If a class DIE has a DW_AT_specification, get the specification DIE, get its matching IR node and add the current members of the current DIE to that IR node. 2014-03-10 Dodji Seketeli 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. 2014-03-06 Dodji Seketeli Fix typedef_diff emptyness detection * src/abg-comparison.cc (typedef_diff::length): Do not mask away the dynamic type of the typedef_decl before the comparison. 2014-02-28 Dodji Seketeli 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. 2014-02-28 Dodji Seketeli Style fix in the dwarf reader * src/abg-dwarf-reader.cc (die_is_public_decl): Rename is_public_decl into this. (die_is_declaration_only): Rename is_declaration_only into this. (build_class_type_and_add_to_ir, build_var_decl) (build_function_decl): Adjust for the renames above. 2014-02-28 Dodji Seketeli Skip artificial (member) functions from DWARF * src/abg-dwarf-reader.cc (die_is_artificial): New static function. (build_class_type_and_add_to_ir, build_ir_node_from_die): Use the die_is_artificial function to test if the function DIE is artificial and then skip it. 2014-02-28 Dodji Seketeli 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. 2014-02-28 Dodji Seketeli 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. 2014-02-28 Dodji Seketeli Report about functions of different names * src/abg-comparison.cc (function_decl_diff::report): Consider the case of functions with different names. This doesn't happen in the current pipeline b/c they just show up as deleted/added functions so the function reporter doesn't see them as they have been already reported by now. 2014-02-28 Dodji Seketeli Fix length calculation for type diffs. * src/abg-comparison.cc (diff_length_of_type_bases): Fix stupid harmful thinko here. 2014-02-28 Dodji Seketeli Fix calculation of the length of distinct_diff * src/abg-comparison.cc (distinct_diff::length): Also perform a deep comparison here. 2014-02-28 Dodji Seketeli Fix diff length calculation for typedef diffs * src/abg-comparison.cc (typedef_diff::length): Just use comparison for this. 2014-02-28 Dodji Seketeli Fix layout of diff summary * src/abg-comparison.cc (corpus_diff::priv::emit_corpus_diff_stats): Remove useless vertical and horizontal white spaces. 2014-02-28 Dodji Seketeli Fix indentation of pieces of class diff report * src/abg-comparison.cc (represent, class_diff::report): Fix indentation. 2014-02-28 Dodji Seketeli Fix detection of entities of different kinds for diff purposes * src/abg-comparison.cc (distinct_diff::entities_are_of_distinct_kinds): Consider two NULL decls are distinct types for the purpose of diffing. This is just a shortcut to avoid creating a null_diff type for now. But then, stop considering same pointers as different. This was a bug. 2014-02-28 Dodji Seketeli Constify function_decl::parameter::get_type_pretty_representation() * include/abg-ir.h (function_decl::parameter::get_type_pretty_representation): This is now const. 2014-02-28 Dodji Seketeli Improve API doc for the location machinery * include/abg-ir.h (class location): Improve doc. (decl_base::{get,set}_location): Likewise. 2014-02-26 Dodji Seketeli Remove useless dynamic cast * src/abg-ir.cc (class_decl::insert_member_decl): Remove useless dynamic cast from here. 2014-02-26 Dodji Seketeli Insert reference, pointers and qual types at their declaration point * src/abg-dwarf-reader.cc (build_ir_node_from_die): Insert reference, pointers and qualified types at the point where we see them, in their scope, rather than under the scope of their underlying type. This is because their might be first declared as member types and we don't want to loose that information. 2014-02-24 Dodji Seketeli Fix documentation for the diff_utils namespace * include/abg-diff-utils.h (namespace diff_utils): Add comment. (compute_diff): Update comments for some overloads where they were missing. 2014-02-21 Dodji Seketeli Misc style fixes * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): use as_non_member_class_decl rather that complicated casting. src/abg-ir.cc (var_decl::get_pretty_representation): Use get_type_declaration rather than casting. 2014-02-21 Dodji Seketeli Fix a glitch in member data diff reporting * src/abg-comparison.cc (represent): Do not forget the "'" around the access specifier. 2014-02-21 Dodji Seketeli Proper support for diffing member types * include/abg-comparison.h (class member_type_diff): New class. (member_type_diff_sptr): New convenience typedef. (compute_diff): New overload for member_type_diff. * src/abg-comparison.cc (struct member_type_diff::priv): New definition. (member_type_diff::{first_member_type, second_member_type, underlying_type_diff, length}): New member function definitions. (compute_diff): New definition for member type diffs. (compute_diff_for_types): Support diffing member types. (class_diff::report): Do not use strip member types now that we can properly diff them. 2014-02-21 Dodji Seketeli Fix the support for printing cv-qualified names * include/abg-ir.h (decl_base::{location_, name_, qualified_parent_name_, qualified_name_}): Make these data members protected rather than private. (decl_base::get_qualified_parent_name): Declare new member functions. (decl_base::get_qualified_name): Make the core overload virtual. Simplify the other overload that calls the core one. (qualified_type_def::build_name): Declare new protected helper function. (qualified_type_def::{get_cv_quals_string_prefix, get_qualified_name}): Declare new functions. (pointer_type_def::{get_qualified_name}}): Likewise. (class_decl::member_type::get_qualified_name): Likewise. * src/abg-ir.cc (decl_base::get_qualified_parent_name): New definition. (decl_base::get_name): Make this out-of-line. (decl_base::get_qualified_name): The signature of this got simplified. Make it use the new get_qualified_parent_name. (qualified_type_def::{build_name, get_qualified_name, get_cv_quals_string_prefix}): New definitions. (qualified_type_def::qualified_type_def): Update the constructor to use the new build_name function above. (pointer_type_def::get_qualified_name): New definitions. (reference_type_def::get_qualified_name): Likewise. (class_decl::member_type::get_qualified_name): Likewise. 2014-02-21 Dodji Seketeli Misc style fix * src/abg-comparison.cc (represent): Remove useless curly braces and vertical spaces. 2014-02-21 Dodji Seketeli Support DW_AT_specification on class/struct DIEs * src/abg-dwarf-reader.cc (build_ir_node_from_die): Support DW_AT_specification on DW_TAG_{class,structure}type. 2014-02-21 Dodji Seketeli Avoid comparing member types and class templates * src/abg-comparison.h (compute_diff): For class_decl_sptr, do not compare member types and member class templates. This adds a lots of noise that is not necessarily useful for now. * tests/data/test-bidiff/test-qual-type0-report.txt: Update tests. * tests/data/test-bidiff/test-struct0-report.txt: Likewise. * tests/data/test-bidiff/test-struct1-report.txt: Likewise. 2014-02-21 Dodji Seketeli Fix the report of added/removed function parameters * src/abg-comparison.cc (function_decl_diff::priv::{inserted_parms_, removed_parms_}): Remove these. (function_decl_diff::ensure_lookup_tables_populated): Fix thinko. Avoid using the members removed above. Use one less loop to update the changed params. (function_decl_diff::report): Avoid using the removed_parms_ data member that was removed above. 2014-02-21 Dodji Seketeli Put the setter of access specifiers in class_decl::member_base * include/abg-ir.h (class_decl::member_base::set_access_specifier): Put the setter for access specifier here, where it belongs ... (class_decl::member_type::set_access_specifier): ... not here. 2014-02-21 Dodji Seketeli First approach to avoid duplication of IR nodes for forward-declared classes * src/abg-dwarf-reader.cc (is_declaration_only): Put this back (I removed it earlier). (build_class_type_and_add_to_ir): If the class is a declaration-only (a forward declaration), do not add a new declaration only IR node. 2014-02-21 Dodji Seketeli Do not forget to set the indexes of fn parms * include/abg-ir.h (function_type::function_type): In the constructor that takes a vector of parms, walk the vector and set the indexes of the parms. 2014-02-19 Dodji Seketeli Misc diff reporting output cleanup * src/abg-comparison.cc (function_decl_diff::report): Do not talk about changed function anymore. Rather, say that some indirect sub-types changed in the function. 2014-02-19 Dodji Seketeli Do not forget some member types/functions we built IR nodes for * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Associate the member type IR node to the offset of the die of the member type. (build_ir_node_from_die): For a DW_TAG_subprogram DIE that has a DW_AT_specification pointing to another subprogram DIE, associate the offset of this DIE to the IR node of that other DIE. 2014-02-19 Dodji Seketeli Better support of static member variables * include/abg-fwd.h (fqn_to_components) (lookup_type_in_translation_unit, demangle_cplus_mangled_name): Declare new public entry points * src/abg-comparison.cc (corpus_diff::report): Report stuff about global variables using their mangled name, and demangle them. If there is no mangled name for the variable, then use its pretty representation. (compute_diff): For the corpus overload, compare global variables using their mangled name, if its available; otherwise, fall back to using their pretty representation. * src/abg-corpus.cc (var_comp::operator()(const var_decl*, const_var_decl*)): Compare variables using their mangled name in priority. If it's not available then use their pretty representation. * src/abg-dwarf-reader.cc (read_context::var_decls_to_re_add_to_tree): New accessor. (build_translation_unit_and_add_to_ir): If there is what appears to be a definition of a static member variable variable -- this is in case this definition lacks the DW_AT_specification attribute that links it to the DW_TAG_member or DW_TAG_variable DIE that is a child of the right class/structure DIE -- that is not at the right place in the DIE tree, remove it from the its current place in the tree and try to hang it off of the right DIE. To do this, de-mangle its mangled name, look at what is supposed to be the parent class name, look it up in the translation unit IR, and if found, stick the variable IR node in there, as a static member variable. If not found, then bad luck. (build_class_type_and_add_to_ir): Do not try to see if a member variable is static here as the way I was doing it was unreliable. Build the data member node directly w/o going through building a variable node first. Register the data member in the die offset -> IR node map. (build_ir_node_from_die): When seeing DW_TAG_variable, look for a DW_AT_specification attribute. If there is one, then it points to a the DIE of a data member and means that data member is static. Flag the IR node of that data member as static thus. Update the die offset -> IR node map. If there is no DW_AT_specification attribute or if it doesn't point to a data member DIE, schedule this variable tag for a stage when after the whole IR is built for the translation unit, the variable's mangled named is inspected, its hypothetical parent struct/class is looked up and the variable IR node is put into the node of the right struct/class IR node. * src/abg-ir.cc (enum lookup_entity_kind): New. (fqn_to_components, iterator, lookup_type_in_translation_unit) (lookup_node_in_translation_unit, lookup_type_in_translation_unit) (demangle_cplus_mangled_name): New function definitions. 2014-02-19 Dodji Seketeli Shorten an accessor name in the DWARF reader * src/abg-dwarf-reader.cc (read_context::cur_tu): Rename read_context::current_translation_unit into this. (read_context::current_scope, die_location) (build_translation_unit_and_add_to_ir, build_enum_type) (build_function_decl): Adjust wrt the change above. 2014-02-19 Dodji Seketeli Unset decl scope when removing the decl from its scope * src/abg-ir.cc (remove_decl_from_scope): Unset the scope of the decl. 2014-02-19 Dodji Seketeli Support adding data member from var_decl * src/abg-ir.cc (class_decl::insert_member_decl): Support taking a var_decl. (class_decl::add_data_member): Do not insert a data member twice. 2014-02-19 Dodji Seketeli Fix qualified type pretty printing * src/abg-ir.cc (qualified_type_def::qualified_type_def): Remove useless white space. 2014-02-19 Dodji Seketeli Add class_decl::member_base::set_is_static() accessor * include/abg-ir.h (class_decl::member_base::get_is_static): Rename is_static into get_is_static. (class_decl::member_base::set_is_static): New accessor. * src/abg-comparison.cc (represent): Adjust for class_decl::member_base::is_static -> get_is_static. * src/abg-corpus.cc (symtab_build_visitor_type::visit): Likewise. src/abg-hash.cc (class_decl::member_function::hash::operator()): Likewise. * src/abg-ir.cc (class_decl::member_base::operator==): Likewise. * src/abg-writer.cc (write_class_decl): Likewise. 2014-02-13 Dodji Seketeli Fixes needed to diff libstdc++ v4_4 against master * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): Support several instances of the same member function being deleted. That can happen when the same member function was present in the initial class several times. Yeah, I've seen that in dwarf. * src/abg-corpus.cc (corpus::priv::build_symbol_table): Do not add the same variable (identified by its mangled name) twice in the variable symbol table. 2014-02-13 Dodji Seketeli Fix wrong deleted functions count when diffing corpora * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): If a function has changed, deleted it from the list the removed functions. 2014-02-13 Dodji Seketeli Several fixes needed to read libstdc++.so * src/abg-reader.cc (read_context::map_id_and_node): Allow duplicated class and basic type declarations. (build_type_decl): Allow duplicated type decls. (build_qualified_type_decl, build_pointer_type_def) (build_reference_type_def): As there can be several distinct duplicated types, compare them by value. (build_class_decl): There can be duplicated class decls. * src/abg-writer.cc (write_enum_type_decl): The name of the enum needs to be xml-escaped. 2014-02-12 Dodji Seketeli qualified, pointer and reference types can be member types * src/abg-reader.cc (build_qualified_type_decl) (build_pointer_type_def, build_reference_type_def): Consider that these types can be member types. 2014-02-12 Dodji Seketeli Consider two typedefs with different names to be different * src/abg-ir.cc (typedef_decl::operator==): Consider two typedefs with different names to be different. 2014-02-12 Dodji Seketeli Really Avoid trying to build IR nodes for non-public functions * src/abg-dwarf-reader.cc (build_ir_node_from_die): For the DW_TAG_subprogram case, bail out early if the current function is non-public. 2014-02-12 Dodji Seketeli Add --{changed,deleted,added}-{fns,vars} options to bidiff * include/abg-comparison.h (diff_context::{show_{deleted,changed_added}_{fns,vars}}): Declare new accessors. (corpus_diff::context): Declare new getter. * src/abg-comparison.cc (diff_context::{show_{deleted,changed_added}_{fns,vars}}): Define these new accessors. (corpus_diff::priv::emit_corpus_diff_stats): Define new function. (corpus_diff::context()): Define new getter. (corpus_diff::report): Use the new corpus_diff::priv::emit_corpus_diff_stats to emit diff stats at the beginning of the report. Conditionalise emitting the different parts of the reports (changed,deleted,added stuff) on the values of the new properties that were just added. * tools/bidiff.cc (options::{show_{deleted,changed,added}_{fns,vars}): New properties. (display_usage, parse_command_line): Update for the newly added --{changed,deleted,added}-{fns,vars} command line options. (set_diff_context_from_opts): Define new static function. (main): Create a diff context, initialize it from the options (using set_diff_context_from_opts) and pass it to compute_diff. 2014-02-11 Dodji Seketeli Add --show-symtabs to bidiff * tools/bidiff.cc (display_usage): Update usage string. (parse_command_line): Recognize the --show-symtab cmdline option. (display_symtabs): New static function. (main): Call the new display_symtabs. 2014-02-11 Dodji Seketeli Harden class_decl node traversal code * src/abg-ir.cc (class_decl::traverse): Add a few asserts here and there. 2014-02-11 Dodji Seketeli Fix the pretty representation for member functions * src/abg-ir.cc (function_decl::get_pretty_representation): Fix this to properly display the representation of member functions. * tests/data/test-bidiff/test-enum0-report.txt: Update this. * tests/data/test-bidiff/test-enum1-report.txt: Likewise. * tests/data/test-bidiff/test-qual-type0-report.txt: Likewise. * tests/data/test-bidiff/test-struct0-report.txt: Likewise. * tests/data/test-bidiff/test-struct1-report.txt: Likewise. 2014-02-11 Dodji Seketeli Do not forget to traverse member types * include/abg-ir.h (class_decl::member_type::traverse): Declare new virtual function. (ir_node_visitor::visit): Declare new virtual function * src/abg-ir.cc (class_decl::member_type::traverse): Implement the traversal of a member type. (ir_node_visitor::visit): Provide a default implementation for the visitor of member type. 2014-02-11 Dodji Seketeli From DWARD, avoid adding IR nodes for member functions twice * include/abg-fwd.h (as_non_member_class_decl): Declare new overload. * src/abg-ir.cc (as_non_member_class_decl): Define new overload. * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Add member functions to the DIE -> IR Node map. (build_ir_node_from_die): Assert that DW_TAG_subprogram cannot be for a member function here because getting the scope of the member function would have constructed the entire class that contains it, including the member function. Then, calling build_ir_node_from_die for the DIE of the member function would find the already IR Node in the DIE -> IR Node map. 2014-02-11 Dodji Seketeli Fix access specifiers value * include/abg-ir.h (class_decl::enum access_specifier): Give the enumerators the same values as what the DWARF spec says. 2014-02-10 Dodji Seketeli Misc diff report cleanups * include/abg-ir.h (function_decl::parameter::get_type_name): Add comment. (function_decl::parameter::get_type_pretty_representation): New member fn. * src/abg-comparison.cc (represent): When representing changed members, use their pretty representation. (function_decl_diff::{ensure_lookup_tables_populated, report}): Use the pretty representation of parameters type. (typedef_diff::report): Enclose the underlying type in "'". (corpus_diff::report): Add proper spacing. 2014-02-10 Dodji Seketeli Re-organize the output of diffing two corpora * src/abg-comparison.cc (corpus_diff::report): Emit information about the number of added/removed/changed functions. If the report is big, prefix any added function with '[A]' deleted function with '[B]'. Also, fix indentation. 2014-02-10 Dodji Seketeli Support diffing entities of different kinds. * include/abg-comparison.h (class distinct_diff): Declare new type. (compute_diff_for_distinct_kinds): Declare new function. * src/abg-comparison.cc (distinct_diff::{distinct_diff, first, second, entities_are_of_distinct_kinds, length, report}): Define new member functions. (compute_diff_for_distinct_kinds, try_to_diff_distinct_kinds): Define new function. (compute_diff_for_types, compute_diff_for_decls): Support diffing entities of different kinds. 2014-02-10 Dodji Seketeli Avoid recursive comparison on class_decl & perform some optimizations * src/abg-ir.cc (class_decl::operator==(const decl_base& other) const): Bail out early in case of recursive comparison, or if type hashes are different. Do not try to compute qualified name unless it's really necessary. The optimizations part of this change were hinted by profiling. 2014-02-10 Dodji Seketeli Handle the DIE for a fn that has a 'specification' attribute * src/abg-dwarf-reader.cc (build_ir_node_from_die): For the DW_TAG_subprogram case, if the function has a DW_AT_specification attribute, build the IR node for the specification DIE instead. 2014-02-10 Dodji Seketeli Add an assert in the dwarf reader * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Assert that the result of build_function_decl on a member function is a method_decl. 2014-02-10 Dodji Seketeli Do not forget that build_ir_node_from_die can return member types * src/abg-dwarf-reader.cc (get_scope_for_die): Handle member class types. (build_function_decl): Likewise. 2014-02-10 Dodji Seketeli A member function can have an empty mangled name * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): If a member function has an empty mangling name, use its pretty representation. 2014-02-10 Dodji Seketeli Remove too eager asserts * src/abg-comparison.cc (class_diff::ensure_lookup_tables_populated): Do not assert that the same member type cannot be deleted/inserted twice. It actually can for, pointers, references, typedefs, etc. 2014-02-10 Dodji Seketeli Fix some new line handling in diff reports * src/abg-comparison.cc (represent): Remove extra new line after reporting virtual function number. (class_diff::report): Do not forget to emit a new line between two inserted functions. 2014-02-10 Dodji Seketeli Perform the diff of changed functions and variables in the right order * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): In a changed function or variable, do not mix up the new and old value. 2014-02-10 Dodji Seketeli Fix typo in report * src/abg-comparison.cc (reference_diff::report): Fix typo refereneced -> referenced. 2014-02-10 Dodji Seketeli Fix various crashes * src/abg-comparison.cc (decls_equal::operator()(const decls_type, const decls_type) const): Do not crash when of the decl_types is NULL. ({pointer_diff, reference_diff, enum_diff}::length): Avoid crashing if the underlying type is NULL. * abg-ir.cc (function_decl::get_pretty_representation): Avoid crashing on member functions with empty parameter set. signed-off-by: Dodji Seketeli 2014-02-10 Dodji Seketeli More optimizations hinted by profiling * include/abg-ir.h (decl_base::qualified_name_): New member. (decl_base::get_qualified_name): Cache the qualified name. (decl_base::get_type): Return a reference on the shared pointer. (method_type::get_class_type): Likewise. (class_decl::get_definition_of_declaration): Likewise. (class_decl::member_type::get_underlying_type): Likewise. (class_decl::base_spec::get_base_class): Likewise. * src/abg-ir.cc (decl_base::get_qualified_name): Implement the caching. (class_decl::member_type::get_qualified_name): Return a reference on the shared pointer. 2014-02-10 Dodji Seketeli Avoid crashing when getting function parm type name * include/abg-ir.h (function_decl::parameter::get_type_name): New member function. * src/abg-comparison.cc (function_decl_diff::ensure_lookup_tables_populated): Use the new member function above. 2014-02-10 Dodji Seketeli Small optimization hinted by profiling * include/abg-diff-utils.h (d_path_vec::max_d): Avoid using member functions. This is relevant only when compiling w/o optimization. 2014-02-10 Dodji Seketeli Fix allocation of diff_utils::d_path_vec * include/abg-diff-utils.h (d_path_vec::d_path_vec): Do not forget to allocate enough data for reverse vectors as well. The comment of the constructor is accurate. 2014-02-07 Dodji Seketeli Misc style fixes * include/abg-hash.h (combine_hashes): Remove trailing white spaces. * include/abg-ir.h (class function_decl): Add end-of-class comment. (struct type_base::cached_hash): Fix comment. * src/abg-comparison.cc: Remove useless new line. * src/abg-corpus.cc: Likewise. * src/abg-writer.cc: Likewise. 2014-02-07 Dodji Seketeli Support looking through decl-only classes and update diff reports accordingly * include/abg-comparison.h (class diff_context): New class. (class diff::{ctxt_, reported_once_, currently_reporting_}): New data members. (diff::diff): Initialize the new data members above. (diff::{context, currently_reporting, reported_once}): New accessors. (compute_diff, var_diff::var_diff, pointer_diff::pointer_diff) (reference_diff::reference_diff, qualified_type_diff) (enum_diff:enum_diff, class_diff::class_diff) (scope_diff::scope_diff, function_decl_diff::function_decl_diff) (type_decl_diff::type_decl_diff, typedef_diff::typedef_diff) (translation_unit_diff::translation_unit_diff, corpus_diff::corpus_diff): Take an additional pointer to diff_context. * abg-comparison.cc (diff_context::{has_diff_for, has_diff_for_types, add_diff}): New methods. (try_to_diff, compute_diff_for_types, compute_diff_for_decls) (represent): Take an additional pointer to diff_context in argument. In the later function, do not re-report a diff if it has already been reported, or if it's being reported already. (var_diff::var_diff, pointer_diff::pointer_diff) (reference_diff::reference_diff) (qualified_type_diff::qualified_type_diff, enum_diff::enum_diff) (class_diff::class_diff, scope_diff::scope_diff) (function_decl_diff::function_decl_diff, type_decl::type_decl) (typedef_diff::typedef_diff) (translation_unit_diff::translation_unit_diff) (corpus_diff::corpus_diff): Take an additional pointer to diff_context in argument. ({pointer_diff, qualified_type_diff, reference_type_diff}::report): do not re-report a diff about the underlying type if it has already been reported, or if it's being reported already. (enum_diff::report): Fix this to properly use the populated lookup tables. (compute_diff): take an additional pointer to diff_context in argument. For the var_decl, pointer_diff reference_type_diff, qualified_type_diff enum_diff, scope_diff, function_decl_diff, type_decl_diff and typedef_diff overloads, do not re-build a diff object, if one exits already. Otherwise, record the new diff object created so that it can be re-used later. (enum_diff::ensure_lookup_tables_populated): Fix logic to avoid one loop. (class_decl::priv::{deleted_member_functions_, inserted_member_functions_, changed_member_function_}): New members to support reporting about member functions changes. (class_decl::{lookup_tables_empty, clear_lookup_tables, length): Update for the new additions above. (class_decl::ensure_lookup_tables_populated): Likewise. Fix to properly use the lookup tables and also avoid a going through several loops to compute the changed members. (class_decl::report): Flip a switch to make the beginning and end of the reporting, in the context. Also, do not try to report again, if we were already reporting this diff. Fix quite some spots to properly use the lookup tables. (scope_diff::ensure_lookup_tables_populated): Skip decl-only classes during comparison. Fix some thinkos. Fix logic to avoid a loop. (scope_diff::report): Adjust to pass a context to compute_diff_for_types. (function_decl_diff::ensure_lookup_tables_populated): Fix logic to avoid a loop. (function_decl_diff::report): Adjust call to compute_diff_for_types to pass the context. (typedef::report): Avoid re-reporting the diff of the underlying types, if we are already reporting it. (corpus_diff::priv::ensure_lookup_tables_populated): Use the pretty representation of the function rather than its name to key the maps of deleted and added functions. Fix logic to avoid going through an additional loop for the changed functions. (corpus_diff::report): Add a title for removed/added/changed functions. Fix indentation for added/removed/changed functions. * include/abg-ir.h (class_decl::comparison_started_): New member * src/abg-dwarf-reader.cc (is_public_decl): Style fix. (is_declaration_only_): New static function. (build_class_type_and_add_to_ir): Create decl-only classes (IR) for classes flagged as declaration-only in the DWARF. * src/abg-hash.cc (class_decl::hash::operator()): Do not forget to include the "is_declaration_only" flag into the hashing. * src/abg-ir.cc (class_decl::operator==): Look through decl-only classes to get their definitions and compare the definitions instead. Avoid comparing member types and fns if the comparison of this type has already started. * src/abg-reader.cc (build_class_decl): Set the definition of a declaration, when we see it. * tests/data/test-bidiff/test-qual-type0-report.txt: Update. * tests/data/test-bidiff/test-struct0-report.txt: Likewise. * tests/data/test-bidiff/test-struct1-report.txt: Likewise. signed-off-by: Dodji Seketeli 2014-02-07 Dodji Seketeli Support reading *.bi input with duplicated qualified type ids. * src/abg-reader.cc (read_context::map_id_and_node): Support qualified types with duplicated ids. 2014-02-07 Dodji Seketeli Fix comparison of member types * src/abg-ir.cc (class_decl::member_type::operator==): Compare the underlying type of the member type. 2014-02-07 Dodji Seketeli Avoid duplicated entries in the symbol tables of the corpus * include/abg-ir.h ({var_decl, function_decl}::ptr_equal): New equality functor for pointers to var_decl and function_decl. ({function_decl, var_decl}::hash): Make these hashing functors public. * include/abg-hash.cc (struct var_decl::hash, struct function_decl::hash): Remove these from here. There are now in the public abg-ir.h. ({var_decl, function_decl}::hash::operator()): Define these here. * src/abg-corpus.cc (symtab_build_visitor_type::{fns_map, fn_is_in_map, add_fn_to_map, vars_map, var_is_in_map, add_var_to_map}): New accessors. (corpus::priv::build_symbol_table): Avoid duplicated entries in variables and functions symbols tables. 2014-02-07 Dodji Seketeli Ease debugging of abigail::diff_utils::compute_diff * include/abg-diff-utils.h (compute_diff): Add asserts on for the length of the shortest edit script during the divide and conquer part of the diff algorithm. 2014-02-07 Dodji Seketeli Fix further reaching reverse path calculation in core diff algo * include/abg-diff-utils.h (end_of_frr_d_path_in_k_plus_delta): Favour moving left when the two abscissas at the previous steps are equal. (compute_diff): Update the length of the shortest edit script when the size of one of the inputs is zero. * tests/test-core-diff.cc (in_out_spec): Add a new input to diff two sequences for regression testing. * tests/data/test-core-diff/report13.txt: New reference for the comparison of the new regression test above. 2014-02-07 Dodji Seketeli Add debugging facilities for core diffing issues * include/abg-ir.h (fns_to_str): Declare new fn. * src/abg-ir.cc (get_next_string, fn_to_str, fns_to_str): New static functions. (fns_to_str): Define new fn. * tools/abg-tools-utils.cc (dump_functions_as_string) (dump_function_names, compare_functions): New functions. 2014-01-20 Dodji Seketeli Fix apidoc comment * src/abg-ir.cc (decl_base::operator==): Fix comment. 2014-01-20 Dodji Seketeli Fix bilint outputting for translation units & corpus * tools/bilint.cc (main): Fix logic. 2014-01-20 Dodji Seketeli Remove debugging assertion when diffing * include/abg-diff-utils.h (d_path_vec::at): Do not check for bounds. 2014-01-20 Dodji Seketeli Do not use exceptions in dynamic_cast * src/abg-ir.cc (class_decl::member_function::operator==) (class_decl::member_function::operator==): Do not use the exception path for dynamic casting. This was near the top of many profiles. 2014-01-20 Dodji Seketeli Just add decls sequentially when reading from DWARF * src/abg-dwarf-reader.cc (insert_decl_into_ir_under_scope) (build_namespace_decl_and_add_to_ir, build_enum_type) (build_class_type_and_add_to_ir, build_ir_node_from_die) (build_ir_node_from_die): Remove. * tests/data/test-read-dwarf/test0.abi: Update because now type IDs can be used before they are defined. * tests/data/test-read-dwarf/test1.abi: Likewise. 2014-01-17 Dodji Seketeli Misc Doxygen API doc fixes * include/abg-comparison.h: Various doxygen api doc string fixes. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. 2014-01-17 Dodji Seketeli Fix bilint --noout, add --diff option * tools/bilint.cc (options::options): Initialize ... (options::{diff, bidiff}): ... new members. (display_usage): Update the display usage string for --diff & --bidiff options. (parse_command_line): Support the --diff and --bidiff options. (main): Require the --diff option to actually diff the emitted output with input. Make --noout really work for when reading from dwarf. 2014-01-17 Dodji Seketeli Read .abi files with types used before being defined & lots of fixes * src/abg-reader.cc (read_context::m_decls_stack): Make this is a std::deque, rather than a std::stack. (read_context::{get_id_xml_node_map, clear_id_xml_node_map, get_xml_node_decl_map, map_xml_node_to_decl, get_decl_for_xml_node, clear_xml_node_decl_map, map_id_and_node, get_xml_node_from_id, get_scope_for_node, build_or_get_type_decl}): New member functions. (read_context::{get_cur_decl, push_decl, pop_decl}): Update this now that the decl stack uses a std::deque. (read_context::clear_decls_stack): New. (read_context::get_translation_unit): Use the first decl of the decl stack, that is most certainly the global scope of the current translation unit, to get the translation unit. (read_context::key_type_decl): Take a new flag to force the re-keying; that is set an id to a new type, even if the id was already set to a type. (read_context::push_and_key_type_decl): Assert that a type must have a declaration. (handle_*): Make these return the decl_base_sptr resulting from the parsing of the xml node, rather than just a bool. (walk_xml_node_to_map_type_ids): New static function. (read_translation_unit_from_input): Read the abi-instr xml sub-tree once, just to build an id->xml node map. That way, when a declaration needs a type what is not yet defined, it can just get its XML node, build the type from it and use it. Do not forget to advance the xml reader cursor when the reading of the 'abi-instr' sub-tree is read. Clear all the new maps we have used for the current translation unit. (handle_element_node): Cleanup logic. (build_namespace_decl): Update the new xml node -> decl map, and use it to avoid building the same namespace twice. (build_function_parameter): Do not even try to get the type of a variadic parameter. (build_function_decl, build_var_decl): Support types that are defined later. (build_type_decl): Do not build the same type twice. But there can be several 'unnamed-enum-underlying-type' node. In that case just return the previous one. (build_qualified_type_decl, build_pointer_type_def) (build_reference_type_def, build_enum_type_decl) (build_typedef_decl): Support underlying type defined later. (build_class_decl): Support declaration-only related cases where we can have several xml nodes with the same id. Update the new xml node -> IR node maps. Fix member type adding. (build_type_tparameter, build_non_type_tparameter) (build_template_tparameter): Support used types defined later. 2014-01-17 Dodji Seketeli Fix member class template creation * src/abg-ir.cc (class_decl::add_member_class_template): Do not forget the scope of the member class template itself. 2014-01-17 Dodji Seketeli Avoid endless loop in unescape_xml_string * src/abg-libxml-utils.cc (unescape_xml_string): Avoid and endless loop for strings containing an '&' but that are not pre-defined entities. 2014-01-17 Dodji Seketeli Fix a potential crash * src/abg-ir.cc (decl_base::get_qualified_name): Do not crash if the scope is empty. 2014-01-17 Dodji Seketeli Do not loose the member type information when reading them from DWARF * include/abg-ir.h (class_decl::declaration_): Make this be a decl_base_sptr so that it can actually be a class_decl::member_type which underlying type is a class decl. (class_decl::{set, get}_earlier_declaration): Take or return a decl_base_sptr rather than a class_decl_sptr. * src/abg-ir.cc (class_decl::set_earlier_declaration): Take a decl_base_sptr rather than a class_decl_sptr. * src/abg-dwarf-reader.cc (die_class_map_type): Make this map take decl_base_sptr rather than a class_decl_sptr. (build_class_type_and_add_to_ir): If the class being currently built is a member class, do not loose that information after it has been added to its scope. Also, base types and types of member variables can be member types and should retain that information. (build_qualified_type): Likewise, the underlying type of a qualified type shouldn't loose the information about its potentially being a member type. (build_pointer_type_def, build_reference_type, build_typedef_type) (build_var_decl, build_function_decl): Likewise. 2014-01-17 Dodji Seketeli Fix hashing of member types * include/abg-ir.h (class_decl::{member_function_template, member_class_template}): Make these inherit from decl_base, to comply with class_decl::member_type. (class_decl_base_spec::{base_spec, member_type, member_function, member_function_template, member_class_template}::hash): Declare these hashing functors in the header here. (class_decl::{member_base, member_type, data_member, member_function, member_function_template, member_class_template}::hash::operator()): define these out of line here. (type_base::dynamic_hash::operator()): Update this to hash member things. * src/abg-writer.cc (write_qualified_type_def) (write_pointer_type_def, write_class_decl) (write_reference_type_def, write_enum_type_decl): Add an overload that takes the type ID to use in the serialization. (write_member_type): New implementation. 2014-01-17 Dodji Seketeli A Member class can also be a scope for other decls in DWARF * include/abg-fwd.h (as_non_member_class_decl): Declare ... * src/abg-ir.cc (as_non_member_class_decl): ... this new function. * include/abg-ir.h (class class_decl::member_type): Add more comments about member types. * src/abg-dwarf-reader.cc (get_scope_for_die): Use the new as_non_member_class_decl here. 2014-01-17 Dodji Seketeli Misc style fixes * include/abg-ir.h (location_manager::_Impl): Rename this type into priv. * src/abg-ir.cc b/src/abg-ir.cc (location_manager::_Impl): Likewise. (location_manager::location_manager): Update for the renaming above. * src/abg-reader.cc (build_type_decl): Remove useless white space. (build_enum_type_decl, build_class_decl): Use the _sptr typedef in the return type. 2014-01-14 Dodji Seketeli Update namespace comments * src/abg-dwarf-reader.cc (namespace dwarf_reader): Add apidoc comment. * src/abg-reader.cc (namespace xml_reader): Update apidoc comment. 2014-01-14 Dodji Seketeli Expand 'abi-instr' XML element nodes during de-serialization * src/abg-reader.cc (update_read_context) (update_depth_info_of_read_context): Remove. (read_context::{pop_scope, pop_scope_or_abort): New. (read_context::{push_decl_to_current_scope, push_and_key_type_decl}): Remove the overloads that take the 'update_depth_info' boolean. (build_namespace_decl): New static function. (build_function_decl, build_var_decl, build_type_decl) (build_qualified_type_decl, build_pointer_type_def) (build_reference_type_def, build_enum_type_decl, build_type_decl) (build_class_decl, build_function_tdecl, build_class_tdecl) (build_type_tparameter, build_type_composition) (build_non_type_tparameter, build_template_tparameter) (build_template_parameter, build_type): Remove the 'update_depth_info' boolean from parameters. (handle_element_node): Renamed handle_element into this. Take an xml node and a boolean to add the resulting IR node to the IR. (handle_type_decl, handle_namespace_decl) (handle_qualified_type_decl, handle_pointer_type_def) (handle_reference_type_def, handle_enum_type_decl) (handle_typedef_decl, handle_var_decl, handle_function_decl) (handle_class_decl, handle_function_tdecl, handle_class_tdecl): Take an xml node and a boolean to add the resulting IR node to the IR. (advance_cursor): No more need to call update_read_context. (read_translation_unit_from_input): Expand the 'abi-instr' node into memory so that we walk its XML nodes and build the IR nodes from them. (read_location): Remove the overload that was using the xml reader. (): 2014-01-14 Dodji Seketeli Misc style fixes * src/abg-reader.cc (read_context::{get_cur_decl, pop_decl}): Return decl_base_sptr rather than shared_ptr. (read_context::push_decl): Take a decl_base_sptr rather than shared_ptr. 2014-01-14 Dodji Seketeli Fix apidoc markup * include/abg-comparison.h (class var_diff): @ref var_decls -> @ref var_decl. * src/abg-comparison.cc (function_decl_diff::first_function_decl): @Return -> @return. 2014-01-14 Jonathan Wakely Fix checkout & build instructions * CONTRIBUTING: Fix Git repository url. * doc/website/mainpage.txt: Add elfutils into the dependencies list and fix the repository directory name. Also use autoreconf -i. * include/abg-fwd.h: Fix Git repository URL. 2014-01-13 Dodji Seketeli Tweak dwarf reading test to detect more namespace linking-fu * tests/data/test-read-dwarf/test0.cc: Define a member function out-of-line, outside of its namespace. * tests/data/test-read-dwarf/test0.abi: Update the .abi file. * tests/data/test-read-dwarf/test0: Update the resulting binary. 2014-01-13 Dodji Seketeli Add asserts to detect type id mis-management in native format * read_translation_unit_from_input (read_translation_unit_from_input): Abort when an element could not be handled. (build_function_parameter, build_type_decl, qualified_type_def) (build_pointer_type_def, build_reference_type_def) (build_enum_type_decl, build_typedef_decl, build_class_decl) (build_type_tparameter, build_template_tparameter) (handle_qualified_type_decl, handle_pointer_type_def) (handle_reference_type_def, handle_typedef_decl): Abort when a referred-to type is not found or if a type is defined twice. 2014-01-13 Dodji Seketeli Misc style fixes * src/abg-hash.cc (class_decl::member_function_template::hash::operator()): Remove useless vertical space. * src/abg-ir.cc (class_decl::class_decl): Properly indent. * src/abg-writer.cc (fn_tmpl_shared_ptr_map) (class_tmpl_shared_ptr_map): Properly indent these typedefs. 2014-01-13 Dodji Seketeli Optimize comparison & underlying type accessing * include/abg-ir.h (qualified_type::get_underlying_type) (pointer_type_def::get_pointed_to_type) (reference_type_def::get_pointed_to_type) (typedef_decl::get_underlying_type): Avoid triggering refcount counter increasing/decreasing here, by returning a reference to the underlying type. This showed up high on a profile. ({scope_decl, type_decl, scope_type_decl, namespace_decl, qualified_type_def, pointer_type_def, reference_type_def, enum_type_decl, typedef_decl, var_decl, class_decl}::operator==): Avoid taking the exception-using path of dynamic_cast. This showed up very high on a profile. 2014-01-13 Dodji Seketeli Fix reading/writing native xml corpus files * src/abg-reader.cc (read_context::clear_type_map): New member function. (read_translation_unit_from_input): Read up to the next element node if we are not on an element node already. Clear the type map. Realize that we might be on the next 'abi-instr' node upon completion. (read_corpus_from_input): Read up to the next element node if we are not on an element node already. It must be an "abi-corpus" node. THen Advance to the next 'abi-instr' element node before handing it to read_translation_unit_from_input. * src/abg-writer.cc (write_context::clear_type_id_map): New member function. (write_translation_unit): Call it. * tools/abg-tools-utils.cc (guess_file_type): Read enough bytes to detect abi-corpus files magic bytes. * tools/bilint.cc (main): Do not write the corpus file to the output stream if --noout has been provided. 2014-01-13 Dodji Seketeli Escape xml pre-defined entities in native (de-)serialization. * include/abg-libxml-utils.h (escape_xml_string) (unescape_xml_string): Declare new functions. * src/abg-libxml-utils.cc (escape_xml_string) (unescape_xml_string): Define them. * src/abg-reader.cc (build_function_decl, build_var_decl) (build_type_decl, build_enum_type_decl, build_class_decl) (build_type_tparameter, build_non_type_tparameter) (build_template_tparameter, handle_namespace_decl) (handle_typedef_decl): Use unescape_xml_string. * src/abg-writer.cc (write_type_decl, write_function_decl) (write_class_decl, write_type_tparameter) (write_non_type_tparameter, write_template_tparameter): Use escape_xml_string. 2014-01-13 Dodji Seketeli Implement hash caching * include/abg-ir.h (decl_base::hash_): New member. (decl_base::{g,s}et_hash): New accessors. (type_base_::cached_hash): Forward-declare new hasher. (struct type_ptr_equal): New equality predicate. (type_shared_ptr_equal::operator()): Do not forget to test pointer equality. (type_base::cached_hash): Declare new hasher. * src/abg-hash.cc ({decl_base, type_decl, scope_type_decl, qualified_type_def, pointer_type_def, reference_type_def, enum_type_decl, typedef_decl, var_decl, function_decl, function_decl::parameter, class_decl::data_member, class_decl::member_function, class_decl, }::hash::operator()): Implement caching. (type_base::cached_hash::operator()(const type_base*)): Define. (type_base::cached_hash::operator() (const type_base_sptr): Define. * src/abg-ir.cc (type_ptr_map): Make this map use type_base::cached_hash instead of type_base::ptr_hash now. (decl_base::decl_base): Initialize the new decl_base::hash_. member. (decl_base::{s,g}et_hash): Define. (decl_base::operator==(const decl_base& other)): Take the hash in account to speed up inequality detection. * src/abg-writer.cc (type_ptr_map): Renamed type_shared_ptr_map into this. Make it use type_base::cached_hash and type_ptr_equal instead of type_base::shared_ptr_hash and type_shared_ptr_equal. (get_id_for_type): Add overload for type_base*. Re-write the previous overload in terms of this one. (write_context::m_type_id_map): Use type_ptr_map as the type for this. 2014-01-13 Dodji Seketeli Do not canonicalize types anymore; it's slow and luckily not needed * src/abg-ir.h (translation_unit::canonicalize_type): Remove. * src/abg-dwarf-reader.cc (canonicalize_and_add_type_to_ir) (canonicalize_and_insert_type_into_ir) (canonicalize_and_insert_type_into_ir_under_scope): Remove. (build_enum_type, build_class_type, build_ir_node_from_die): Update for removal of type canonicalization. * src/abg-ir.cc (translation_unit::canonicalize_type): Remove. 2014-01-13 Dodji Seketeli Fix class scope setting & member type de-serializing from dwarf * include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope): return the decl added to the scope. (as_non_member_type, get_type_declaration): Declare new entry points. * include/abg-ir.h (class decl_base::insert_decl_into_scope): Update this friend declaration. (class scope_decl, class_decl): Update the friend add_decl_to_scope declaration. (scope_decl::add_member_decl): Return the added decl. (class_decl_sptr): Move this typedef befoer the class_decl class declaration. (class_decl::definition_of_declaration_): New member. (class_decl::{set_definition_of_declaration, get_definition_of_declaration}): New accessors. (class_decl::add_member_decl): Return the added member. (class_decl::insert_member_type): New member. (class_decl::member_base::access_specifier): Make this protected. (class_decl::member_type): Make this inherit from type_vase. (class_decl::member_type::type_): Remove this member. (class_decl::member_type::as_type): Remove this accessor. (class_decl::member_type::operator==(const type_base&)): New. (class_decl::member_type::operator shared_ptr() const): Remove. (class_decl::member_type::get_underlying_type): New. (class_decl::member_type::operator==(const member_type&) const): New. * src/abg-comparison.cc (class_diff::{ensure_lookup_tables_populated, report}): Adjust for the removal of class_decl::member_type::as_type. * src/abg-dwarf-reader.cc (scope_stack_type): Change this as a typedef to stack. (current_scope): Change return type from scope_decl_sptr to scope_decl*. (insert_decl_into_scope): New. (build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope in lieu of add_decl_to_scope. (build_class_type_and_add_to_ir): likewise. Link a class definition to its declaration. Push the current scope on the scope stack. Use as_non_member_type. Fix setting member types. (get_scope_for_die): Look through declaration-only classe to get its definition. (build_qualified_type, build_pointer_type_def) (build_reference_type, build_typedef_type, build_var_decl) (build_function_decl): Use as_non_member_type. (build_ir_node_from_die): Fix member variable & function adding. * src/abg-ir.cc (scope_decl::{add_member_decl, insert_member_decl}): Return the added member. (add_decl_to_scope): Likewise. (insert_decl_into_scope): Likewise. (get_top_most_scope_under): Fix logic. (get_type_declaration): New overload that return a decl_base*. (as_non_member_type): New definition. (class_decl::{get_definition_of_declaration, set_definition_of_declaration, insert_member_decl}): Likewise. (class_decl::add_member_decl): Re-write in terms of class::insert_member_decl. (class_decl::insert_member_type): New definition. (class_decl::add_member_type): Re-write in terms of class_decl::insert_member_type. (class_decl::remove_member_type): Update for the class_decl::member_type::as_type removal. (class_decl::{add_data_member, add_member_function, add_member_function_template, add_member_class_template}): Call scope_decl::add_member_decl. (class_decl::member_type::member_type): Update as the type now virtually inherits from type_base. (class_decl::member_type::{set,get}_access_specifier): New definitions. (class_decl::member_type::get_underlying_type): Likewise. (class_decl::member_type::set_scope): Update wrt class_decl::member_type::as_type -> get_underlying_type rename. (class_decl::member_type::operator==(const decl_base& other)): There is no more class_decl::member_type::as_type. (class_decl::member_type::operator==(const type_base& other)): New. (class_decl::member_type::get_pretty_representation): Update wrt class_decl::member_type::as_type -> get_underlying_type rename. * src/abg-reader.cc (build_class_decl): New that add add_member_decl adds even member types, no need to add it explicitly anymore. 2014-01-07 Dodji Seketeli Add regression tests for dwarf reading * tests/test-read-dwarf.cc: New dwarf reading regression test. * tests/data/test-read-dwarf/test0: New test input. * data/test-read-dwarf/test0: Likewise. * data/test-read-dwarf/test0.abi: Likewise. * data/test-read-dwarf/test0.cc: Likewise. * data/test-read-dwarf/test1: Likewise. * data/test-read-dwarf/test1.abi: Likewise. * data/test-read-dwarf/test1.cc: Likewise. * tests/Makefile.am: Build the new tests/test-read-dwarf.cc file. 2014-01-07 Dodji Seketeli Remove useless dependencies in tests/Makefile.am * tests/Makefile.am: Remove useless *_DEPENDENCIES variables. 2014-01-07 Dodji Seketeli Support new 'abi-corpus' native XML format (.abi) * include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. 2014-01-07 Dodji Seketeli Misc style fixes * include/abg-writer.h (write_translation_unit): Re-indent parms. * src/abg-writer.cc (write_translation_unit): Likewise. * test/test-read-write.cc (main): Fix white space. 2014-01-06 Dodji Seketeli Fix global variables diff reporting in corpus-es * src/abg-comparison.cc (corpus_diff::priv::ensure_lookup_tables_populated): Fix a wrong assert, resulting from a copy paste typo. 2014-01-06 Dodji Seketeli Add support for global variables in corpus diffing * include/abg-comparison.h (string_var_ptr_map, changed_var_ptr) (string_changed_var_ptr_map): New convenience typedefs. * src/abg-comparison.cc (corpus_diff::priv::{deleted_vars_,added_vars_,changed_vars_}): New members. (corpus_diff::priv::{lookup_tables_empty, clear_lookup_tables}): Update wrt the new variables related lookup tables. (corpus_diff::ensure_lookup_tables_populated): Update to populate variables related lookup tables. (corpus_diff::report): Update to display added/removed/changed variables. 2014-01-06 Dodji Seketeli Misc style fixlets * include/abg-comparison.h (changed_function_ptr): Fix comment. * src/abg-comparison.cc (corpus_diff::report): Likewise. * src/abg-corpus.cc (corpus::is_empty): Likewise. 2013-12-23 Dodji Seketeli Initial support for diffing ABI corpus files * include/abg-comparison.h (string_function_ptr_map) (changed_function_ptr, string_changed_function_ptr_map) (corpus_diff_sptr): New convenience typedefs. (translation_unit_diff): Add comments. (class corpus_diff): New type. (compute_diff): New overload for corpus_diff. * include/abg-corpus.h (corpus::{functions, variables}): New typedefs. (corpus::{operator==, get_functions, get_variables}): New members. * include/abg-diff-utils.h (struct deep_ptr_eq_functor): New functor. * include/abg-ir.h (translation_unit::operator==): New member equality operator. * src/abg-comparison.cc (struct corpus_diff::priv): New private struct holding the private members of corpus_diff. (corpus_diff::priv::{lookup_tables_empty, clear_lookup_tables, ensure_lookup_tables_populated}): Define new private member functions. (corpus_diff::{corpus_diff, first_corpus, second_corpus, function_changes, variable_changes, length, report}): New public members. (struct noop_deleter): New struct. (compute_diff): New implementation for corpus_diff. * src/abg-corpus.cc (struct corpus::priv): Renamed corpus::impl into this. Add new fns, vars and is_symbol_table_built data members. (corpus::priv::build_symbol_table): New member function. (class symtab_build_visitor_type): New visitor type to build the symbol table. (struct func_comp, struct var_comp): New comparison functors. (corpus::priv::build_symbol_table): Define new member function. (corpus::{corpus, add, get_translation_units, operator==, get_functions, get_variables}): Define new members. * src/abg-ir.cc (translation_unit::operator==): Define new member equality operator. (operator==(translation_unit_sptr l, translation_unit_sptr r)): Define new equality operator. * tools/abg-tools-utils.h (enum file_type): New enum. (guess_file_type): Declare new function. * tools/abg-tools-utils.cc (guess_file_type): define new function. * tools/bidiff.cc (main): Guess the type of the files given in input and support elf files reading and diffing. 2013-12-23 Dodji Seketeli Generalize use of equality operator in core diff algorithms * include/abg-diff-utils.h (struct default_eq_functor): New equality functor. (end_of_fr_d_path_in_k, end_of_frr_d_path_in_k_plus_delta): Add a new equality functor template parameter and document it. Use it to compare the elements of the sequences given in argument. (compute_middle_snake, ses_len, compute_diff): Add a new equality functor template parameter and document it. Adjust call to end_of_frr_d_path_in_k_plus_delta, end_of_fr_d_path_in_k and compute_middle_snake. (ses_len, compute_diff): Add a new overload that uses a default_eq_functor as comparison functor, to avoid breaking existing client code. * src/abg-diff-utils.cc (compute_middle_snake): Adjust the call to the compute_middle_snake. 2013-12-23 Dodji Seketeli Change ir node visitor interface work on pointer to nodes * include/abg-ir.h (ir_traversable_base): New type to be the base of IR nodes that are to be traversed. Extends traversable_base. Its ir_traversable_base::traversable() method takes an ir_node_visitor&. (ir_node_visitor::visit): Change these virtual overloads to take pointers to IR nodes, rather than references. This will be useful to e.g, store these IR nodes in containers on the side for some algorithms to work. That is going to be useful later to, e.g. build symbol tables on the side, using the visitor interface. (class decl_base): Make this inherit ir_traversable_base. * src/abg-ir.cc (*::traverse): Adjust comments and the call the ir_node_visitor::visit call. Use the ir_traversable_base type rather than traversable_base. (ir_traversable_base::traverse): Define. (ir_node_visitor::visit): Change these overloads to take pointers rather than reference to ir nodes. * tests/test-walker.cc (name_printing_visitor::visit): Adjust to take pointers rather than references. 2013-12-23 Dodji Seketeli Do not forget to read function parms * src/abg-dwarf-reader.cc (build_function_decl): Do not forget the the function parameters. Oops. 2013-12-20 Dodji Seketeli Support reading member functions and member types from DWARF * include/abg-ir.h (method_type_sptr): New convenience typedef. * src/abg-dwarf-reader.cc (read_context::{dwarf_version, die_wip_classes_map}): New accessors. (die_is_virtual): Rename is_virtual into this. (is_type_tag, is_type_die, die_virtual_function_index): Define new static functions. (die_member_offset): Fix comment. (get_scope_for_die): Take the read context as argument. (canonicalize_and_add_type_to_ir): Likewise. On NULL scope, get the current translation unit from the read context. (canonicalize_and_insert_type_into_ir_under_scope): Handle NULL context. (build_function_decl): Support creating method_decls from here when necessary. (build_class_type_and_add_to_ir): Rename build_class_type into this. Handle adding the class to the IR and to the relevant maps. During the creation of the class, arrange for build_ir_node_from_die on the current DIE to return a declaration-only class, representing the declaration for the class that is being constructed. This breaks circular dependencies induced by decls/types that refer to the class being built, before the class is fully built and has a (logical) type ID. Once the class is created, make it refer to the class declaration that was previously handed for the requests to the class DIE. Now requests to the class DIE will just yield the newly built class. Add support for member functions and member types. (build_corpus): Support reading the dwarf version and stick it into the context. (build_ir_node_from_die): Adjust for change in canonicalize_and_add_type_to_ir and build_class_type signature change. * src/abg-ir.cc (class_decl::method_decl::get_type): Support returning NULL type. 2013-12-20 Dodji Seketeli Don't crash in get_global_scope on empty decls * src/abg-ir.cc (get_global_scope): Don't crash when given a NULL decl. 2013-12-20 Dodji Seketeli Make decl_base::set_scope virtual, to work on class_decl::member_type * include/abg-ir.h (decl_base::set_scope): Make this virtual. (class_decl::member_type::set_scope): Declare an overload here. * src/abg-ir.cc (class_decl::member_type::set_scope): Define new overload. Make this set the scope of the underlying type of the member type as well. 2013-12-20 Dodji Seketeli Support artificial parameters * include/abg-ir.h (function_decl::parameter::{get, set}_artificial): Add new accessors for an "artificial" flag. * src/abg-reader.cc (build_function_parameter): Support reading the artificial parameter flag. * src/abg-writer.cc (write_function_decl): Support writing the artificial parameter flag. 2013-12-19 Dodji Seketeli Initial support for reading struct/class * src/abg-dwarf-reader.cc (enum virtuality): New enum. (class expr_result, struct dwarf_expr_eval_context): New types. (die_size_in_bits) (die_access_specifier, die_virtuality, is_virtual) (die_location_expr, op_pushes_constant_value) (op_pushes_non_constant_value, op_manipulates_stack) (op_is_arith_logic, op_is_control_flow) (eval_last_constant_dwarf_sub_expr, die_member_offset) (build_class_type): New static functions. (build_ir_node_from_die): Support creating IR node for class and struct by calling the new build_class_type. 2013-12-19 Dodji Seketeli Slight style fix * src/abg-dwarf-reader.cc (build_qualified_type): Fix indentation. 2013-12-19 Dodji Seketeli Be more forgiving when parsing xml from stdin * src/abg-libxml-utils.cc (xml_istream_input_read): Return the byte read count even when the stream seems to be borked. In that case it should be zero. 2013-12-19 Dodji Seketeli Don't crash if building pointer/reference yields NULL * src/abg-dwarf-reader.cc (build_ir_node_from_die): Do not crash if building the IR node for the underlying type yields NULL. 2013-12-19 Dodji Seketeli Use dwarf_attr_integrate() rather than dwarf_attr() * src/abg-dwarf-reader.cc (die_string_attribute) (die_unsigned_constant_attribute, die_signed_constant_attribute) (die_flag_attribute, die_die_attribute): Use dwarf_attr_integrate rather than dwarf_attr to look through DW_AT_abstract_origin. 2013-12-14 Dodji Seketeli Support enums * src/abg-dwarf-reader.cc (build_enum_type): New function. (build_ir_node_from_die): Call the new build_enum_type here to Handle DW_TAG_enumeration_type DIEs. 2013-12-14 Dodji Seketeli Build & use a DIE -> parent map to avoid emitting useless types * include/abg-ir.h (translation_unit::{mark_type_as_used, prune_unused_types}): Remove these declarations. * src/abg-ir.cc (translation_unit::priv::used_types_): Remove. (class subtype_marking_visitor): Likewise. (translation_unit::{mark_type_as_used, prune_unused_types): Likewise. (get_top_most_scope_under): Fix logic and add comment. * src/abg-dwarf-reader.cc (die_tu_map_type, offset_offset_map): New convenience typedefs. (read_context::{die_tu_map_, die_parent_map_}): New context members. (read_context::{die_tu_map, die_parent_map}): New accessors. (build_ir_node_from_die): New overload that takes the scope of the ir node in parameter. (die_signed_constant_attribute): Un-comment this. (build_die_parent_relations_under, build_die_parent_map) (get_parent_die, get_scope_for_die): New static functions. (build_translation_unit_and_add_to_ir): Renamed build_translation_unit into this. Populate the new read_context::die_tu_map() here. (canonicalize_and_add_type_to_ir) (canonicalize_and_insert_type_into_ir) (canonicalize_and_insert_type_into_ir_under_scope): Move these overloads over the top of the file. (build_namespace_decl_and_add_to_ir): Fix this by adding the namespace to the IR scope of the DIE (using the new get_scope_for_die()). Update the read_context::die_decl_map() map. (build_function_decl): Support functions that return void. Also, skip parameters that don't have type set. (build_corpus): Walk all the DIEs to build a DIE -> parent map. Adjust for the rename to build_translation_unit_and_add_to_ir. (build_ir_node_from_die): Add a scope parm. Adjust back to building IR nodes only for public decls, unless the 'called_from_public_decl' flag is set. Adjust to stick the resulting IR node into the scope given in parameter. 2013-12-14 Dodji Seketeli Mark sub-types as part of general type marking * src/abg-ir.cc (subtype_marking_visitor): New visitor. (translation_unit::mark_type_as_used): When marking a composite type as used, mark its sub-types as well. 2013-12-14 Dodji Seketeli Add missing virtual keywords for traverse() method * include/abg-ir.h ({translation_unit, decl_base, scope_decl, type_decl, namespace_decl, qualified_type_decl, pointer_type_def, reference_type_def, enum_type_decl, typedef_decl, var_decl, function_tdecl, class_decl, class_decl::data_member, class_decl::member_function, class_decl::member_function_template, class_decl::member_class_template}::traverse): Add a virtual keyword at least to "document" that this method is virtual -- and thus remind the user that it overrides the traversable_base::traverse(). 2013-12-14 Dodji Seketeli Add a is_type overload * include/abg-fwd.h (is_type): Declare new overload that takes a type reference. * src/abg-ir.cc (is_type): Define. 2013-12-13 Dodji Seketeli Prune types that are not ref'ed by public decls * include/abg-fwd.h (remove_decl_from_scope): Declare new function. * include/abg-ir.h (type_base_sptr, decl_base_sptr): Move these convenience typedef before the translation_unit declaration. (translation_unit::{mark_type_as_used, prune_unused_types}): Declare new methods. (decl_base::remove_member_decl): Likewise. (class_decl::{remove_member_decl, remove_member_type): Likewise. * src/abg-dwarf-reader.cc (die_decl_map_type): Change this map type so that the value is now a DIE offset, rather than a DIE. This is because many times the lifetime of DIEs is shorter than the one of the reader_context. Also, the die offset uniquely designates a physical DIE even if several different instances of logical DIE might point to it. (struct die_hash): Remove this as it's useless now that we store DIE offsets in the map. (build_translation_unit): Call build_ir_node_from_die w/o setting the called_from_public_decl flag. Prune the types that are not used by any public decls. (build_namespace_decl_and_add_to_ir): all build_ir_node_from_die w/o setting the called_from_public_decl flag. (build_ir_node_from_die): Change the only_public_decl flag into a called_from_public_decl flag. Mark types used by public decls as such. Adjust for the parm changes of build_qualified_type build_pointer_type_def, build_reference_type, and build_typedef_type. (build_qualified_type, build_pointer_type_def) (build_reference_type, build_typedef_type): Take a new called_from_public_decl. Pass it to build_ir_node_from_die. (build_var_decl): Call build_ir_node_from_die with the called_from_public_decl flag set to true to flag the types referenced by this variable as being used. (build_function_decl): Take a called_from_public_decl flag as well, as this function can now call build_function_decl itself to build a function decl out of the value of the DW_AT_specification attribute, for DIEs representing function definitions. Also, flag the types referenced by public functions are being used. * src/abg-ir.cc (translation_unit::priv::used_types_): New map for the used types. (translation_unit::{mark_type_as_used, prune_unused_types}): Define new methods. (scope_decl::remove_member_decl): Likewise. (remove_decl_from_scope): Define new function. (class_decl::{remove_member_decl, remove_member_type}): Define new methods. 2013-12-12 Dodji Seketeli Support reading namespaces * include/abg-fwd.h (get_global_scope): Return a const global_scope. Add a new overload that takes a naked pointer as parm. (insert_decl_into_scope, get_top_most_scope_under): Declare new entry points. * include/abg-ir.h (class decl_base, class scope_decl): Add insert_decl_into_scope as a friend of these classes. (scope_decl::{insert_decl_into_scope, find_iterator_for_member}): Declare new member. (scope_decl::get_member_decls): New non-const overload. * src/abg-dwarf-reader.cc (build_translation_unit): Remove the "recurse" parameter. Adjust the call to build_ir_node_from_die to read just public decls that are at namespace scope. Anything else should be dropped unless it's needed to emitting the public namespace-level decls. (build_namespace_decl_and_add_to_ir) (canonicalize_and_insert_type_into_ir): Define new static functions. (build_corpus): Adjust ad build_translation_unit doesn't have the "recurse" parameter anymore. (canonicalize_and_add_type_to_ir): Make this static. Fix comments. (build_ir_node_from_die): Take a new "only_public_decl" parameter. For DW_TAG_base_type case, use the new canonicalize_and_insert_type_into_ir to insert the type at the right place in the global scope making sure it is seen before the current scope. For pointer, references and qualified types, use canonicalize_and_insert_type_into_ir to add the type at the same scope as its underlying type. Handle DW_TAG_{namespace,module} using the new build_namespace_decl_and_add_to_ir function. Add some vertical spaces and some assertions. * src/abg-ir.cc (scope_decl::add_member_decl): Use scope_decl_sptr typedef. (scope_decl::{insert_member_decl,find_iterator_for_member}): Define new methods. (insert_decl_into_scope, get_top_most_scope_under): Define new functions. (get_global_scope): Constify the return type. (get_translation_unit): Adjust as get_global_scope now returns a const. * src/abg-reader.cc (get_translation_unit): Likewise. 2013-12-12 Dodji Seketeli Fix function_decl::parameter::operator== * include/abg-ir.h (function_decl::parameter::operator==): Support empty type, e.g, in presence of a variadic parameter. 2013-12-12 Dodji Seketeli Misc style fixes * include/abg-ir.h (decl_base::set_visibility): Remove useless white space. (class scope_decl): Remove useless white space. (scope_decl::add_member_decl): Use decl_base_sptr convenience typedef. (global_scope_sptr, namespace_decl_sptr): New convenience typedef. (class global_scope): Remove useless white space. 2013-12-11 Dodji Seketeli Misc style fixes * src/abg-dwarf-reader.cc (die_string_attribute, is_public_decl) (build_translation_unit, build_ir_node_from_die): Fix comments. (die_unsigned_constant_attribute, die_signed_constant_attribute) (die_loc_and_name): Align parms. 2013-12-11 Dodji Seketeli Support typedef types * src/abg-dwarf-reader.cc (build_typedef_type): Define new static function. (canonicalize_and_add_type_to_ir): Do not crash on NULL input type. Also, add a new overload for smart pointer on scope. (build_ir_node_from_die): For DW_TAG_base_type case, adjust as canonicalize_and_add_type_to_ir now takes smart pointers on scopes. Support the DW_TAG_typedef case by calling the new build_typedef_type. 2013-12-11 Dodji Seketeli Support reference types * src/abg-dwarf-reader.cc (build_pointer_type_def): Do not forget to get the proper size of the pointer type. (build_reference_type): Define new static function. (build_ir_node_from_die): Call build_reference_type for the DW_TAG_reference_type and DW_TAG_rvalue_reference_type cases. 2013-12-11 Dodji Seketeli Support pointer types * include/abg-fwd.h (get_translation_unit, get_global_scope): Declare new overloads that act on a naked pointer to decl_base. * src/abg-dwarf-reader.cc (build_pointer_type_def): Define new static function. (canonicalize_and_add_type_to_ir): Take a naked pointer to scope_decl rather than a smart pointer. (build_ir_node_from_die): For DW_TAG_base_type, adjust. Support DW_TAG_pointer_type case. For DW_TAG_{const,volatile}_type case, make sure the qualified type is in the same scope as its underlying type. * src/abg-ir.cc (get_global_scope, get_translation_unit): Define new overloads that acts on a naked decl_base. 2013-12-11 Dodji Seketeli Support qualified types * src/abg-dwarf-reader.cc (build_qualified_type) (canonicalize_and_add_type_to_ir): Define new static functions. (build_ir_node_from_die): In the DW_TAG_base_type case, use the new canonicalize_and_add_type_to_ir which is a factorization of this code. In the DW_TAG_{const,volatile}_type, use the new build_qualified_type and canonicalize_and_add_type_to_ir functions. 2013-12-11 Dodji Seketeli Support reading public functions from DWARF * src/abg-dwarf-reader.cc (read_context::dwarf_): New member. (read_context::load_debug_info): Move the content of load_debug_info_from_elf here. (read_context::dwarf): New accessor for the dwarf_ member above. (die_flag_attribute, die_loc_and_name, is_public_decl) (build_function_decl): New static functions. (die_location): Do not try to create a location object when the location has empty file or empty line number. (build_translation_unit): Take a new address_size parameter. (build_type_decl): Really take a context parameter. Use the new die_loc_and_name() here. (build_var_decl): Skip non-public vars. (build_corpus): Use dwarf_nextcu instead of dwfl_nextcu, so that we can get the address_size used in the current CU. Note that for this we are getting the Dwarf* pointer from the context thanks to the new read_context::dwarf() getter. Adjust the call to build_translation_unit to pass it the new address_size. (build_ir_node_from_die): Shorten lines a little bit. Call the new build_function_decl to support reading DW_TAG_subprogram DIEs. (read_corpus_from_elf): Adjust to create the read context earlier and use its read_context::load_debug_info method to load the debug info. 2013-12-11 Dodji Seketeli Make bilint read input from stdin * include/abg-libxml-utils.h (new_reader_from_istream): Declare new public entry point. * src/abg-libxml-utils.cc (xml_istream_input_read) (xml_istream_input_close): New static functions. (new_reader_from_istream): Define new public input function. * include/abg-reader.h (read_translation_unit_from_istream): Declare new entry points. * src/abg-reader.cc (read_translation_unit_from_istream): Define new entry points. * tools/bilint.cc (options::{read_from_stdin, noout}): New members. (display_usage): Document --stdin and --noout. (parse_command_line): Adjust to consider that no option on the command line means reading from stdin, just like --stdin. Support the --noout option as well. (main): Support Read the abi instr from stdin; in that case, what was read is just serialized back to stdout, unless --noout was supplied. 2013-12-11 Dodji Seketeli Support the "address-size" attribute for elements * include/abg-ir.h (translation_unit::translation_unit): Take an address_size parameter. (translation_unit::{get_address_size, set_address_size}): New accessors. * src/abg-ir.cc (translation_unit::priv::address_size_): New private member. (translation_unit::translation_unit): Take an address_size parameter. (translation_unit::{get_address_size, set_address_size}): Define these new methods. * src/abg-reader.cc (read_input): Read the "address-size" attribute from the abi-instr element. * src/abg-writer.cc (write_translation_unit): Write the "address-size" attribute. * tests/data/test-read-write/test23.xml: New test input. * tests/test-read-write.cc (in_out_specs): Add the new test above to the list of files to read and write back. 2013-12-11 Dodji Seketeli Support variadic arguments in function decls * src/abg-reader.cc (build_function_parameter): Support reading the "is-variadic" attribute. * src/abg-writer.cc (write_function_decl): Support writing the "is-variadic" attribute. * tests/data/test-read-write/test22.xml: New test input. * tests/test-read-write.cc (in_out_specs): Add the new test to the list of files to read and write back. 2013-12-07 Dodji Seketeli Initial support of reading an ABI Corpus from DWARF * configure.ac: Check the presence of libdw.so and elfutils/libdwfl.h headers from elfutils and define the necessary linking flags. * include/abg-dwarf-reader.h: New header file * include/Makefile.am: Add the new header file to the source distribution. * src/abg-dwarf-reader.cc:: New file. * src/Makefile.am: Add the new file to the source distribution. * include/abg-fwd.h (dump): Add declarations for several overloads to allow dumping to a given output stream. * include/abg-ir.h (class translation_unit): Use a pimpl idiom for this now. (translation_unit::canonicalize_type): Declare new method. * src/abg-ir.cc (struct translation_unit::priv): New private type for the pimpl idiom for translation_unit. (translation_unit::{translation_unit, get_global_scope, get_path, set_path, get_loc_mgr}): Adjust for pimpl idiom. (translation_unit::canonicalize_type): Define this new method and one overload. * src/abg-writer.cc (dump): Define several overloads to dump IR nodes to given output streams. * tools/bidw.cc: New file for the new bidw tool. * tools/Makefile.am: Define rules to build the new bidw tools. 2013-12-07 Dodji Seketeli Pass a string by reference rather than by value * tools/bilint.cc (display_usage): Pass program name by reference. 2013-12-07 Dodji Seketeli Misc style fixes * src/abg-ir.cc (location_manager::location_manager) (translation_unit::{is_empty, traverse, ~translation_unit): Remove useless vertical white spaces. * tools/bilint.cc (parse_command_line): Fix indentation. 2013-12-04 Dodji Seketeli Prepare serialization API for multiple backends * include/abg-reader.h: New file with abigail::xml_reader APIs. * include/abg-writer.h: New file with abigail::xml_writer APIs. * include/Makefile.am: Add the new files above to the source distribution. * src/abg-reader.cc: Update top-file comments. (namespace xml_reader): Rename namespace reader into this. (read_to_translation_unit, read_corpus_from_archive): New static functions. (read_translation_unit_from_file) (read_translation_unit_from_file, read_corpus_from_file): New entry points. (struct array_deleter): New functor. (translation_unit::read): Remove this. * src/abg-writer.cc: Update top file comments. (namespace xml_writer): Rename namespace writer into this. (struct archive_write_ctxt): New internal type. (create_archive_write_context, write_translation_unit_to_archive) (write_translation_unit, write_corpus_to_archive): New low level static functions overloads. (write_corpus_to_archive, write_translation_unit): Public higher level overloads. (translation_unit::write): Remove. (dump): Update for new xml_writer namespace. * include/abg-ir.h (translation_unit::{read, write}): Remove these serialization methods. * include/abg-corpus.h (corpus_sptr): New convenience typedef. (corpus::{read, write}): Remove these methods. * src/abg-corpus.cc (corpus::{read, write}) (corpus::impl::{serialized_tus, archive}): Remove these members. (corpus::impl::{get_archive, close_archive, write_tu_to_archive, read_to_translation_unit}): Remove these methods. * tests/test-bidiff.cc (main): Update for usage of the new xml_reader API. * tests/test-read-write.cc (main): Likewise. Update for the usage of the new xml_writer API, too. * tests/test-walker.cc (main): Update for the usage of the new xml_reader API. * tests/test-write-read-archive.cc (main): Likewise. And for the xml_writer API, too. * tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise. * tools/bidiff.cc (main): Likewise, for xml_reader APIs. * tools/bilint.cc (main): Likewise, for xml_writer APIs, too. 2013-11-29 Dodji Seketeli Add support for bidiff regression testing * tests/data/test-bidiff/test-enum0-v0.cc.bi: New input file. * tests/data/test-bidiff/test-enum0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-enum0-report.diff: Likewise. * tests/data/test-bidiff/test-enum1-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-enum1-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-enum1-report.txt: Likewise. * tests/data/test-bidiff/test-qual-type0-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-qual-type0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-qual-type0-report.txt: Likewise. * tests/data/test-bidiff/test-struct0-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-struct0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-struct0-report.txt: Likewise. * tests/data/test-bidiff/test-struct1-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-struct1-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-struct1-report.txt: Likewise. * tests/data/test-bidiff/test-var0-v0.cc.bi: Likewise. * tests/data/test-bidiff/test-var0-v1.cc.bi: Likewise. * tests/data/test-bidiff/test-var0-report.txt: Likewise. * tests/test-bidiff.cc: New file. * tests/Makefile.am: Build the new runtestbidiff regression test and add the above to the source distribution. 2013-11-29 Dodji Seketeli Add missing test inputs to source distribution * tests/Makefile.am (data/test-read-write/test{17, 18, 19, 20, 21}.xml): Add these test input files to the source distribution. 2013-11-28 Dodji Seketeli Add diff support for var_decl * include/abg-comparison.h (class var_diff): New declaration. (var_diff_sptr): New convenience typedef. (compute_diff): New overloads for var_diff, decl_base and type_base. * src/abg-comparison.cc (try_to_diff): Renamed try_to_diff_types into this. (compute_diff_for_types): Adjust for the try_to_diff_types renaming. Fix comments. (compute_diff_for_decls): Re-use try_to_diff. Update for var_decl. (compute_diff): Define overloads for decl_base, type_base and var_decl. (diff_length_of_decl_bases, diff_length_of_type_bases): New static help functions. (report_name_size_and_alignment_changes): Renamed report_size_and_alignment_changes into this. Make it report name changes as well. (var_diff::priv): New struct. (var_diff::{var_diff, first_var, second_var, type_diff, length, report}): Define methods. ({qualified_type_diff, enum_diff, class_diff, scope_diff, function_decl_diff}::report): Do not report anything if the diff is empty. (type_decl_diff::length): Fix this. (type_decl_diff::report): Adjust for renaming to report_name_size_and_alignment_changes. 2013-11-28 Dodji Seketeli Add enum_type_decl::get_pretty_representation() * include/abg-ir.h (enum_type_decl::get_pretty_representation): Declare new virtual method override. * src/abg-ir.cc (enum_type_decl::get_pretty_representation): Define it. 2013-11-28 Dodji Seketeli Change return type of abigail::is_type() * include/abg-fwd.h (is_type): Change the return type from bool to type_base_sptr. 2013-11-27 Dodji Seketeli Support diff for enum_type_decl * include/abg-ir.h (enum_type_decl_sptr): New typedef. (enum_type_decl::enumerator::enumerator): Make default constructor public so that enumerators can be stored in vectors. Maybe I should have made stored pointers to enumerators instead ... (enum_type_decl::enumerator::get_qualified_name): Define new method. * include/abg-comparison.h (string_enumerator_map) (changed_enumerator, string_changed_enumerator_map) (enum_diff_sptr): New convenience typedefs. (class enum_diff): Declare new class. (compute_diff): New overload for enum_type_decl. * src/abg-comparison.cc (enum diff_kind, report_mem_header): Move these at the beginning of the file. (struct enum_diff::priv): Define this. (enum_diff::{clear_lookup_tables, lookup_tables_empty, ensure_lookup_tables_populated, enum_diff, first_enum, second_enum, underlying_type_diff, deleted_enumerators, inserted_enumerators, changed_enumerators, length, report}): Define these new methods. (compute_diff): New overload for enum_diff. (compute_diff_for_types): Add support enum_type_decl here. 2013-11-27 Dodji Seketeli Fix equality operator for enum_type_decl * src/abg-ir.cc (enum_type_decl::operator==(const type_base& o)): This was comparing just the decl_base and type_base part of the enum. Now re-use the enum_type_decl::operator==(const decl_base) that compares the entirety of the types. 2013-11-27 Dodji Seketeli Fix indentation and wording of some existing diff reports * src/abg-comparison.cc (class_diff::report): Fix report wording. Change indentation space from 4 white spaces to two. (scope_diff::report): Fix logic indentation generation. 2013-11-26 Dodji Seketeli Change enum_type_decl::enumerators from a list to a vector * include/abg-ir.h (enum_type_decl::enumerators): Change this from a list to a vector. * src/abg-hash.cc (enum_type_decl::hash::operator()): Use the typedef enum_type_decl::enumerators rather than std::list. * src/abg-ir.cc (enum_type_decl::get_enumerators): Use the enum_type_decl::enumerators typedef. (enum_type_decl::operator==): Likewise. * src/abg-reader.cc (build_enum_type_decl): Likewise. * src/abg-writer.cc (write_enum_type_decl): Likewise. 2013-11-25 Dodji Seketeli Fix thinko in qualified_type_diff::length * src/abg-comparison.cc (qualified_type_diff::length): Fix thinko. 2013-11-25 Dodji Seketeli Support diff between qualified types * include/abg-ir.h (qualified_type_def_sptr): Declare new typedef. (class qualified_type_def): Add comment at the end. (operator<<(std::ostream&, qualified_type_def::CV)): Declare new streaming operator. * src/abg-ir.cc (operator<<(std::ostream&, qualified_type_def::CV)): Define this new streaming operator. * include/abg-comparison.h (class qualified_type): Declare new class. (compute_diff): Declare new overload for qualified_type_def_sptr. * src/abg-comparison.cc (struct qualified_type_diff::priv): Define new type. (qualified_type_diff::{qualified_type_diff, first_qualified_type, second_qualified_type, underlying_type_diff, length}): Define new methods. (get_leaf_type): Define new static function. (compute_diff): Define overload for qualified_type_def_sptr. (compute_diff_for_types): Add support for diffing qualified_type_def here. 2013-11-25 Dodji Seketeli Cleanup header of changes of underlying types of pointers/references * src/abg-comparison.cc ({pointer_diff, reference_diff}::report): Unify header of changes in the referenced type. * src/abg-ir.cc (decl_base::get_pretty_representation): By default, do not prefix types with "type ", for consistency sake. 2013-11-25 Dodji Seketeli Ensure diff types can only be created by compute_diff * include/abg-comparison.h (diff::diff): Make constructor protected. (pointer_diff::pointer_diff): Likewise. (pointer_diff::{first_pointer, second_pointer}): Constify the return type. (compute_diff): Make this a friend of class pointer_diff. (reference_diff::reference_diff): Make this constructor protected. (compute_diff): Make this a friend of class reference_diff. (class_diff::class_diff): Make this constructor protected. (compute_diff): Make this a friend of class class_diff. (scope_diff::scope_diff): Make this constructor protected. (compute_diff): Make this a friend of class scope_diff. (function_decl_diff::function_decl_diff): Make this constructor protected. (type_decl_diff::type_decl_diff): Likewise. (typedef_diff::typedef_diff): Likewise. (translation_unit_diff::translation_unit_diff): Likewise. (compute_diff): Make this a friend of class translation_unit_diff. * src/abg-comparison.cc (pointer_diff::{first_pointer, second_pointer}): Constify return type. 2013-11-21 Dodji Seketeli Add size/alignment info to class diff report * src/abg-comparison.cc (represent): Move these static overloads to the beginning of the file. (report_size_and_alignment_changes): New function. It has been factorized out of ... (type_decl_diff::report): ... this. (class_diff::report): Use the new report_size_and_alignment_changes to report size/alignment info for classes. 2013-11-21 Dodji Seketeli Style fix * src/abg-comparison.cc (class_diff::report): Rename first_class into first and second_class into second. 2013-11-21 Dodji Seketeli Misc diff reporting nits * include/abg-ir.h (type_decl::get_pretty_representation): New overload. * abg-ir.cc (type_decl::get_pretty_representation): Implement it. * src/abg-comparison.cc (represent, class_diff::report): Quote the pretty representation of abi artifacts in the report. (type_decl_diff::report): Better wording to express type_decl change. 2013-11-20 Dodji Seketeli Support reporting changed data member in class * include/abg-ir.h (operator<<(std::ostream&, decl_base::binding)) (operator<<(std::ostream&, class_decl::access_specifier)): Declare new streaming operators. (class_decl::member_type::get_pretty_representation): New virtual overload. * src/abg-ir.cc (operator<<(std::ostream&, decl_base::binding)): (operator<<(std::ostream&, class_decl::access_specifier)): Define new streaming operators. (class_decl::member_type::get_pretty_representation): Define new method. * src/abg-comparison.cc (represent): Make the existing overloads end by a newline. Add a new overload that represents the changes that happened a given data member. (enum diff_kind): New. (report_mem_header): Renamed report_num_dels_or_ins into this. Make it support introducing changed members as well as deletions/insertions. (class_diff::report): Adjust for the report_num_dels_or_ins -> report_mem_header change. Use the new represent() overload to report about changed data members. Adjust logic now that represent() emits a newline at its end. Also adjust logic as far as representing base classes and member types changes is concerned. (type_decl_diff::report): Remove useless white space. 2013-11-20 Dodji Seketeli Ensure that *::report adds just one empty line to its content * include/abg-comparison.h (diff::report): Add a comment saying that each the diff::report interface must leave one empty line at the end of the report. * src/abg-comparison.cc ({pointer_diff, reference_diff, class_diff, scope_diff, function_decl_diff, type_decl_diff, typedef_diff}::report): Leave just one empty line after content. 2013-11-20 Dodji Seketeli Various doxygen doc additions and fixes * include/abg-comparison.h: Lots of doc string additions & fixes, especially for typedefs. * include/abg-ir.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-ir.cc: Likewise. 2013-11-20 Dodji Seketeli Better support changed base classes and member types * include/abg-comparison.h (class_diff::{clear_lookup_tables, lookup_tables_empty, ensure_lookup_tables_populated}): Declare new methods. (compute_diff): Make this a friend of class_diff. * src/abg-comparison.cc (class_diff::priv::{deleted_bases_, inserted_bases_, changed_bases_, deleted_member_types_, inserted_member_types_, changed_member_types_, deleted_data_members_, inserted_data_members_, changed_data_members_, deleted_member_class_tmpls_, inserted_member_class_tmpls_, changed_member_class_tmpls_}): Define new members. (class_diff::priv::{base_has_changed, member_type_has_changed, data_member_has_changed}): Declare and define new methods. (class_diff::{clear_lookup_tables, lookup_tables_empty, ensure_lookup_tables_populated}): Define new methods. (class_diff::report): Detect and report when a base class or a member type has changed, as opposed to just saying that it has been removed and inserted. Fix the rest of the function to avoid emitting useless vertical space and avoid saying that the class has "zero" insertion/deletion of a given kind of member. (scope_diff::report): avoid saying that the scope has "zero" insertion/deletion of a given kind of member. Avoid useless vertical spaces. (type_decl_diff::report): Avoid useless vertical spaces. 2013-11-19 Dodji Seketeli Add bilint tool to validate bi files somewhat. * tools/bilint.cc: New file. * tools/Makefile.am: Build and install the new file above. 2013-11-19 Dodji Seketeli Add diff support for typedef_decl and type_decl * include/abg-ir.h (operator<<(std::ostream&, decl_base::visibility)): Declare new streaming operator. * src/abg-ir.cc (operator<<(std::ostream&, decl_base::visibility)): Define it. (type_decl::{operator==, get_pretty_representation}): Likewise, define these new overloads. (decl_base::{operator==, get_pretty_representation}): New overloads. * include/abg-comparison.h (type_decl_diff type_decl_diff_sptr, typedef_diff, typedef_diff_sptr): Declare new classes and typedefs. * src/abg-comparison.cc (type_decl_diff::{type_decl_diff, first_type_decl, second_type_decl, length, report}): New methods definitions. (compute_diff): New function definition that takes pointers of type_decl. (typedef_diff::{typedef_diff, first_typedef_decl, second_typedef_decl, underlying_type_diff, length, report}): New methods. (compute_diff): New function definition that takes pointers of typedef_decl. (try_to_diff_types): New template function, factorized out of ... (compute_diff_for_types): ... this. Add support diffing type_decl and typedef_decl. (pointer_diff::report): Fix indentation of emitted report. * tools/bidiff.cc (parse_command_line): Fix style. 2013-11-19 Dodji Seketeli Avoid missing member types while reading bi files * include/abg-fwd.h (get_type_declaration): Declare function. * include/abg-ir.h (class decl_base): Add class_decl as a friend. This to be able to call decl_base::set_scope from class_decl. (scope_decl::add_member_decl): Make this virtual protected, so that it can be called (virtually) from e.g, class_decl. (type_decl_sptr, typedef_decl_sptr): New convenience typedefs. (class_decl::add_member_decl): New virtual overload for scope_decl::add_member_decl. (class_decl::{add_member_type, add_data_member, add_member_function}): New overloads. * src/abg-ir.cc (add_decl_to_scope): Benign style cleanup. (get_type_declaration): Define new function. (class_decl::add_member_decl): New method. (class_decl::add_member_type): Avoid silently added a new member type when that member type has already been (perhaps inadvertently) added to a scope already. Rather, put a strict assert in place there. Also add a new overload that constructs the member type out of a classic type and adds it to the class. (class_decl::{add_data_member, add_member_function}): Likewise. (class_decl::{add_member_function_template, add_member_class_template}): Avoid silently added a new member template when that template has already been (perhaps inadvertently) added to a scope already. Rather, put a strict assert in place there. * src/abg-reader.cc (push_decl_to_current_scope): Take a an extra flag saying if the current decl should be added to the current scope as well (in addition to being pushed onto the stack of scopes maintained in the reader context). (push_and_key_type_decl): Likewise, take that extra flag and pass it to push_decl_to_current_scope. (build_function_decl, build_var_decl, build_type_decl) (build_qualified_type_decl, build_pointer_type_def) (build_reference_type_def, build_enum_type_decl, build_typedef_decl) (build_function_tdecl, build_class_tdecl): Likewise. (build_class_decl): Likewise. When building member data, types, and functions, make sure /not/ to add the data, type of function to the current scope before adding it to the class_decl. This was making the member not being added to the class because it already had a scope. (build_type_tparameter, build_type_composition) (build_non_type_tparameter, build_template_tparameter) (build_type): Adjust to add the template parm to the current scope explicitly, like previously. (handle_type_decl): Use build_type_decl function. Add the type_decl to the current scope, like previously. (handle_namespace_decl, handle_qualified_type_decl) (handle_pointer_type_def, handle_reference_type_def) (handle_enum_type_decl, handle_typedef_decl, handle_var_decl) (handle_function_decl, handle_class_decl, handle_function_tdecl) (handle_class_tdecl): Adjust to add the decl to the current scope, like previously. * tests/data/test-read-write/test21.xml: New test input with member type(def). 2013-10-24 Dodji Seketeli Avoid tabs and add const/virtual/offsets to class member diff reports * include/abg-ir.h (class_decl::get_num_virtual_functions): New declaration. * src/abg-ir.cc (class_decl::get_num_virtual_functions): New definition. (function_decl::get_pretty_representation): Represent destructors and const member functions. * src/abg-writer.cc (write_cdtor_const_static): Take a new bool parm for constness and serialize it. (write_class_decl): Serialize member functions & function template const-ness. * src/abg-reader.cc (read_cdtor_const): Read the "const" xml attribute, rather than "is_const". 2013-10-24 Dodji Seketeli Fix num insertions reporting in member functions * src/abg-comparison.cc (class_diff::report): Fix num insertions reporting. 2013-10-24 Dodji Seketeli Serialize vtable offset for virtual functions * include/abg-ir.h (class_decl::member_function::get_vtable_offset): Renamed class_decl::member_function::get_vtable_offset_in_bits into this. The offset is an index into a table; it's not a value in bits. * src/abg-hash.cc (class_decl::member_function::hash): Update wrt function name change above. * src/abg-ir.cc (class_decl::member_function::operator==): Likewise. * src/abg-reader.cc (build_class_decl): Rename the attribute vtable-offset-in-bits into vtable-offset. * src/abg-writer.cc (write_voffset): New function. (write_class_decl): Use the new write_voffset. Cleanup. 2013-10-24 Dodji Seketeli White space and style fixes * include/abg-ir.h (class_decl::member_function::member_function): Align function parameters. * src/abg-ir.cc (type_decl::operator==): Remove useless white spaces 2013-10-24 Dodji Seketeli Do not report added/removed type_decls * src/abg-comparison.cc (scope_diff::report): Do not report added/removed type_decls. 2013-10-24 Dodji Seketeli Fix string representation for variables and methods * src/abg-ir.cc (var_decl::get_pretty_representation): Don't use the pretty representation for the type of the variable; just use its qualified name. (method_type::set_class_type): I wonder what I was thinking when setting the first parameter's type to being the type of the class. Remove this. (function_decl::get_pretty_representation): Use the "method " prefix for methods. Avoid printing the first parameter of methods. Use the qualified name of the parameter type, rather than its pretty representation. * src/abg-writer.cc (write_class_decl): Do not skip the first function parameter when serializing the method. 2013-10-24 Dodji Seketeli Support reporting removed types/decls * include/abg-comparison.h (scope_diff::{removed_types, removed_decls, added_types, added_decls}): New accessor methods declarations. * src/abg-comparison.cc (scope_diff::{removed_types, removed_decls, added_types, added_decls}): New accessor methods definitions. (scope_diff::report): Report removed & added types/decls. 2013-10-24 Dodji Seketeli Fix erratic reporting of changed types & decls in scopes * src/abg-comparison.cc (scope_diff::ensure_lookup_tables_populated): A changed type/decl is not only one that has been both deleted and inserted (as is a type/decl with a given name N has been deleted and a type/decl with that same name N has been inserted), but we must also ensure that both inserted and deleted type/decl are not the same. Otherwise, it might has been a type/decl that has been shuffled around. 2013-10-24 Dodji Seketeli Fix some class & scope diff reports formatting glitchs * src/abg-comparison.cc (class_diff::report): Quote data members. (scope_diff::report): Simplify how we report changed types. Avoid unnecessary vertical spaces. 2013-10-24 Dodji Seketeli Pretty representation for variables and types by default * include/abg-ir.h (var_decl::get_pretty_representation): New method declaration. * src/abg-ir.cc (decl_base::get_pretty_representation): Prefix types with the "type " string. (var_decl::get_pretty_representation): New method definition. 2013-10-24 Dodji Seketeli Re-write middle snakes management in core diff algorithms * include/abg-diff-utils.h (point::set): New overload.. (point::{add, operator<, operator>, operator<=, operator>=}): New methods. (point::operator!=): Constify. (point::operator==): Constify. Cleanup. (point::operator=): Keep emptiness. (class snake): New class definition (d_path_vec::{over_bounds, offset}): New methods. (d_path_vec::check_index_against_bound): Don't take a bound parameter anymore. Use the new over_bound method above. Fix up error reporting. (d_path_vec::d_path_vec): Fix d_path_vec size allocation. (d_path_vec::operator[]): Use the d_path_vec::at method to check all accesses against the bounds. This is slower, but at least we can expect to have something that is more robust. We can remove the bound checking later when we are sure the code has been tested enough. Also use the new offset() method. (d_path_vec::at): Take long long. (ends_of_furthest_d_paths_overlap): Constify input parameters. (end_of_fr_d_path_in_k, end_of_frr_d_path_in_k_plus_delta): Take an instance of the new snake in parameter, rather than a bare end point that wasn't carrying enough information about the snake. Record the snake which consists of up to four points: a begin point, an intermediate point, a diagonal start point and an end point. Return that snake upon successful completion. (compute_middle_snake): Take an instance of snake, rather than the two points that were supposed to represent a snake and with which we were loosing information before. Revisit/simplify the logic of this function; this literally goes forward or in reverse, gets the resulting snake returned by the end_of_fr_d_path_in_k and end_of_frr_d_path_in_k_plus_delta functions, detect if these snakes overlap and just return the current snake. Much simpler. The caller now gets a snake, which has much more information than the previous snake approximation made of just two points. Bonus point, this follows almost to the word, what the paper says. (maybe_record_match_point, find_snake_start_point): Remove these as there are not used by compute_middle_snake anymore. (print_snake, ses_len): Update these to take/handle a snake. (snake_end_points): New declaration. (compute_diff): When we are getting an empty first sequence, this means that we are inserting the second sequence *before* the beginning of the first sequence; keep this information by setting the insertion point index to -1, rather than zero. Update this to get/handle snakes, rather than free points vaguely representing snakes. Now that compute_middle_snake returns real snakes, handle the information we are getting. Basically for edit scripts of length equal to 1, as the snake carries all the necessary information about the non-diagonal edge (as well as the diagonal edges), we (can) now precisely update the current edit script (as well as the longest common sub-sequence). For edit scripts of length greater than 1, better at which points to divide the problem and consequently, at which points to conquer it back -- better following The Paper to the letter. (display_edit_script): Update this for the use of instances of snake. * src/abg-diff-utils.cc (ends_of_furthest_d_paths_overlap): Update for constification of inputs. (snake_end_points): Define new function. (compute_middle_snake): Adapt for the taking an instance of snake. * tests/test-diff2.cc (main): Update for using instances of snake. * tests/test-core-diff.cc: Add new tests. * tests/data/test-core-diff/report0.txt: Update for output adaptation. * tests/data/test-core-diff/report6.txt: Likewise. * tests/data/test-core-diff/report7.txt: Likewise. * tests/data/test-core-diff/report8.txt: New test data. * tests/data/test-core-diff/report9.txt: Likewise. * tests/data/test-core-diff/report10.txt: Likewise. * tests/data/test-core-diff/report11.txt: Likewise. * tests/data/test-core-diff/report12.txt: Likewise. * tests/data/test-core-diff/report3.txt: Likewise. 2013-10-19 Dodji Seketeli Support diff/reporting for functions & better diff/report in general * include/abg-ir.h ({decl_base, class_decl, function_decl}::get_pretty_representation): New virtual member to get a pretty string name for decls & types. (class_decl::parameter): Add an index to the parameter type. (class_decl::parameter::parameter): Update the constructor for the change above. (class_decl::parameter::{get_index, set_index}): Accessors for the new index. (class_decl::parameter::operator==): Take in account the index. (function_type::append_parameter): Set the index of the parameter here. * include/abg-fwd.h (get_type_name): New declaration. * src/abg-ir.cc (get_type_name): New definition. ({decl_base, function_decl, class_decl}::get_pretty_representation): New implementations. (method_type::set_class_type): Update this to set function parameter's index by default. (function_decl::append_parameters): Use the append_parameter method from function_type. * include/abg-comparison.h (class function_decl_diff): New type declaration. * src/abg-comparison.cc (compute_diff_for_decls, compute_diff): New definitions. ({pointer_diff, class_diff, scope_diff}::report): Use the new get_pretty_representation. Output a prettier report. (function_decl_diff::priv): New type. (function_decl_diff::{deleted_parameter_at, inserted_parameter_at, ensure_lookup_tables_populated, function_decl_diff, first_function_decl, second_function_decl, changed_parms, removed_parms, added_parms, length, report}): New member function definitions. * src/abg-hash.cc (function_decl::parameter::hash): Update this to take the index in account. 2013-10-19 Dodji Seketeli Misc style & white space fixes * include/abg-fwd.h (is_global_scope, is_at_global_scope) (is_at_class_scope, is_at_template_scope, is_template_parameter) (is_type, is_var_decl, is_template_parm_composition_type) (is_template_decl, is_function_template_pattern) (add_decl_to_scope, get_global_scope, get_translation_unit): Remove parameter names from declarations. * include/abg-ir.h (decl_base::set_location): Remove useless white space. (struct type_shared_ptr_equal): Fix comment filling. 2013-10-16 Dodji Seketeli Avoid useless hashing during serialization * src/abg-writer.cc (write_context::get_id_for_type): Avoid the useless hashing incurred by the [] operator on the map, when we already have the value we want. 2013-10-16 Dodji Seketeli Add more IR nodes dumping routines * include/abg-fwd.h (dump): Declare 4 overloads for the dumping routines. * include/abg-ir.h (var_decl_sptr): New typedef. * src/abg-writer.cc (dump(const decl_base_sptr)): Add comments. (dump(const type_base_sptr)): New dumping routines. (dump(const var_decl_sptr)): Likewise. 2013-10-16 Dodji Seketeli Fix IR node comparison bugs * include/abg-ir.h (type_shared_ptr_equal::operator()): Fix thinko in checking for the boolean value of the pointers to types. * src/abg-ir.cc (type_decl::operator==(const decl_base&)): Do not forget to compare the decl_base part of the type too. (type_decl::operator==(const type_base&)): To ease maintenance, re-use the equality operator that takes a decl_base. (scope_type_decl::operator==(const type_base&)): Likewise. (qualified_type_def::operator==(const type_base&)): Likewise. (compare_function_types): New sub-routine to compare function types. It fixes an infinite recursion when comparing two methods of the same class. (function_type::operator==(const type_base&)): Use the new compare_function_types function. (class_decl::operator==(const decl_base&)): Fix a thinko in the first test of the function. Use a dedicated scope for each class section comparison; that way, there won't be any chance to misuse the variables pertaining to a different section. Fix the member function sections; we were mistakenly using the variables for the *data* section there. (class_decl::operator==(const type_base&)): Re-use the operator that takes a decl_base. (class_decl::operator==(const class_decl&)): Don't remove const-ness during the static cast. (class_decl::member_function::operator==(const member_function&)): Do not remove the reference from the static cast. (class_decl::member_class_template::operator==(const member_base&)): Likewise. (type_tparameter::operator==(const template_parameter&)): Likewise. (template_tparameter::operator==(const template_parameter&)): Likewise. (function_tdecl::operator==(const template_decl&)): Likewise. (class_tdecl::operator==(const template_decl&)): Likewise. (class_tdecl::operator==(const class_tdecl&)): Likewise. * tests/data/test-read-write/test12.xml: Update this because the test now correctly considers two type template parameters at the same index as being equivalent. * tests/data/test-read-write/test13.xml: Likewise. 2013-10-16 Dodji Seketeli On going white space cleanups * include/abg-ir.h: Remove useless white spaces. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. 2013-10-15 Dodji Seketeli Finish reporting about class_diff * src/abg-comparison.cc (report_num_dels_or_ins): Factorize out the header of each of inserted/deleted parts of the class into this new function. (class_diff::report): Use the new report_num_dels_or_ins. Cleanup the code. Add support for reporting about member functions, member function templates and member class templates. 2013-10-15 Dodji Seketeli White space cleanup in abg-ir.h * include/abg-ir.h (class_decl::member_function_template::member_function_template): Remove useless white space. 2013-10-15 Dodji Seketeli Progress on diffing pointers, references and classes * include/abg-comparison.h (diff::{first_subject,second_subject): Changed first_scope/second_scope into these; so that this diff class now works on stuff that are not scope. Changed the type of these to decl_base_sptr (diff::diff): Update for the change above. (diff::{length, report}): New virtual pure methods. (class pointer_diff, reference_diff): New classes declarations. (compute_diff): New overloads for the new classes above. Make the existing overloads take shared_pointers instead of references. Also make them return shared pointers of the computed diff, rather than just populating diff references passed in parameter. (class class_diff): Renamed class class_decl_diff into this. (report_changes): Change these functions into member functions. * src/abg-comparison.cc (compute_diff_for_types): New static function. (pointer_diff::pointer_diff, pointer_diff::first_pointer) (pointer_diff::second_pointer, pointer_diff::length) (pointer_diff::underlying_type_diff) (pointer_diff::underlying_type_diff, pointer_diff::report) (pointer_diff::report, compute_diff) (reference_diff::reference_diff, reference_diff::first_reference) (reference_diff::second_reference) (reference_diff::underlying_type_diff) (reference_diff::underlying_type_diff, reference_diff::length) (reference_diff::report, compute_diff): New functions. (class_diff::class_diff, class_diff::length) (class_diff::first_class_decl, class_diff::second_class_decl) (class_diff::base_changes, class_diff::base_changes) (class_diff::member_types_changes) (class_diff::member_types_changes) (class_diff::data_members_changes) (class_diff::data_members_changes, class_diff::member_fns_changes) (class_diff::member_fns_changes) (class_diff::member_fn_tmpls_changes) (class_diff::member_class_tmpls_changes) Update wrt class_decl_diff -> class_diff renaming. (class_diff::report): Make the report function be a member function. Add an indentation parameter. Add support for member types and data members. (compute_diff): New overload for class_decl_sptr. (scope_diff::first_scope, scope_diff::second_scope) (scope_diff::length, scope_diff::report): New member functions. (scope_diff::{deleted_member_at, inserted_member_at}): Update wrt first_scope -> first_subject change. (compute_diff): New overload for scope_decl_sptr. (translation_unit_diff::report): Change the report function into this member function. (compute_diff): Change the overload for translation_unit to take a translation_unit_sptr rather than a reference. * tools/bidiff.cc (main): Update this wrt the change of the signature of compute_diff. 2013-10-15 Dodji Seketeli Fix construction of class_decl::member_type * include/abg-ir.h (class_decl::member_type::member_type): Remove inline body from here. * src/abg-ir.cc (class_decl::member_type::member_type): Move implementation here. Also, properly set the name of the the member_type at construction time. 2013-10-15 Dodji Seketeli Few typedef additions to abg-ir.h * include/abg-ir.h (pointer_type_def_sptr) (reference_type_def_sptr): New typedefs. 2013-10-11 Dodji Seketeli Add debugging routines for decl_base_sptr and translation_unit * src/abg-writer.cc (dump): Add two version of this; on for decl_base_sptr, one for translation_unit&. 2013-10-11 Dodji Seketeli Initial implementation of tu diffing & bidiff cmd line program * include/abg-comparison.h (class translation_unit_diff): New type. (compute_diff): Make this take class_decl&, rather than class_decl_sptr. Add new overloads for scope_decl& and translation_unit&. (report_changes): New overload for scope_diff& and translation_unit&. * src/abg-comparison.cc (struct class_decl_diff::priv): New type. (class class_decl_diff): Add comments to methods. (class translation_unit_diff): Implement methods. (compute_diff, report_changes): Implement the new overloads. (scope_diff::ensure_lookup_tables_populated): Fix a thinko here. * src/abg-ir.cc (is_var_decl): Add new predicate. * tools/abg-tools-utils.h (file_exists, is_regular_file) (check_file): Declare new functions. * tools/abg-tools-utils.cc (get_stat, file_exists, check_file) (is_regular_file): Define new functions. (is_dir): Use the new get_stat. * tools/bidiff.cc: New file. * tools/Makefile.am: Add tools/bidiff.cc to the build system; make it produce the bidiff tool. 2013-10-10 Dodji Seketeli Fix inheritance of operator== on decl_base and type_base * include/abg-ir.h (*lots of descendants of decl_base, type_decl) (template_decl, class_decl::member_base): Replace the previous classical *::operator==(*&) with an overload of decl_base::operator==(const decl_base&), type_base::operator==(const type_base), template_decl::operator==(const template_decl&) or class_decl::member_base::operator==(const class_decl::member_base&). This makes the descendant operator be the one called when a comparison involves references the parent class. * src/abg-ir.cc: Write the implementation of the above. Remove the useless static_casts from the previous operator== code. 2013-10-10 Dodji Seketeli On going misc white spaces and style fixes * include/abg-ir.h: Add author. Remove many useless white spaces. Add missing end-of-class comments. Move function declaration comments from here to their definition point. * include/abg-fwd.h: Remove useless indentation. Also move doxygen comments to *definition* points in src/abg-ir.cc. * src/abg-ir.cc: Remove many useless white spaces. Move comments from declaration points to here. 2013-10-06 Dodji Seketeli Fix middle snake determination & ses len computation for d == 1 * include/abg-diff-utils.h (compute_middle_snake): After the overlap determination happened, finding the middle snake can require keep on building the current path until the "end". The end meaning reaching the max of D. And that max is (M + N)/2 + 1. In the extreme cases were middle snake was on the very last step (M + N) + 1, we were not finding the middle snake. Fix this. (compute_diff): When d == 1 and the first edge on the edit graph is a non-diagonal edge and when a_base != a_begin, we were failing to properly initialize x,y to find that non-diagonal edge. Also we were failing to correctly compute the size of the sequence. Fix these. * tests/test-core-diff.cc: Add a new regression test for the two cases above. * tests/data/test-core-diff/report7.txt: New reference data for the new regression test. 2013-10-05 Dodji Seketeli Initial un-debugged implementation of scope diffing * include/abg-comparison.h (class scope_diff): New type. (compute_diff(scope_decl_sptr, scope_decl_sptr, scope_diff)): New declaration. (report_changes): New declaration. * src/abg-comparison.cc (struct scope_diff::priv): Define. (scope_diff::{clear_lookup_tables, lookup_tables_empty, ensure_lookup_tables_populated, scope_diff, member_changes, deleted_member_at, inserted_member_at, changed_types, changed_decls}): Define these new member functions. (compute_diff): Define. * include/abg-ir.h (decl_base_sptr): New typedef. (operator==(decl_base_sptr, decl_base_sptr)): Declare new operator. * src/abg-ir.cc (operator==(decl_base_sptr, decl_base_sptr)): Define. (scope_decl::{operator==, traverse}): Adjust for using vectors to store scope members now, rather than lists. (scope_decl::{declarations, scopes}): Make these types be vector. This makes the members of a scopes be vector, rather than lists. This enables them to be diffed. 2013-10-05 Dodji Seketeli Simplify & cleanup compute_diff core api * include/abg-diff-utils.h (insertion::inserted_): Changed the type of this from vector to vector. (insertion::{insertion, inserted_indexes}): Adjust. (compute_diff): Add two new simpler overloads. Implement them in term of the former more complex overload. (compute_lcs): Adjust for the vector -> vector change. * src/abg-diff-utils.cc (compute_lcs, compute_ses): Adjust for the compute_diff change above. * src/abg-comparison.cc (compute_diff, report_changes): Adjust for the compute_diff & vector changes above.. 2013-10-05 Dodji Seketeli Misc white space, style and comments cleanup * include/abg-ir.h (class scope_decl): Add end of class comment. (class type_base): Add a _sptr typedef and end of class comment. * src/abg-ir.cc (operator==(class_decl_sptr, class_decl_sptr)): Fix comment. 2013-10-04 Dodji Seketeli Un-debugged initial implementation of class diffing. * include/abg-ir.h (decl_base::get_qualified_name): New declaration. (class_decl::{base_specs, member_types, data_members, member_functions, member_function_templates, member_class_templates}): Make all these containers be vectors, rather than list. This makes these containers (like class_decl::base_specs, class_decl::member_types, etc) be suitable to be used by the core diffing algorithms to diff their content. (operator==(class_decl_sptr, class_decl_sptr)) (operator==(class_decl::member_type_sptr, class_decl::member_type_sptr)) (operator==(class_decl::base_spec_sptr, class_decl::base_spec_sptr)) (operator==(class_decl::data_member_sptr, class_decl::data_member_sptr)) (operator==(class_decl::member_function_sptr, class_decl::member_function_sptr)) (operator==(class_decl::member_function_template_sptr, class_decl::member_function_template_sptr)) (operator==(class_decl::member_class_template_sptr, class_decl::member_class_template_sptr)): Declare these new equality operators. These are to be used by the core diffing algorithms when comparing two vectors of shared pointers of members of class_decls. * src/abg-ir.cc (decl_base::get_qualified_name): Define. (class_decl::class_decl, class_decl::operator==(class_decl&)): Adjust for the containers type change to a vector. (operator==(class_decl_sptr, class_decl_sptr)) (operator==(class_decl::member_type_sptr, class_decl::member_type_sptr)) (operator==(class_decl::base_spec_sptr, class_decl::base_spec_sptr)) (operator==(class_decl::data_member_sptr, class_decl::data_member_sptr)) (operator==(class_decl::member_function_sptr, class_decl::member_function_sptr)) (operator==(class_decl::member_function_template_sptr, class_decl::member_function_template_sptr)) (operator==(class_decl::member_class_template_sptr, class_decl::member_class_template_sptr)): Define these. * include/abg-comparison.h (diff::scope_): Remove (diff::{first_scope_, second_scope_}): New members. (class_decl_diff::class_decl_diff): Pass the new scopes to this constructor. (class_decl_diff::{first_class_decl, second_class_decl}) (report_changes): New declarations. * src/abg-comparison.cc (class_decl_diff::class_decl_diff): Update as per the declaration. (class_decl_diff::{first_class_decl, second_class_decl}): Define as per the declaration. (compute_diff): Initial implementation for this. (report_changes): Define. 2013-10-04 Dodji Seketeli Change the diff::changes_type back to just edit_script * include/abg-comparison.h (diff::changes_type): Remove this typedef. (class_decl_diff::data_members_changes): Rename class_decl_diff::data_member_changes into this. (class_decl_diff::member_fn_tmpls_changes): Renamed class_decl_diff::member_fn_tmpl_changes into this. (class_decl_diff::member_class_tmpls_changes): Renamed class_decl_diff::member_class_tmpl_changes into this. (class_decl_diff::{base_changes, member_types_changes, data_members_changes, member_fns_changes, member_fn_tmpls_changes, member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust these declarations for the use of edit_script. * src/abg-comparison.cc (class_decl_diff::priv::*): Likewise. (class_decl_diff::{base_changes, member_types_changes, data_members_changes, member_fns_changes, member_fn_tmpls_changes, member_fn_tmpls_changes, member_class_tmpls_changes}): Adjust these definitions for the above. 2013-10-04 Dodji Seketeli Misc white space, style and comment fixes * include/abg-ir.h: Lots of useless white space removals and comments adding. (class class_decl::member_base): Fix comment. * src/abg-hash.cc: Lots of useless white space removals too. * src/abg-ir.cc: Remove useless white space too. 2013-10-04 Dodji Seketeli Fix middle snake determination * include/abg-diff-utils.h (point::{operator!=,operator==}): New operators. (end_of_fr_d_path_in_k, end_of_frr_d_path_in_k_plus_delta): Allow the initial point (-1,-1) that is not a point addressing elements of the input sequences, but that is the starting point of the forward paths and the ending point of reverse paths in the "Linear Refinement" of the algorithm. (is_match_point, maybe_record_match_point) (find_snake_start_point): New functions. (find_last_snake_in_path): Remove this. It's not used anymore. (compute_middle_snake): Allow checking for overlapping paths even on points that are outside of the edit graph boundaries. Once the overlap is detected, if a non-empty snake has been seen already, report it as the middle snake. Otherwise, keep building the path until the end and report the last snake encountered as the middle snake. Add comments. (compute_diff): For the d == 1 case, fix the logic of the finding the non-diagonal edge. Fix typos. Add comments. (display_edit_script): Fix report glitches. * tests/data/test-core-diff/report3.txt: Update as per the report glitch above. * tests/data/test-core-diff/report4.txt: Likewise. * tests/data/test-core-diff/report5.txt: Likewise. * tests/data/test-core-diff/report6.txt: New reference report for a new test. * tests/test-core-diff.cc: Add a new test for negative delta. 2013-10-03 Dodji Seketeli Initial regression test facility for core diff algorithms * tests/data/test-core-diff/report0.txt: New test reference data. * tests/data/test-core-diff/report1.txt: Likewise. * tests/data/test-core-diff/report2.txt: Likewise. * tests/data/test-core-diff/report3.txt: Likewise. * tests/data/test-core-diff/report4.txt: Likewise. * tests/data/test-core-diff/report5.txt: Likewise. * tests/test-core-diff.cc: New regression test program. * tests/Makefile.am: Add these new files to the build system. 2013-10-02 Dodji Seketeli Initial command line testing facility for core diff algorithms * tests/test-diff2.cc: New command line testing facility. * tests/Makefile.am: Add this to the build system. 2013-10-02 Dodji Seketeli Fix core diff algorithms for negative deltas * diff2.h (point::point): New copy constructor. (point::{operator+=, operator=}): Use point::set. (point::{operator--, operator++,}): New operators. (d_path_vec::{a_size_, b_size_}): New members. (d_path_vec::max_d_): Remove this member. (d_path_vec::max_d): Compute this, now that max_d_ was removed. (point_is_valid_in_graph): Declare this new function. (end_of_fr_d_path_in_k, ): Return a bool when the end of furthest reaching past found is within the bounds of the edit graph. Add comments. (end_of_frr_d_path_in_k_plus_delta): Likewise. Also, delta can be negative; support that. Do not cross the boundaries of the edit graph when following a diagonal edge. (find_last_snake_in_path): New function. (compute_middle_snake): Make forward/reverse d_path_vec be big enough to hold paths for M+N differences. Normally M+N/2 should be enough, but we were getting weird out of bound errors. Let's handle it this way for now. Do not require that we check for overlap only when we are on a diagonal edge. Once we detected an overlap, use the new find_last_snake_in_path to find the boundaries of the snake. (ses_len): Delta can be negative. (display_edit): Small minor English nit. 2013-09-28 Dodji Seketeli Lay down the foundations of computing the diff between two class_decl * include/abg-diff-utils.h: New file. * src/abg-diff-utils.cc: Likewise. Implement the code diffing algorithms from Eugene Myers. * include/abg-comparison.h: New file. First short at defining the basic APIs to compute the diff of two classes. * src/abg-comparison.cc: New file. Start the implementation of the above header. 2013-09-26 Dodji Seketeli Prepare node visitors to be usable on things other than IR nodes * include/abg-fwd.h (node_visitor_base): Renamed ir_node_visitor into this. * include/abg-traverse.h (struct node_visitor_base): New base for the visitors. (struct traversable_base): Update comments. (traversable_base::traverse): Change this into non-pure virtual. Make it take a reference to node_visitor_base, rather than a reference to ir_node_visitor. * src/abg-traverse.cc (traversable_base::traverse): New empty default implementation. * include/abg-ir.h: Make ir_node_visitor inherit from new node_visitor_base. 2013-09-26 Dodji Seketeli Renamed data members from m_something to something_ * src/abg-ir.{cc,h}: Renamed data members from m_something to something_ and update their usage. 2013-08-29 Dodji Seketeli Initial version of an archive manipulation program: biar * tests/test-utils.h (is_dir, ensure_dir_path_created) (ensure_parent_dir_created): Move these directories manipulation utilities from here to ... * tools/abg-tools-utils.h (is_dir, ensure_dir_path_created) (ensure_parent_dir_created): ... here in this new file. (dir_name, base_name): Declare these new functions. * tests/test-utils.cc (is_dir, ensure_dir_path_created) (ensure_parent_dir_created): Likewise, move these to ... * tools/abg-tools-utils.cc (is_dir, ensure_dir_path_created) (ensure_parent_dir_created): ... here in this new file. (dir_name, base_name): Define these. * tools/Makefile.am: New file. Create a new libtoolsutils.la static library with stuff from tools/abg-tools-utils.cc in it. Also create a new 'biar' program with the stuff from the new tools/biar.cc in it. * tools/biar.cc: New file. Contains the code for the new "biar" archive manipulation command line utility. * tests/test-read-write.cc (main): Adjust for the change about ensure_parent_dir_created above. * tests/test-write-read-archive.cc (main): Likewise. * Makefile.am (SUBDIRS): Add the new tools/ sub-directory to the build system. * configure.ac (AC_CONFIG_FILES): Generate tools/Makefile. * tests/Makefile.am: Make libtestutils.la link with the new libtoolsutils.la. Make sure to express the dependencies between libtestutils.la and the binaries that depend on it. Otherwise parallel builds can go awry. 2013-08-29 Dodji Seketeli Define translation_unit{_sptr,s} types in abigail:: * include/abg-corpus.h (abigail::corpus::{translation_unit_sptr, translation_units): Do not define these typedefs here. Rather) (define them ... * include/abg-ir.h (abigail::{translation_units,translation_unit_sptr): ... here. This is because a translation unit can be manipulated independently from an abi corpus. * src/abg-corpus.cc (corpus::get_translation_units): Adjust return type to comply with the change above. 2013-08-29 Dodji Seketeli Fix header inclusion in abg-corpus.h * include/abg-corpus.h: Drop incomplete abg-traverse.h and abg-fwd.h. Use abg-ir.h proper and be done with it. Users of the library will just have to use abg-corpus.h to manipulate and the archives and the IR they contain. 2013-08-29 Dodji Seketeli Add error message to translation_unit::write * src/abg-writer.cc (translation_unit::write): Add an error message to stderr if something ultimately went wrong. 2013-08-29 Dodji Seketeli Rename abigail::corpus::{get_file_path --> get_path} * include/abg-corpus.h (corpus::{get_path, set_path): Renamed corpus::get_file_path and corpus::set_file_path into these as get_path/set_path is what is used elsewhere as well. * src/abg-corpus.cc (corpus::{get_path, set_path}): Likewise. * tests/test-write-read-archive.cc (main): Adjust for the change above. 2013-08-29 Dodji Seketeli Cleanup src/Makefile.am * src/Makefile.am: Fix library naming and remove useless trailing space from directory path. 2013-08-27 Dodji Seketeli Initial writing/reading of an ABI corpus to an archive * configure.ac: Support detection of libzip dependency. Define new DEPS_CFLAGS and DEPS_LIBS variables for use in Makefile.am to refer to the dependency headers and libraries. * doc/website/mainpage.txt: Update this to talk about the new libzip dependency. * include/Makefile.am: Add abg-libzip-utils.h to the build system. * include/abg-corpus.h (corps): Hide abigail::corpus's private behind a pimpl idiom. (corpus::{drop_translation_units, get_file_path, set_file_path, write, read}): New methods. * include/abg-libxml-utils.h (new_reader_from_buffer): Declare new function. * include/abg-libzip-utils.h: New file. * src/Makefile.am: Add abg-corpus.cc and abg-libzip-utils.cc to the build system. Refer to the library and headers dependencies via the new DEPS_LIBS and DEPS_CFLAGS variables. * src/abg-corpus.cc: New file. * src/abg-ir.cc (translation::set_path): New method. * src/abg-libxml-utils.cc (new_reader_from_buffer): Define new function. * src/abg-libzip-utils.cc: New file. * src/abg-reader.cc (translation_unit::read): New overload. * src/abg-writer.cc: Inject the names from the std namespace into the abigail namespace, rather than into abigail::writer. (abigail::translation_unit::write): New overload. This can now use ofstream and the other stuff from std that are injected in the abigail:: namespace. * tests/Makefile.am: Add tests/test-write-read-archive.cc to the build system; use that to build runtestwritereadarchive. Also add the input test data from tests/data/test-write-read-archive/test[0-4].xml. * /tests/data/test-write-read-archive/test[0-4].xml: New test input data files. * tests/test-write-read-archive.cc: New test for this archive write/read support. 2013-08-27 Dodji Seketeli Fix & add missing API documentation * src/abg-ir.cc (location_manager::create_new_location): Fix documentation comment. (translation_unit::translation_unit) (translation_uni::get_global_scope, translation_unit::get_path) (translation_unit::traverse, translation_unit::get_loc_mgr) (translation_unit::is_empty, translation_unit::traverse): Add missing documentation comments. * src/abg-libxml-utils.cc (new_reader_from_file): Fix comment. * src/abg-reader.cc (translation_unit::read): Likewise. 2013-08-27 Dodji Seketeli Remove useless header inclusion * include/abg-traverse.h: Remove useless #include 2013-08-27 Dodji Seketeli Misc white space cleanups * include/abg-corpus.h: Cleanup white spaces. * include/abg-fwd.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * src/abg-config.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. 2013-08-27 Dodji Seketeli Small cleanup in abg-config.cc * src/abg-config.cc: Include auto-generated $(top_builddir)/config.h file. 2013-08-27 Dodji Seketeli Pass absolute paths to the compiler during the build * src/Makefile.am: Pass absolute file paths to the compiler during the build. This helps in e.g in emacs' compilation mode, when the output shows an error reported by GCC's diagnostics, setting point to the error line and hitting 'enter' transports the user to the file location where the error happened; as the file path is nows absolute, emacs can always find it. Otherwise, finding it depends on $PWD and whatnot. * tests/Makefile.am: Likewise. 2013-08-27 Dodji Seketeli Misc cleanups in abg-fwd.h * include/abg-fwd.h: Move location, location_manager and translation_unit in the ir section. Remove stuff that was commented out anyway. 2013-08-27 Dodji Seketeli Move location, location_manager & translation_unit back into abg-ir.h * include/abg-corpus.h: Move location location_manager, translation_unit from here ... * include/abg-ir.h: ... to here. The reason being that these are really constructs of the Internal Representation of the ABI/API of a translation unit. What is left in abg-corpus is really exclusively related to an ABI Corpus, which I see more as a "packaging" construct that abstracts the bundling of several translation units together. Also, I fixed some comments about the location/location_manger types; now a location is made specific to a translation unit; to an abi corpus. A location of a given translation unit has to be decoded by the location manager of that same translation unit. 2013-08-22 Dodji Seketeli Make libxml2 a private dependency wrt pkconfig * libabigail.pc.in: Libxml2 is not exposed to clients so make it be a private dependency. 2013-08-22 Dodji Seketeli White space fix in COMPILING * COMPILING: White space fix. 2013-08-22 Dodji Seketeli Add abg-version.h.in to the source distribution & cleanup * include/Makefile.am: Add abg-version.h.in to the source distribution. * configure.ac: Generate abg-version.h in using the existing AC_CONFIG_FILES macro call. 2013-08-22 Dodji Seketeli Support pkgconfig through a new libabigail.pc file * libabigail.pc.in: New pkgconfig file. * configure.ac: Define the LIBXML2_VERSION variable that is used in the libabigail.pc.in file. Generate the libabigail.pc file from its libabigail.pc.in template. * Makefile.am: Add libabigail.pc.in to the source distribution. Install the generated libabigail.pc to the right destination. 2013-08-21 Dodji Seketeli Tweak the apidoc mainpage * include/abg-fwd.h: Fix link to the project web page and for git check-out. 2013-08-21 Dodji Seketeli Initial website generation-fu using Doxygen * doc/website/mainpage.txt: New file representing the input for the website. * doc/website/libabigail-website.doxy: New file representing the doxygen configuration for the website generation. * doc/api/libabigail.doxy: Output doxygen generation warnings into a file. * doc/Makefile.am: Support generating the website from doxygen. Update the api generation relevant macros names for better consistency. Make "make html" generate the website too. Make "make clean" erase the website bits too. Add a 'website' target to make the website. 2013-08-21 Dodji Seketeli Fix typo in CONTRIBUTING file * CONTRIBUTING: Fix typo, courtesy of Mark Wielaard. 2013-08-19 Dodji Seketeli Remove autotools-generated files * Makefile.in: Remove this autotools-generated file. I know that people in the GCC-realm like storing these autotools-generated files into the source control system, but I believe in this day and age, this is annoying (to say the least) for the project developers for no good reason. Requiring (the ubiquitous) autoconf for building from source is no big deal today, and typing "autoreconf" is not hard to do, really. And it saves the developers for having to update a bunch of boilerplate automatically generated files into the source control system; this is really unnecessary noise and it is a commonly accepted good practice to avoid doing it these days. To help people who do not know how to handle this, there is a COMPILING file in the source tree that explains how to build the project from sources. * aclocal.m4: Likewise. * configure: Likewise. * include/Makefile.in: Likewise. * src/Makefile.in: Likewise. * doc/Makefile.in: Likewise. * tests/Makefile.in: Likewise. 2013-08-19 Dodji Seketeli Add a new COMPILING file explaining how to build the package * COMPILING: New file. 2013-08-14 Dodji Seketeli Remove name of unused parameter in decl_base::traverse. * src/abg-ir.c (decl_base::traverse): Remove name of unused parameter. 2013-08-14 Dodji Seketeli install headers in $includedir/libabigail * include/Makefile.am: Install headers in $includedir/libabigail 2013-08-14 Dodji Seketeli For usage from within GCC set header path to $includedir/libabigail * abigail.m4: The include path used for compilation goes to $includedir/libabigail. 2013-08-08 Benjamin Kosnik Separate out bits from the ir header. * include/abg-irfwd.h: Move to... * include/abg-fwd.h: ...this. * include/abg-ir.h (traverse_base): Move to... * include/abg-traverse.h: ...here. New. * include/abg-ir.h (location, location_manager, translation_unit): Move to... * include/abg-corpus.h: ...here. * include/Makefile.am: Adjust. * include/Makefile.in: Regenerate. 2013-08-07 Benjamin Kosnik Template naming compression. * include/abg-ir.h: Template naming compressions. (class_template_decl): To class_tdecl. (function_template_decl): To function_tdecl. (template_type_parameter): To type_tparameter. (template_non_type_parameter): To non_type_tparameter. (template_template_parameter): To template_tparameter. (tmpl_parm_type_composition): To type_composition. * include/abg-irfwd.h: Same. * src/abg-hash.cc: Same. * src/abg-ir.cc: Same. * src/abg-reader.cc: Same. 2013-08-07 Benjamin Kosnik Slight change to doxy config. * doc/api/libabigail.doxy: Turn off namespace scopes, on all the viz. 2013-08-07 Benjamin Kosnik Move class_decl nested types out-of-line. * include/abg-ir.h (class_decl): Move nested types out of line. 2013-08-07 Benjamin Kosnik Rename class_decl::method to class_decl::method_base. * include/abg-ir.h (class_decl::member): To member_base. * src/abg-hash.cc: Same. * src/abg-ir.cc: Same. * src/abg-writer.cc: Same. 2013-08-07 Benjamin Kosnik Nest hashers. * include/abg-ir.h: Nest all hashers. * include/abg-irfwd.h (abigail): Don't inject std::tr1::hash. Remove hasher forward declarations. * include/abg-hash.h: Tweak. * src/abg-hash.cc: Define hashers here. * src/abg-ir.cc: Adjust for above. * src/abg-reader.cc: Same. * src/abg-writer.cc: Same. 2013-08-06 Benjamin Kosnik Rename abi_corpus to corpus * include/abg-corpus.h (abi_corpus): Change to corpus. * include/abg-hash.h: Tweaks. * include/abg-libxml-utils.h: Same. 2013-08-06 Benjamin Kosnik Simplify interface for serializing/deserializing translation_units. * include/abg-ir.h (translation_unit::read): New member function. (translation_unit::write): Same. * src/abg-reader.cc (translation_unit::read): Define. * src/abg-writer.cc (translation_unit::write): Define. * include/abg-reader.h: Remove. * include/abg-writer.h: Remove. * include/Makefile.am (headers): Same. * include/Makefile.in: Regenerate. 2013-08-06 Benjamin Kosnik First pass clean reading API. * include/abg-reader.h (read_file): Remove extraneous file parameter. * src/abg-reader.cc: Same. * tests/test-read-write.cc: Adjust. 2013-08-06 Benjamin Kosnik Rename traversable to traversable_base, move up the _decl hierarchy via decl_base derivation. * include/abg-ir.h (traversable): To traversable_base. (decl_base): Inherit from traversable_base. (decl_base::traverse): Null definition. (function_decl, etc.): Remove traversable_base as base class. 2013-08-06 Benjamin Kosnik Standardize typedef naming. Plural form is the container form, smart_ptr types are type + _sptr. * include/abg-ir.h (scope_decl): Add declarations, scopes as types. (function_type): Add parameter_sptr, parameters as types. (enum_type_decl): Add type_sptr, enumerators as types. (class_decl): Adjust typedefs for consistency. Change base_specs_type to base_specs, member_types_type to member_types, data_members_type to data_members, member_functions_type to member_functions, member_function_templates_type to member_function_templates, member_class_templates_type to member_class_templates. 2013-08-02 Benjamin Kosnik Doxygen markup fixes final. * include/abg-config.h: Doxygen cleanups round two. * include/abg-hash.h: Same. * include/abg-ir.h: Same. * include/abg-irfwd.h: Same. * include/abg-libxml-utils.h: Same. * src/abg-config.cc: Same. * src/abg-hash.cc: Same. * src/abg-ir.cc: Same. * src/abg-reader.cc: Same. * src/abg-writer.cc: Same. 2013-08-01 Benjamin Kosnik Forward decls for abg-ir.h, doxygen fixups, restyle. * include/abg-irfwd.h: New file for forward declarations. * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/*: Forward declare, doxygen fixups, restyle. * src/*: Same. * src/abg-corpus.cc: Empty, removed. * doc/api/libabigail.doxy: Tweak. 2013-08-01 Benjamin Kosnik Add virtual dtor to translation_unit. * include/abg-ir.h (translation_unit): Add virtual dtor. * src/abg-ir.cc: Define. 2013-08-01 Benjamin Kosnik Adjust doxygen input path. * doc/api/libabigail.doxy: Adjust include directory. 2013-08-01 Benjamin Kosnik Collapse subdir of include to include. * include/libabigail/abg-*.h: Move to... * include/abg-*.h * include/libabigail: Remove. * configure.ac: Adjust include location from libabigail/include to include. * Makefile.in: Same. * aclocal.m4: Same. * configure: Same. * doc/Makefile.in: Same. * include/Makefile.am: Same. * src/Makefile.am: Same. * src/Makefile.in: Same. * tests/Makefile.am: Same. * tests/Makefile.in: Same. 2013-07-23 Dodji Seketeli Update autotool auto-generated files * Makefile.in: Updated. * aclocal.m4: Likewise. * configure: Likewise. * doc/Makefile.in: Likewise. * src/Makefile.in: Likewise. * tests/Makefile.in: Likewise. 2013-07-20 Dodji Seketeli Implement a translation unit traversal API * include/libabigail/abg-ir.h (struct ir_node_visitor, struct traversable): New interfaces. (translation_unit, scope_decl, type_decl, qualified_type_def) (pointer_type_def, reference_type_def, enum_type_decl) (typedef_decl, var_decl, function_decl, data_member) (member_function, member_function_template) (member_class_template): Implement the traversable interface, overload the traversable::traverse pure virtual function. * src/abg-ir.cc ({translation_unit, scope_decl, type_decl, namespace_decl, qualified_type_def, pointer_type_def, reference_type_def, enum_type_decl, typedef_decl, var_decl, function_decl, class_decl::member_function, class_decl, class_decl::data_member, class_decl::member_function_template, class_decl::member_class_template, function_template_decl, class_template_decl, }::traverse): Implement traversal. (ir_node_visitor::visit): New method, overloaded for the types above, which implement the traversable interface. * tests/test-walker.cc: New test case program to showcase how to use the new traversal API. * tests/makefile.am: Add test-walker.cc to the build system. 2013-07-19 Dodji Seketeli By default, statically link libabigail with whoever uses abigail.m4 * abigail.m4: Make $abigaillibs statically link libabigail by default. 2013-07-19 Dodji Seketeli Move static member definition to abg-viz-dot.cc file * include/libabigail/abg-viz-dot.h: Move definition of node_base::_M_count_total to ... * src/abg-viz-dot.cc: ... here. 2013-07-19 Dodji Seketeli Put headers in include/libabigail * include/libabigail: New directory. * include/Makefile.am: New file. * include/libabigail/Makefile.am: New file. * src/abg-*.h: Move these in include/libabigail/*.h * src/Makefile.am: Set -I option to look for headers in include/libabigail * doc/api/libabigail.doxy: Look for headers in include/libabigail * tests/Makefile.am: Set -I option to look for headers in include/libabigail * abigail.m4: Set includedir to $prefix/include/libabigail for library used as a dep, or to srcdir/libabigail/include/libabigail in GCC source tree. * configure.ac: Add Makefile.am in include and include/libabigail * abigail.m4: Look for headers in include/libabigail when the libabigail is in in the source tree and in $incdir/libabigail when it is installed as a dependency. 2013-07-18 Benjamin Kosnik Install into docdir, turn off collaboration graphs. * doc/Makefile.am (doc-install-html-doxygen): Install generated files into docdir. * doc/api/libabigail.doxy (COLLABORATION_GRAPH): Turn off. 2013-07-18 Benjamin Kosnik Fix dependencies for api/html output directory. * doc/Makefile.am: Create abi output directory. 2013-07-16 Dodji Seketeli Prepare for publishing * COMMIT-LOG-GUIDELINES: New file. * CONTRIBUTING: New file. * README: Amended to refer to the first files above. 2013-07-16 Dodji Seketeli LGPLv3 License the library * COPYING-LGPLV3: New file. * abg-config.cc: License the file to LGPLv3. * abg-config.h: Likewise. * abg-corpus.cc: Likewise. * abg-corpus.h: Likewise. * abg-hash.cc: Likewise. * abg-hash.h: Likewise. * abg-ir.cc: Likewise. * abg-ir.h: Likewise. * abg-libxml-utils.cc: Likewise. * abg-libxml-utils.h: Likewise. * abg-reader.cc: Likewise. * abg-reader.h: Likewise. * abg-writer.cc: Likewise. * abg-writer.h: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-common.h: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-dot.h: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-viz-svg.h: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. 2013-07-17 Dodji Seketeli Add assert.h in abg-ir.cc * src/abg-ir.cc: Add missing assert.h 2013-07-17 Dodji Seketeli Fix missing license blurbs * src/abg-config.cc: Fix licensing blurb. * src/abg-config.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-corpus.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-ir.h: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. 2013-07-02 Benjamin Kosnik Correct DOT merge. * src/abg-viz-common.h: Use _M_attributes for attribute overflows. * src/abg-viz-dot.h: Merge in correct node_base. * src/abg-viz-dot.cc: Same. * tests/test-dot.cc: Correct examples. * tests/Makefile.am: Add .gv to CLEANFILES. * tests/Makefile.in: Regenerate. 2013-07-02 Benjamin Kosnik Pull out common style type. * src/abg-viz-common.h: Pull out common style type. * src/abg-viz-dot.cc: Adjust scoping. * src/abg-viz-common.cc: Same. * src/abg-viz-dot.h: Use common style class. * src/abg-viz-svg.h: Same. 2013-07-02 Benjamin Kosnik Commonize visualization support. * src/abg-viz-svg.h: Move common code to... * src/abg-viz-dot.h: Move common code to... * src/abg-viz-common.h: ...here. New. * src/abg-viz-svg.cc: Move common code to... * src/abg-viz-common.cc: ...here. New. * src/Makefile.am: Add abg-viz-common.cc, abg-viz-common.h * src/Makefile.in: Regenerate. 2013-07-01 Benjamin Kosnik Initial DOT work. * doc/vizualization/layout/scripts/ (inkscape_export_svg_to_plain_svg.sh): Move... (inkscape_export_svg_to_png_and_pdf.sh): Move... * scripts: ..here. New toplevel directory. * scripts/scripts/dot_to_png.sh: New. * scripts/scripts/dot_to_svg.sh: New. * src/Makefile.am: Add abg-viz-dot.cc, abg-viz-dot.h. * tests/Makefile.am: Add test-dot.cc. * src/abg-viz-dot.cc: New. * src/abg-viz-dot.h: New. * tests/test-dot.cc: New. * doc/vizualization/graph: New. * doc/vizualization/graph/gv/sa-A.gv: New. * doc/vizualization/graph/gv/sa-B.gv: New. * doc/vizualization/graph/gv/sa-C1.gv: New. * doc/vizualization/graph/gv/sa-C2.gv: New. * doc/vizualization/graph/gv/sa-C3.gv: New. * doc/vizualization/graph/gv/sa-C4.gv: New. * doc/vizualization/graph/gv/sa-D1.gv: New. * doc/vizualization/graph/gv/sa-D2.gv: New. * doc/vizualization/graph/gv/sa-D2v.gv: New. * doc/vizualization/graph/gv/sa-D3.gv: New. * doc/vizualization/graph/gv/sa-D3v.gv: New. * doc/vizualization/graph/gv/sa-D4v.gv: New. * doc/vizualization/graph/gv/sa-D5v1.gv: New. * doc/vizualization/graph/gv/sa-D5v2.gv: New. * doc/vizualization/graph/gv/sa-DD1.gv: New. * doc/vizualization/graph/gv/sa-DD2.gv: New. * doc/vizualization/graph/gv/sa-DD3.gv: New. * doc/vizualization/graph/gv/sa-DD4.gv: New. * doc/vizualization/graph/gv/sa-DD5.gv: New. * doc/vizualization/graph/gv/sa-base.gv: New. * doc/vizualization/graph/png/sa-A.png: New. * doc/vizualization/graph/png/sa-B.png: New. * doc/vizualization/graph/png/sa-C1.png: New. * doc/vizualization/graph/png/sa-C2.png: New. * doc/vizualization/graph/png/sa-C3.png: New. * doc/vizualization/graph/png/sa-C4.png: New. * doc/vizualization/graph/png/sa-D1.png: New. * doc/vizualization/graph/png/sa-D2.png: New. * doc/vizualization/graph/png/sa-D2v.png: New. * doc/vizualization/graph/png/sa-D3.png: New. * doc/vizualization/graph/png/sa-D3v.png: New. * doc/vizualization/graph/png/sa-D4v.png: New. * doc/vizualization/graph/png/sa-D5v1.png: New. * doc/vizualization/graph/png/sa-D5v2.png: New. * doc/vizualization/graph/png/sa-DD1.png: New. * doc/vizualization/graph/png/sa-DD2.png: New. * doc/vizualization/graph/png/sa-DD3.png: New. * doc/vizualization/graph/png/sa-DD4.png: New. * doc/vizualization/graph/png/sa-DD5.png: New. * doc/vizualization/graph/png/sa-base.png: New. * doc/vizualization/graph/sources/sa-A.cc: New. * doc/vizualization/graph/sources/sa-B.cc: New. * doc/vizualization/graph/sources/sa-C.cc: New. * doc/vizualization/graph/sources/sa-D.cc: New. * doc/vizualization/graph/sources/sa-DD.cc: New. * doc/vizualization/graph/sources/sa-base.cc: New. * doc/vizualization/graph/svg/sa-A.svg: New. * doc/vizualization/graph/svg/sa-B.svg: New. * doc/vizualization/graph/svg/sa-C1.svg: New. * doc/vizualization/graph/svg/sa-C2.svg: New. * doc/vizualization/graph/svg/sa-C3.svg: New. * doc/vizualization/graph/svg/sa-C4.svg: New. * doc/vizualization/graph/svg/sa-D1.svg: New. * doc/vizualization/graph/svg/sa-D2.svg: New. * doc/vizualization/graph/svg/sa-D2v.svg: New. * doc/vizualization/graph/svg/sa-D3.svg: New. * doc/vizualization/graph/svg/sa-D3v.svg: New. * doc/vizualization/graph/svg/sa-D4v.svg: New. * doc/vizualization/graph/svg/sa-D5v1.svg: New. * doc/vizualization/graph/svg/sa-D5v2.svg: New. * doc/vizualization/graph/svg/sa-DD1.svg: New. * doc/vizualization/graph/svg/sa-DD2.svg: New. * doc/vizualization/graph/svg/sa-DD3.svg: New. * doc/vizualization/graph/svg/sa-DD4.svg: New. * doc/vizualization/graph/svg/sa-DD5.svg: New. * doc/vizualization/graph/svg/sa-base.svg: New. 2013-07-01 Benjamin Kosnik Regenerate build/configure. * aclocal.m4: * configure: 2013-06-06 Benjamin Kosnik Regenerate configure files. * Makefile.in: * aclocal.m4: * configure: * doc/Makefile.in: * src/Makefile.in: * tests/Makefile.in: 2013-05-28 Benjamin Kosnik Add svg generation. * src/Makefile.am: Add abg-viz-svg.cc, abg-viz-svg.h. * tests/Makefile.am: Add test-svg.cc. * src/abg-viz-svg.cc: New. * src/abg-viz-svg.h: New. * tests/test-svg.cc: New. 2013-05-22 Benjamin Kosnik Remove ChangeLog * ChangeLog: Remove content. 2013-05-21 Benjamin Kosnik Fixup abg-version.h merge duplicate. * configure.ac: Remove src/abg-version.h merge duplicate. 2013-05-20 Benjamin Kosnik Add doc/visualization/layout. * doc/vizualization/layout: New. * doc/vizualization/layout/pdf/sa-A.pdf: New. * doc/vizualization/layout/pdf/sa-B.pdf: New. * doc/vizualization/layout/pdf/sa-C1.pdf: New. * doc/vizualization/layout/pdf/sa-C2.pdf: New. * doc/vizualization/layout/pdf/sa-C3.pdf: New. * doc/vizualization/layout/pdf/sa-D1.pdf: New. * doc/vizualization/layout/pdf/sa-D2.pdf: New. * doc/vizualization/layout/pdf/sa-D2v.pdf: New. * doc/vizualization/layout/pdf/sa-D3.pdf: New. * doc/vizualization/layout/pdf/sa-D3v.pdf: New. * doc/vizualization/layout/pdf/sa-D4v.pdf: New. * doc/vizualization/layout/pdf/sa-DD1.pdf: New. * doc/vizualization/layout/pdf/sa-DD2.pdf: New. * doc/vizualization/layout/pdf/sa-DD3.pdf: New. * doc/vizualization/layout/pdf/sa-DD4.pdf: New. * doc/vizualization/layout/pdf/sa-DD5.pdf: New. * doc/vizualization/layout/pdf/sa-base.pdf: New. * doc/vizualization/layout/png/sa-A.png: New. * doc/vizualization/layout/png/sa-B.png: New. * doc/vizualization/layout/png/sa-C1.png: New. * doc/vizualization/layout/png/sa-C2.png: New. * doc/vizualization/layout/png/sa-C3.png: New. * doc/vizualization/layout/png/sa-D1.png: New. * doc/vizualization/layout/png/sa-D2.png: New. * doc/vizualization/layout/png/sa-D2v.png: New. * doc/vizualization/layout/png/sa-D3.png: New. * doc/vizualization/layout/png/sa-D3v.png: New. * doc/vizualization/layout/png/sa-D4v.png: New. * doc/vizualization/layout/png/sa-DD1.png: New. * doc/vizualization/layout/png/sa-DD2.png: New. * doc/vizualization/layout/png/sa-DD3.png: New. * doc/vizualization/layout/png/sa-DD4.png: New. * doc/vizualization/layout/png/sa-DD5.png: New. * doc/vizualization/layout/png/sa-base.png: New. * doc/vizualization/layout/scripts/ (inkscape_export_svg_to_plain_svg.sh): New. (inkscape_export_svg_to_png_and_pdf.sh): New. * doc/vizualization/layout/sources/sa-A.cc: New. * doc/vizualization/layout/sources/sa-B.cc: New. * doc/vizualization/layout/sources/sa-C.cc: New. * doc/vizualization/layout/sources/sa-D.cc: New. * doc/vizualization/layout/sources/sa-DD.cc: New. * doc/vizualization/layout/sources/sa-base.cc: New. * doc/vizualization/layout/svg/sa-A.svg: New. * doc/vizualization/layout/svg/sa-B.svg: New. * doc/vizualization/layout/svg/sa-C1.svg: New. * doc/vizualization/layout/svg/sa-C2.svg: New. * doc/vizualization/layout/svg/sa-C3.svg: New. * doc/vizualization/layout/svg/sa-D1.svg: New. * doc/vizualization/layout/svg/sa-D2.svg: New. * doc/vizualization/layout/svg/sa-D2v.svg: New. * doc/vizualization/layout/svg/sa-D3.svg: New. * doc/vizualization/layout/svg/sa-D3v.svg: New. * doc/vizualization/layout/svg/sa-D4v.svg: New. * doc/vizualization/layout/svg/sa-DD1.svg: New. * doc/vizualization/layout/svg/sa-DD2.svg: New. * doc/vizualization/layout/svg/sa-DD3.svg: New. * doc/vizualization/layout/svg/sa-DD4.svg: New. * doc/vizualization/layout/svg/sa-DD5.svg: New. * doc/vizualization/layout/svg/sa-base.svg: New. 2013-05-20 Benjamin Kosnik Generate abg-version.h at configure time. * configure.ac: Add src/abg-version.h to AC_CONFIG_FILES. * src/Makefile.am: Remove abg-version.h generation rules. * src/abg-version.h.in: New. 2013-04-02 Benjamin Kosnik Add doc dir. Add Doxgen api generation rules. * doc: Add. * doc/Makefile.am (html, install-html): Add. * doc/Makefile.in: Add. * doc/api/libabigail.doxy: Add doxygen config. * src/abg-*: Add @file markup. 2013-03-27 Benjamin Kosnik Add configure to source control * configure: Add. * src/abg-corpus.cc: include stdexcept 2013-06-25 Dodji Seketeli Support offsets and virtual attribute in base class specifiers * src/abg-ir.h (class_decl::base_spec::base_spec): Take an offset and a is_virtual flag. (class_decl::base_spec::{get_is_virtual, get_offset_in_bits}): New methods. (class_decl::has_no_base_nor_member): New method declaration.. * src/abg-ir.cc (class_decl::base_spec::base_spec): Take an offset and a is_virtual flag (class_decl::has_no_base_nor_member): Define it. * src/abg-reader.cc (read_offset_in_bits): Renamed read_var_offset_in_bits into this. (read_is_virtual): New static function. (build_class_decl): Read the 'layout-offset-in-bits' and the 'is-virtual' of the base class specifier. Adjust for the read_var_offset_in_bits -> read_offset_in_bits rename. * src/abg-writer.cc (write_layout_offset): New overload for the base class specifiers. (write_class_decl): If the class has no member or base class, make it a proper empty xml element. Write the offset and the is-virtual attribute. * tests/data/test-read-write/test20.xml: New test input data. * tests/test-read-write.cc: De-serialize the test above, serialize it back and compare that both versions are the same. 2013-06-22 Dodji Seketeli Iron out support for simple base classes. * src/abg-ir.h (class_decl::base_spec::base_spec): Move this out-of-line. Add a new constructor for clients compiled without RTTI. * src/abg-ir.cc (class_decl::base_spec::base_spec): This is now here out-of-line. Define the new constructor for clients compiled without RTTI. * tests/data/test-read-write/test19.xml: New test case input for base classes. * tests/test-read-write.cc: De-serialize and serialize the new test case input above. 2013-06-21 Dodji Seketeli Fix handling of forward decl of classes * abg-ir.h (class_decl::set_earlier_declaration): Move this out-of-line and add an overload. * src/abg-ir.cc (class_decl::set_earlier_declaration): Moved this out-of-line here and add an overload. * src/abg-reader.cc (build_class_decl): Really read the 'decl-of-decl-id' property. Do not make the definition use the id of the declaration. Both have their id. * src/abg-writer.cc (write_class_decl): Put a space before the property "def-of-decl-id". * tests/data/test-read-write/test18.xml: New test input. * tests/test-read-write.cc: De-serialize this new input, serialize it back and make sure both versions are identical. 2013-06-21 Dodji Seketeli Serialize the layout offset of class data members. * src/abg-writer.cc (write_layout_offset): New function. (write_class_decl): Serialize the layout offset. 2013-06-21 Dodji Seketeli Support Bitwise OR for qualified_type_def::CV better * src/abg-ir.h (qualified_type_def::CV_RESTRICT): New enumerator for the qualified_type_def::CV enum. (operator|(qualified_type_def::CV, qualified_type_def::CV)): New declaration. * src/abg-ir.cc (operator|(qualified_type_def::CV, qualified_type_def::CV)): New definition. * src/abg-reader.cc (build_qualified_type_decl): No need for casting the result of bitwise or between instances of qualified_type_def::CV. 2013-06-14 Dodji Seketeli Support method type/decl, variadic functions, class declarations-only * src/abg-ir.h (function_decl::parameter::parameter): New constructor with variadic parameter marker. (function_decl::m_type): Make this protected to let method_decl inheriting class to access it. (function_decl::get_type): Move this out-of-line. (class method_type, method_type_hash): New types. (enum class_decl::access_specifier): Add no_access new enumerator. (class_decl::data_member::data_member): Move this out-of-line. (class_decl::data_member::~data_member): Declare virtual destructor. (class method_decl): New class. (class member_function): Make this inherit method_decl, instead of function_decl. (class_decl::class_decl): New constructors. (class_decl::{hashing_started, is_declaration_only, set_earlier_declaration, get_earlier_declaration}): New methods. * src/abg-ir.cc (add_decl_to_scope): If a decl is already in a scope, don't add it to this scope. (get_global_scope): Make this work when passed an instance of global_scope. (dynamic_type_hash::operator()): Add support for method_type. (method_type::{method_type, set_class_type, ~method_type, }) (method_type_hash::operator()): New defintions. (function_decl::get_type, class_decl::class_decl): Move these out-of-line here. (class_decl::method_decl::{method_decl, ~method_decl, get_type}): New definitions. (class_decl::member_function::member_function): Move this out-of-line here. Support method_decl. (class_decl::data_member::data_member): Likewise. (class_decl_hash::operator()): Guard this against endless loop. * src/abg-reader.cc (write_class_is_declaration_only): New static function. (write_var_decl): Take a flag to write the mangled name or not. (write_function_decl): Take a flag to skip the first parameter. (write_cdtor_const_static): Use 'yes' instead of 'true' as value of the properties. (write_decl, write_function_template_decl): Adjust wrt the new signatures of write_var_decl and write_function_decl. (write_enum_type_decl): Simplify call to write_location. (write_class_decl): Support serializing declaration-only classes. * src/abg-writer.cc: * tests/data/test-read-write/test17.xml: New test input. * tests/test-read-write.cc: De-serialize the above, and serialize it back. * tests/data/test-read-write/test10.xml: Update this test. 2013-06-01 Dodji Seketeli Support function_type and adapt a function_decl to use it * src/abg-ir.h (class function_type): Forward decl prior to class function_decl. (function_decl::parameter): Pass string by const reference. Add a variadic marker member and initialize it. (function_decl::parameter::get_type): Add a non-const overload. (function_decl::parameter::get_variadic_marker): New getter. (function_decl::function_decl) Take a const reference to a vector for parameters, type size/alignment. Add two overloads that takes a pointer to function_type. (function_decl::get_parameters): Move this out-of-line. (function_decl::append_parameter(s)): Renamed function_decl::add_parameter(s) into these. Move it out-of-line. Add an overload. (function_decl::{get_type, set_type}): New declaration. (function_decl::get_return_type): Move this out-of-line. (function_decl::is_variadic): New in-line function. (function_decl::m_type): New data member. (function_decl::{m_parms, m_return_type}): Remove. This are now carried by function_decl::m_type. (class function_type, struct function_type_hash): New declarations. (member_function::member_function): Take a vector of pointers to parameters. Take size/align of the type of the member function. Adjust initialization. * src/abg-ir.cc (dynamic_type_hash): Hash instance of function_type accessed through a pointer. (function_type::{operator==, ~function_type}) (function_type_hash::operaror(), function_decl::{get_return_type, }, function_decl::parameter::hash::operator()): New definitions. (function_decl::function_decl): The out-of-line definitions of the declarations above. (function_decl::append_parameter): Moved this out-of-line from inline function_decl::add_parameter. Make this rely on the underlying m_type. (function_decl::operator==): Adjust for use of vector for the parameters. Also, there is no need anymore to compare the parameters or the return types as they are compared by the comparison of the function types. * src/abg-reader.cc (build_function_decl): Read the new size/alignment attributes on the function-decl element. Build a function_type and use it to build the function_decl. Parameters and return type are now hung off of the function_type. (handle_function_decl): use build_function_decl. * src/abg-writer.cc (write_function_decl): Write the new size/alignment properties of the function-decl element. Adjust for the use of vectors for function parameters now. * tests/data/test-read-write/test10.xml: Adjust for the presence of size/alignment properties in the function-decl element now. * tests/data/test-read-write/test11.xml: Likewise. * tests/data/test-read-write/test12.xml: Likewise. * tests/data/test-read-write/test13.xml: Likewise. * tests/data/test-read-write/test14.xml: Likewise. * tests/data/test-read-write/test9.xml: Likewise. 2013-06-01 Dodji Seketeli Support null type hashing * src/abg-ir.cc (dynamic_type_hash::operator()(const type_base* t) const): Support hashing null type. 2013-05-23 Dodji Seketeli Add a couple of output file suffix configuration properties * src/abg-config.h (config::{get_tu_instr_suffix, set_tu_instr_suffix, get_tu_instr_archive_suffix, set_tu_instr_archive_suffix}): New decls. * src/abg-config.cc (config::{get_tu_instr_suffix, set_tu_instr_suffix, get_tu_instr_archive_suffix, set_tu_instr_archive_suffix}): New defs. 2013-05-23 Dodji Seketeli Add a new add_decl_to_scope overload * src/abg-ir.h (add_decl_to_scope): New declaration. * src/abg-ir.cc (add_decl_to_scope): New definition. 2013-05-23 Dodji Seketeli Ensure add_decl_to_scope properly updates the scope * src/abg-ir.h (scope_decl::m_member_scopes) (scope_decl::get_member_scopes): New declarations. (scope_decl::add_member_decl): Move this to ... * src/abg-ir.cc (scope_decl::add_member_decl): ... here. Make it update the new scope_decl::m_member_scopes too. 2013-05-23 Dodji Seketeli Add translation_unit::get_path * src/abg-ir.cc (translation_unit::get_path): New declaration. * src/abg-ir.cc (translation_unit::get_path): New definition. 2013-05-23 Dodji Seketeli Link the global scope to its translation unit * src/abg-ir.h (global_scope::global_scope): Take a translation unit and initialize the tu member with it. * src/abg-ir.cc (translation_unit::get_global_scope): Initialize the global scope with its actual translation unit. 2013-05-23 Dodji Seketeli Have location numbers that are stable throughout translation unit editing * src/abg-irc.cc (location_manager::create_new_location): Just append the new expanded location to the end of the location vectors, and return the new size of the vector as the location number. That way we don't change the location number of an expanded location that is already in the vector -- that change happens if we keep the vector sorted during the insertion. (location_manager::expand_location): The index of the expanded location is the location number - 1. 2013-05-23 Dodji Seketeli Fix in-source detection of the library for GCC * abigail.m4 (ABIGAIL_INIT): Don't forget to set abigaillibs when we detect the library in the source tree, particularly for GCC. 2013-05-21 Dodji Seketeli Re-generate aclocal.m4 * aclocal.m4: Re-generate with autoconf 2.64. 2013-05-21 Benjamin Kosnik Generate abg-version at configure time in builddir * configure.ac: Add src/abg-version.h to AC_CONFIG_FILES. * src/Makefile.am: Remote ad-hoc generation of abg-version.h from here. * src/abg-version.h.in: New file. * configure: Re-generate. * src/Makefile.in: Likewise. 2013-05-21 Dodji Seketeli add abigail.m4 to the distribution * Makefile.am: Add abigail.m4 to the distribution. * Makefile.in: Re-generate. 2013-05-10 Dodji Seketeli Pedantic fixes * src/abg-ir.h (enum decl_base::binding): Remove trailing space. (enum class_decl::access_specifier): Likewise. 2013-05-07 Dodji Seketeli Fix for building libabigail inside the GCC tree * abigail.m4: Detect when we are in the GCC tree; disable version check in that case. 2013-05-07 Dodji Seketeli Re-generate configury with autoconf 2.64 * abigail.m4: Add licence header. * configure.ac: Re-generate configure script with autoconf 2.64 like for GCC. 2013-05-07 Dodji Seketeli Allow autoconf-based clients to detect the library * configure.ac: Define the components of the version number as autoconf variables. Set the version number to 0.1.0 * abigail.m4: New file * Makefile.am: Add abigail.m4 to the build system. Install it in $(datadir)/aclocal. * src/Makefile.am: Generate and add abg-version.h from the version number autoconf variable defined in configure.ac. Re-generate abg-version.h each time configure.ac changes. * src/abg-config.h (abigail_get_library_version): Declare ... * src/abg-config.cc (abigail_get_library_version): ... and define this wirth C linkage. This is useful for autoconf tests to test for the presence of the library. * configure: Re-generate. * Makefile.in: Likewise. * src/Makefile.in: Likewise. * tests/Makefile.in: Likewise. 2013-05-03 Dodji Seketeli Build system fix for make distcheck * Makefile.am: Support the doc sub-directory. We don't have a COPYRIGHT file. * src/Makefile.am: Don't prefix the file paths by the absolute path of the src dir; current autotools know how to deal with it, otherwise and it break them. * tests/Makefile.am: Likewise. Make sure to remove the output of the tests upon make clean. * Makefile.in: Re-generate. * aclocal.m4: Likewise. * configure: Likewise. * src/Makefile.in: Likewise. * tests/Makefile.in: Likewise. 2013-05-02 Dodji Seketeli Initial support for member class templates * src/abg-ir.cc (class_decl::add_member_function_template): Fix comment. (class_decl::add_member_class_template) (class_decl::member_class_template::operator==) (class_decl::member_class_template_hash::operator()): New definitions. (class_decl::operator==): Compare member templates. Fix logic. (class_decl::data_member_hash::operator()) (class_decl::member_function_hash::operator()) (class_decl::member_function_template_hash::operator()): Don't hash the is_static boolean as it's hashed as part of the 'member' sub-object hashing. (class_decl::member_function_template::operator==): Move this out of line here, from the header file. (class_decl_hash::operator()): Hash member class templates. * src/abg-ir.h (class_decl::member::{m_is_static,is_static}): Add the is_static boolean here, so that it's factorized out of the inherited classes of this class. (class_decl::data_member::{is_static, m_is_static}) (class_decl::member_function::{is_static, m_is_static}) (class_decl::member_function_template::{is_static, m_is_static}): Remove this as it's now part of the base 'member' class. (class_decl::data_member::operator==) (class_decl::member_function::operator==): Don't compare the is_static boolean as it's now compared as part of the 'member' sub-object comparison. (class_decl::member_function_template::operator==): Move this out-of-line into src/abg-ir.cc. (class class_decl::member_class_template, struct class_decl::member_class_template_hash) (class_decl::{add_member_class_template, get_member_class_templates}): New declarations. (class_decl::member_class_templates_type): New typedef. * src/abg-reader.cc (build_class_decl): Support de-serializing member class templates. * src/abg-writer.cc (write_class_decl): Likewise, support serializing member class templates. * tests/data/test-read-write/test16.xml: New test input. * tests/test-read-write.cc (int_out_specs[]): Add the new test input to the list of inputs that are de-serialized and serialized back. * tests/Makefile.am: Add the new test input to the distribution. 2013-05-02 Dodji Seketeli Initial support of class templates * src/abg-ir.cc (class_template_decl::class_template_decl) (class_template_decl::set_pattern) (class_template_decl::operator==) (class_template_decl::~class_template_decl) (class_template_decl_hash::operator()) (class_tmpl_shared_ptr_hash::operator()): New definitions. * src/abg-ir.h (class class_template_decl, struct class_tmpl_shared_ptr_hash, struct class_tmpl_shared_ptr_hash): New declarations. * src/abg-reader.cc (read_context::const_class_tmpl_map_it): New typedef. (read_context::get_fn_tmpl_decl): Fix comment. (read_context::{get_class_tmpl_decl,key_class_tmpl_decl}) (build_class_template_decl, handle_class_template_decl): New definitions. (read_context::m_class_tmpl_map): New member. (handle_element): Support "class-template-decl" xml elements nodes. (build_class_decl): Add missing bits to comment. (build_function_template_decl): Fix spacing. * src/abg-writer.cc (class_tmpl_shared_ptr_map): New typedef. (write_context::m_class_tmpl_map): New member. (write_context::get_id_for_class_tmpl, write_class_template_decl): New definitions. (write_template_parameters): Factorize this this out from ... (write_function_template_decl): ... here. (write_decl): Support writing instances of class_template_decl. Fix spacing. * tests/data/test-read-write/test15.xml: New test input. * tests/Makefile.am: Add the new test15.xml input to the distribution. * tests/test-read-write.cc (in_out_specs): Add the new test15.xml test to the list of serialized output to be de-serialized and serialized back. 2013-05-02 Dodji Seketeli Fix function_tempalte_decl init & hashing * src/abg-ir.cc (function_template_decl::operator==): Compare the patterns, not a pointer to them. (function_template_decl_hash::operator()): Don't try to hash null patterns. * src/abg-ir.h (function_template_decl::function_template_decl): Use function_template_decl::set_pattern to set the pattern here. 2013-04-30 Dodji Seketeli Support member function templates * src:abg-ir.h: Move template declarations before class class_decl, so that class_decl can have member templates. (class class_decl::member_function_template) (class_decl::add_member_function_template) (class_decl::{base_specs_type, member_types_type, data_members_types, member_functions_type, member_function_templates_type}): New declarations. * src/abg-ir.cc (class_decl::add_member_function_template) (class_decl::member_function_template_hash::operator()): New definitions. (class_decl_hash::operator()): Support hashing for member function templates. * src/abg-reader.cc (build_class_decl): Use the new class_decl::{member_types_type, data_members_type, member_functions_type, base_specs_type} types. Support member function templates. * src/abg-writer.cc (write_cdtor_const_static): New definition. (write_class_decl): Support member function templates. * tests/data/test-read-write/test14.xml: New input data. * tests/Makefile.am: Add it to the distribution. * tests/test-read-write.cc (InOutSpec int_out_specs): De-serialize the new test input file, serialize it back and diff both results. 2013-04-25 Dodji Seketeli Inheritance fix * src/abg-ir.h (class template_non_type_parameter): Make this inherit decl_base virtually. 2013-04-25 Dodji Seketeli Small comment fix * src/abg-ir.h (class template_decl): Fix comment. 2013-04-25 Dodji Seketeli Add some decl predicates * src/abg-ir.h (is_at_global_scope): Rename is_decl_at_global_scope into this. (is_at_class_scope, is_at_template_scope) (is_template_parameter, is_type) (is_template_parm_composition_type) (is_function_template_pattern, is_template_decl): New declarations. * src/abg-ir.cc (is_at_global_scope): Rename is_decl_at_global_scope into this. (is_at_class_scope, is_at_template_scope, is_template_parameter) (is_type, is_template_parm_composition_type) (is_function_template_pattern, is_template_decl): New definitions. * src/abg-reader.cc (update_depth_info_of_read_context): Use the new is_at_class_scope decl. 2013-04-25 Dodji Seketeli Support composing template type parameters * src/abg-ir.h (class tmpl_parm_type_composition): New declaration. * src/abg-ir.cc (tmpl_parm_type_composition::tmpl_parm_type_composition) (tmpl_parm_type_composition::~tmpl_parm_type_composition): New definitions. * src/abg-reader.cc (build_tmpl_parm_type_composition): New function. (build_template_parameter): Support template parameter type composition. * src/abg-writer.cc (write_tmpl_parm_type_composition): New function. (write_template_non_type_parameter): Fix type-id attribute. (write_template_parameter): Support template parameter type composition. * tests/data/test-read-write/test13.xml: New test input. * tests/Makefile.am: Add it to the distribution. * tests/test-read-write.cc (InOutSpec in_out_spec): Add test13.xml to the list of xml file that are de-serialized and serialized back. 2013-04-24 Dodji Seketeli Fix depth management during the parsing * src/abg-ir.cc (decl_base_hash::operator()): Don't hash the context for decls in general. * src/abg-reader.cc (read_context::push_decl_to_current_scope) (read_context::push_and_key_type_decl): Add an overload that takes a node and update_depth_info boolean. (build_var_decl, build_type_decl, build_qualified_type_decl) (build_pointer_type_def, build_reference_type_def) (build_enum_type_decl, build_type_decl) (build_template_type_parameter, build_template_non_type_parameter) (build_template_template_parameter, build_template_parameter) (build_type): Make these functions take an update_depth_info parameter. Pass it do read_context::push_and_key_type_decl or read_context::push_decl_to_current_scope rather than call update_read_context. (build_function_decl, build_class_decl) (build_function_template_decl): Change the seen_by_reader parameter into update_depth_info. Pass the update_depth_info bool to read_context::push_decl_to_current_scope rather than call update_depth_info here. (handle_class, handle_function_template_decl): Adjust. * tests/data/test-read-write/test12.xml: Add new test input. * tests/test-read-write.cc (InOutSpec in_out_specs): Add it to the list of input to de-serialize, serialize back and compare the two. * tests/Makefile.am: Add the new test input to the distribution. 2013-04-23 Dodji Seketeli Initial support for function templates * src/abg-ir.h (function_decl::set_return_type): New inline definition. (class template_decl, struct template_decl_hash, class template_parameter, struct template_parameter_hash, struct dynamic_template_parameter_hash, struct template_parameter_shared_ptr_hash, class template_type_parameter) (struct template_type_parameter_hash, class template_non_type_parameter, struct template_non_type_parameter_hash, class template_template_parameter, struct template_template_parameter_hash, class function_template_decl) (struct function_template_decl_hash, struct fn_tmpl_shared_ptr_hash): New declarations. * src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing for template template, and template type parameters. (template_decl_hash::operator, template_decl::~template_decl) (template_decl::operator==, template_parameter::operator==) (template_parameter_hash::operator()) (dynamic_template_parameter_hash::operator()) (template_type_parameter::operator==) (template_type_parameter::~template_type_parameter) (template_type_parameter_hash::operator()) (template_non_type_parameter::operator==) (template_non_type_parameter::~template_non_type_parameter) (template_non_type_parameter_hash::operator()) (template_template_parameter::operator==) (template_template_parameter::~template_template_parameter) (template_template_parameter_hash::operator()) (function_template_decl::operator==) (function_template_decl_hash::operator()) (fn_tmpl_shared_ptr_hash::operator()) (function_template_decl::~function_template_decl()): New definitions. * src/abg-reader.cc (read_context::get_fn_tmpl_decl) (read_context::key_fn_tmpl_decl): New functions. (read_context::m_fn_tmpl_map): New data member. (read_context::key_type_decl): Renamed read_context::add_type_decl into this. (read_context::push_decl_to_current_scope): Renamed read_context::finish_decl_creation into this. Add an assert. (read_context::push_and_key_type_decl): Renamed read_context::finish_type_decl_creation into this. Adjust to the use of push_decl_to_current_scope and key_type_decl. (build_function_template_decl, build_template_type_parameter) (build_template_non_type_parameter) (build_template_template_parameter, build_template_parameter) (handle_function_template_decl): New functions. (handle_element): Call handle_function_template_decl. (build_function_decl): Take a bool parameter to update depth information in parsing context. Move instantiation of function_decl before parsing its xml sub-nodes. Update the depth info in the parsing context if necessary. Push the newly intantiated decl to scope. And then parse the sub nodes. Do not forget to add the fn parameters and return type using function_decl::add_parameter and function_decl::set_return_type. (build_var_decl, build_type_decl, build_qualified_type_decl) (build_pointer_type_def, build_reference_type_def) (build_enum_type_decl, build_typedef_decl, handled_type_decl) (handle_qualified_type_decl, handle_pointer_type_def) (handle_reference_type_def, handle_enum_type_decl) (handle_typedef_decl, handle_var_decl, handle_function_decl) (handle_class_decl): Adjust. (build_class_decl): Take a bool parameter to update depth information in parsing context. Add comment. Wait for the class members to be built, before keying (and thus hashing it) the class. (build_type): Fix logic, and adjust. * src/abg-writer.cc (write_context::type_has_existing_id) (write_context::get_id_for_fn_tmpl, write_template_type_parameter) (write_template_non_type_parameter) (write_template_template_parameter, write_template_parameter) (write_function_template_decl): New functions. (write_context::get_id_for_type): Simplify logic. (write_decl): Support writing function template. * tests/data/test-read-write/test11.xml: New test input. * tests/test-read-write.cc (InoutSpec in_out_specs[]): De-serialize the new test11.xml test, serialize it back and diff output and input. * tests/Makefile.am: Add test11.xml to the distribution. 2013-04-23 Dodji Seketeli Mangled name of a scope_decl is its name * src/abg-ir.h (scope_decl::scope_decl): The mangled name is the name. 2013-04-23 Dodji Seketeli Update scope when adding class members * src/abg-ir.h (class_decl::add_member_type) (class_decl::add_data_member, class_decl::add_member_function): Move the inline implementation of these functions ... * src:abg-ir.cc (class_decl::add_member_type) (class_decl::add_data_member, class_decl::add_member_function): ... here. Augment their implementation to properly update the scope of the member. 2013-04-23 Dodji Seketeli Rename class_decl::member_type::get_type into as_type * src/abg-ir.h (class_decl::member_type::get_type): Rename this into class_decl::member_type::as_type. * src/abg-writer.cc (write_class_decl): Adjust. 2013-04-23 Dodji Seketeli Avoid having multiple sub-objects of base classes * src/abg-ir.cc (decl_base::decl_base): Remove useless definition. (type_base::type_base): Remove default arguments from parameters. (scope_type_decl::scope_type_decl) (namespace_decl::namespace_decl): Call the constructors for the virtual bases explicitly. * src/abg-ir.h (class scope_decl): Perform virtual inheritance of decl_base. (global_scope::global_scope): Call virtual base decl_base's constructor directly. (class type_decl): Inherit from decl_base and type_base virtually. (class scope_type_decl): Inherit from type_base virtually. (class qualified_type_def, pointer_type_def, reference_type_def) (class enum_type_decl, typedef_decl): Inherit from type_base and decl_base virtually. (class var_decl, function_decl): Inherit from decl_base virtually. (class class_decl::member): Don't inherit from anything and adjust constructor's mem-initializer accordingly. (class class_decl::member_type): Inherit from decl_base virtually and adjust constructor's mem-initializer accordingly. (class_decl::{data_member::data_member,member_function::member_function) (class_decl::class_decl): Call virtual base's constructor explicitly. 2013-04-22 Dodji Seketeli Move inline hashing functions out of line * src/abg-ir.h (decl_base_hash::operator()) (type_base_hash::operator(), type_decl_hash::operator()) (scope_type_decl_hash::operator()) (qualified_type_def_hash::operator()) (pointer_type_def_hash::operator()) (reference_type_def_hash::operator()) (enum_type_decl_hash::operator(), typedef_decl_hash::operator()) (var_decl_hash::operator(), function_decl_hash::operator()) (class_decl::member_type_hash::operator()) (class_decl::base_spec_hash::operator()) (class_decl::data_member_hash::operator()) (class_decl::member_function_hash::operator()): Move these inline definition ... * src/abg-ir.cc: ... here. 2013-04-22 Dodji Seketeli Various style nit fixes * src/abg-ir.cc: Move the emacs mode specifier for the file to the top of the file, otherwise, it's not effective. (struct location_manager::priv): Add end of struct comment. (class_decl_hash::operator()): Add fn comment. * src/abg-ir.h: Move the emacs mode specifier for the file to the top of the file, otherwise, it's not effective. (class scope_decl): Add end of class comment. * src/abg-reader.cc: Move the emacs mode specifier for the file to the top of the file, otherwise, it's not effective. (read_context::{get_type_decl,add_type_decl): Add comment. (handle_namespace_decl): Fix indent. * src/abg-writer.cc: Move the emacs mode specifier for the file to the top of the file, otherwise, it's not effective. 2013-04-12 Dodji Seketeli Remove .gitignore from VCS * .gitignore: Remove from revision control as different programmers might want to ignore different things. 2013-04-08 Benjamin Kosnik Add license * src/abg-*: Add license. * tests/test-*: Same. 2013-04-11 Dodji Seketeli Initial Support for class declarations * src/abg-ir.h (scope_decl::scope_decl) (scope_type_decl::scope_type_decl): Don't set mangled name for scope_decl instances as it doesn't make sense. (var_decl::var_decl): Pass the type shared pointer by value. (struct var_decl_hash, function_decl::parameter::operator==) (struct function_decl::parameter_hash, function_decl::operator==) (struct function_decl_hash, class class_decl, struct class_decl_hash): New declarations. * src/abg-ir.cc (scope_type_decl::scope_type_decl): Don't set the mangled name. It doesn't make sense for scope_decls. (dynamic_type_hash::operator): Fix comment. Run the hashing for scope_type_decl instances *after* running it for class_decl instance, otherwise, the class_decl instances case will never get hit. (var_decl::var_decl): Pass the type shared pointer by value. (function_decl::operator==, class_decl::operator==) (class_decl_hash::operator()): New fns. * src/abg-libxml-utils.h (get_xml_node_depth): Declare new fn. (XML_READER_GET_ATTRIBUTE): Fix comment. (XML_NODE_GET_ATTRIBUTE): New getter macro. * src/abg-libxml-utils.cc (get_xml_node_depth): New definition. * src/abg-reader.cc (update_read_context) (update_depth_info_of_read_context, read_visibility, read_binding) (read_access, read_size_and_alignment, read_static) (read_var_offset_in_bits, read_cdtor_const, build_function_decl) ( build_var_decl, build_type_decl, build_qualified_type_decl) (build_pointer_type_def, build_reference_type_def) (build_enum_type_decl, build_typedef_decl, build_class_decl) (build_type, handle_class_decl): New functions or overloads. (handle_element): Update to handle "class-decl" xml elements. * src/abg-writer.cc (write_size_and_alignment, write_access) (write_class, do_indent_to_level, get_indent_to_level): New fns. (write_decl): Update to serialize instances of class_decl. (write_type_decl, write_pointer_type_def) (write_reference_type_def): Use the new write_size_and_alignment instead of writing the attributes directly. * tests/data/test-read-write/test10.xml: New test file. * tests/Makefile.am: Add tests/data/test-read-write/test10.xml to the build system. * tests/test-read-write.cc (in_out_spec): De-serialize data/test-read-write/test10.xml, serialize it back into output/test-read-write/test10.xml, and compare the two output that should be identical. 2013-04-11 Dodji Seketeli Update enum decl representation as per the schema * src/abg-reader.cc (handle_enum_type_decl): The name of the element holding the underlying type is now "underlying-type", no more "base". * src/abg-writer.cc (write_enum_type_decl): Likewise. * tests/data/test-read-write/test6.xml: Likewise. 2013-04-10 Dodji Seketeli Add tests/data/test-read-write/test9.xml * tests/data/test-read-write/test9.xml: (Forgot to) Add this new test file. 2013-04-04 Dodji Seketeli Support function declarations * src/abg-ir.h (class function_decl): New declaration & inline definitions. * src/abg-ir.cc (function_decl::~function_decl): New definition. * src/abg-reader.cc (read_location): New overload to read location from an xmlNodePtr. (build_function_parameter, handle_function_decl): New definitions. (handle_element): Support "function-decl" elements. * src/abg-writer.cc (write_location): New overload to write a location directly, not from a decl. (write_function_decl): New definition. (write_binding): Support writing the binding attribute from a function_decl instance. (write_decl): support serializing function * tests/data/test-read-write/test9.xml: New test input file. * tests/Makefile.am: Add data/test-read-write/test9.xml to the build system. * tests/test-read-write.cc: De-serialize data/test-read-write/test9.xml, serialize it back and diff the output from the input. 2013-04-03 Dodji Seketeli Update in-vcs configure and docs/Makefile.in to recent configure * configure: Updated as re-generated by autoconf 2.69. * doc/Makefile.in: Updated as re-generated by automake 1.12.2. 2013-04-02 Benjamin Kosnik Add doc dir. Add Doxgen api generation rules. * doc: Add. * doc/Makefile.am (html, install-html): Add. * doc/Makefile.in: Add. * doc/api/libabigail.doxy: Add doxygen config. * src/abg-*: Add @file markup. 2013-04-03 Dodji Seketeli Introduce/use translation_unit & global_scope types * abg-corpus.h (abi_corpus::{get_decls, get_loc_mgr}): Remove. (abi_corpus::add): New function to add a translation unit. (abi_corpus::get_translation_units): New declaration. * abg-corpus.cc (abi_corpus::*): Remove all the definitions of abi_corpus for now, as the abi_corpus type is not used anymore -- for now at least. * src/abg-ir.h (add_decl_to_scope, get_global_scope) (get_translation_unit, is_global_scope, is_decl_at_global_scope) (class translation_unit, class global_scope): New declarations * src/abg-ir.cc (translation_unit::translation_unit) (translation_unit::get_global_scope) (translation_unit::get_loc_mgr, translation_unit::get_loc_mgr) (translation_unit::is_empty, get_global_scope) (get_translation_unit, is_global_scope, is_global_scope) (is_decl_at_global_scope, global_scope::~global_scope): New definitions. (scope_decl::scope_decl, scope_decl::scope_decl) (scope_decl::add_member_decl, scope_decl::get_member_decls): Move to abg-ir.h, inline. * src/abg-reader.h (read_file): Don't use abi_corpus in the api. Rather, use translation_unit. * src/abg-reader.cc (read_context::get_cur_scope): Now that we have a specific instance of global_scope to represent global scope, don't play games with empty scopes to detect a global scope. (read_context::get_translation_unit): New definition. (read_context::finish_decl_creation, finish_type_decl_creation): (read_input, read_file, read_location, handle_element) (handle_type_decl) (handle_namespace_decl, handle_qualified_type_decl) (handle_pointer_type_def, handle_reference_type_def) (handle_enum_type_decl, handle_typedef_decl, handle_var_decl): Don't use abi_corpus anymore. Rather, the translation unit a decl belongs to is accessible from the decl itself. * src/abg-writer.h (write_to_ostream): Use translation_unit in this API, rather than abi_corpus. * src/abg-writer.cc (write_translation_unit): Rename write_corpus into this. And stop using abi_corpus here. (write_to_ostream, write_corpus, write_location, write_decl) (write_type_decl, write_namespace_decl, write_qualified_type_def) (write_pointer_type_def, write_reference_type_def) (write_enum_type_decl, write_typedef_decl, write_var_decl): Stop using abi_corpus. Use the translation_unit that is accessible from the decl being serialized, if need be. * test-read-write.cc (main): De-serialize the input into an instance of translation_unit, not an abi_corpus anymore, and serialize that translation_unit. 2013-04-02 Dodji Seketeli Support var decl & mangled_name attributes * src/abg-ir.h (decl_base::binding, decl_base::get_mangled_name) (decl_base::set_mangled_name, decl_base::m_mangled_name): New declarations. (scope_decl::scope_decl: type_decl::type_decl) (scope_type_decl::scope_type_decl, typedef_decl::typedef_decl): Initialize mangled_name. (namespace_decl::namespace_decl): Initialize visibility. (class var_decl): New declaration. * src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl) (type_decl::type_decl, scope_type_decl::scope_type_decl): Initialize mangled name. (namespace_decl::namespace_decl): Initialize visibility. (qualified_type_def::qualified_type_def) (pointer_type_def::pointer_type_def) (reference_type_def::reference_type_def): By default, set the visibility to the same as for the underlying type. (enum_type_decl::enum_type_decl, typedef_decl::typedef_decl): Initialize mangled name. (var_decl::var_decl, var_decl::operator==, var_decl::~var_decl): New definitions. * src/abg-reader.cc (read_visibility, read_binding, handle_var_decl): New definitions. (read_file): Handle var-decl elements. * src/abg-writer.cc (write_location): Rename write_decl_location into this. (write_var_decl, write_visibility, write_binding): New definitions. (write_decl, write_type_decl, write_qualified_type_def) (write_pointer_type_def, write_reference_type_def) (write_enum_type_decl, write_typedef_decl): Adjust to use write_location. * tests/data/test-read-write/test8.xml: New test input. * tests/test-read-write.cc: De-serialize the above and serialize it back and ensure both are equal. * tests/Makefile.am: add tests/data/test-read-write/test8.xml to the distribution. 2013-04-02 Dodji Seketeli Don't forget to init context & visibility in decl_base * src/abg-ir.cc (decl_base::decl_base): Initialize context and visibility on all the overloads of the constructor. 2013-03-31 Dodji Seketeli Fix some style * src/abg-ir.h (decl_base::get_scope): Really re-style. 2013-03-31 Dodji Seketeli Fix some style * src/abg-ir.h (decl_base::{get_location, set_location, get_name, set_name}): Re-style. 2013-03-31 Dodji Seketeli Basic support for type/decl visibility * src/abg-ir.h (enum decl_base::visibility) (decl_base::get_visibility, decl_base::set_visibility) (decl_base::m_visibility): New. (decl_base::decl_base, scope_decl::scope_decl) (type_decl::type_decl, enum_type_decl::enum_type_decl) (typedef_decl::typedef_decl): Pass visibility. * src/abg-ir.cc (decl_base::decl_base, scope_decl::scope_decl) (type_decl::type_decl, enum_type_decl::enum_type_decl) (typedef_decl::typedef_decl): Pass visibility. (qualified_type_def::qualified_type_def) (pointer_type_def::pointer_type_def) (reference_type_def::reference_type_def): Initialize visibility. 2013-03-31 Dodji Seketeli A type/decl shouldn't hold a reference on its scope * src/abg-ir.h (decl_base::m_context): Make this a naked pointer. (decl_base::set_scope, add_decl_to_scope): Pass the scope as a naked pointer. * src/abg-ir.cc (decl_base::decl_base): Initialize the context to 0. (decl_base::set_scope, add_decl_to_scope): Pass the scope as a naked pointer. * src/abg-reader.cc (read_context::get_cur_scope): Return a naked pointer. (handle_namespace_decl): Adjust accordingly. 2013-03-30 Dodji Seketeli Support typedef declarations * src/abg-ir.cc (dynamic_type_hash::operator()): Handle hashing of a pointer to an instance of typedef_decl. (typedef_decl::typedef_decl, typedef_decl::operator==) (typedef_decl::operator==, typedef_decl::get_underlying_type) (typedef_decl::~typedef_decl): New definitions. * src/abg-ir.h (class typedef_decl, struct typedef_decl_hash): New declarations. * src/abg-reader.cc (handle_typedef_decl): New definition. (handle_element): Handle de-serialization of typedef-decl element. * src/abg-writer.cc (write_typedef_decl): New definition. (write_decl): Handle serialization of an instance of typedef_decl. * tests/data/test-read-write/test7.xml: New test. * tests/Makefile.am: Add it to the distribution. * tests/test-read-write.cc: De-serialize the content of the new test, serialize it back and diff both. 2013-03-30 Dodji Seketeli Remove useless static_cast from hashing code * src/abg-ir.h (scope_type_decl_hash::operator()) (qualified_type_def_hash::operator()) (pointer_type_def_hash::operator()) (reference_type_def_hash::operator()): Remove useless static_cast. 2013-03-30 Dodji Seketeli Simplify equality operators * src/abg-ir.cc (qualified_type_def::operator==) (pointer_type_def::operator==, reference_type_def::operator==) (enum_type_decl::operator==): Simplify the code by safely assuming the underlying type is non-null. 2013-03-30 Dodji Seketeli Support enum type declarations * src/abg-ir.h (class enum_type_decl, struct enum_type_decl_hash): New declarations. * src/abg-ir.cc (dynamic_type_hash::operator()): Add hashing support for enum_type_decl. (enum_type_decl::enum_type_decl) (enum_type_decl::get_underlying_type) (enum_type_decl::get_enumerators, enum_type_decl::~enum_type_decl) (enum_type_decl::operator==): New definitions. * src/abg-reader.cc (handle_enum_type_decl): New definition. (handle_element): Handle "enum-decl" element. * src/abg-writer.cc (write_enum_type_decl): New. (write_decl): Add support to serialize enum_type_decl. * tests/test-read-write.cc: De-serialize and serialize data/test-read-write/test6.xml back. * tests/data/test-read-write/test6.xml: New test input. * tests/Makefile.am: Add it to the distribution. 2013-03-30 Dodji Seketeli Fix reference-type-def serialization * tests/test-read-write.cc: Really de-serialize and then serialize back data/test-read-write/test5.xml, not test4.xml. Sigh. * src/abg-writer.cc (write_reference_type_def): As a result of really trying to serialize reference type definitions fix the serialization code here. 2013-03-29 Dodji Seketeli Support reference types * src/abg-ir.h (class reference_type_def, struct pointer_type_def) (struct reference_type_def): New declaration. (type_base_hash::operator(), type_decl_hash::operator()) (scope_type_decl_hash::operator()) (qualified_type_def_hash::operator()): Include the typeid name in the hash. * src/abg-ir.cc (reference_type_def::reference_type_def) (reference_type_def::operator==) (reference_type_def::get_pointed_to_type) (reference_type_def::is_lvalue) (reference_type_def::~reference_type_def): New definitions. (dynamic_type_hash::operator): Hash pointer_type_def and reference_type_def instances. * src/abg-reader.cc (read_context::finish_decl_creation) (read_context::finish_type_decl_creation) (handle_reference_type_def): New definitions. (read_file): Handle "reference-type-def" elements. (handle_type_decl, handle_namespace_decl) (handle_qualified_type_decl, handle_pointer_type_def): Use the new read_context::finish_type_decl_creation or read_context::finish_decl_creation. * src/abg-writer.cc (write_reference_type_def): New definition. (write_decl): Supporting writing a pointer to an instance of reference_type_def. * tests/data/test-read-write/test5.xml: New test file. * tests/test-read-write.cc: (De)Serialize it. * tests/Makefile.am: Add it to the build system. 2013-03-28 Dodji Seketeli Support pointer types & Fix IR types equality * src/abg-ir.h (location::{operator==, operator<}) (decl_base::operator==, scope_decl::operator==) (type_base::operator==, struct type_shared_ptr_equal) (type_decl::operator==, scope_type::operator==) (qualified_type_def::operator==, class pointer_type_def): New declarations.. * src/abg-ir.cc (decl_base::operator==, scope_decl::operator==) (type_base::operator==, type_decl::operator==) (scope_type_decl::operator==, namespace_decl::operator==) (qualified_type_def::operator==) (pointer_type_def::pointer_type_def, pointer_type_def::operator==) (pointer_type_def::get_pointed_to_type) (pointer_type_def::~pointer_type_def): New definitions. * src/abg-reader.cc (handle_pointer_type_def): New definition. (read_input): Handle pointer-type-def elements. * src/abg-writer.cc (type_shared_ptr_map): Make this map use the use type_shared_ptr_equal predicate. (write_pointer_type_def): New definition. (write_decl): Improve logic. Support serializing a pointer to pointer_type_def. * tests/data/test-read-write/test4.xml: New test input file. * tests/Makefile.am: Add tests/data/test-read-write/test4.xml to the build system. * tests/test-read-write.cc: (De)serialize the new test file. 2013-03-27 Dodji Seketeli Support qualified types & Misc ancillary fixes * src/abg-ir.h (struct type_base_hash, struct dynamic_type_hash) (struct type_shared_ptr_hash, struct scope_type_decl_hash, class qualified_type_def, struct qualified_type_def_hash): New. (decl_base_hash::operator()): Constify. Don't crash if the scope of the decl we are hashing is null. (class type_decl): Add comment at the end. (type_decl_hash::operator()): Constify. Reuse the new type_base_hash hasher. (class namespace_decl): Add comment. * src/abg-ir.cc (qualified_type_def::qualified_type_def) (qualified_type_def::~qualified_type_def) (qualified_type_def::get_cv_quals) (qualified_type_def::set_cv_quals) (qualified_type_def::get_underlying_type) (dynamic_type_hash::operator()): New function definitions. * src/abg-reader.cc (handle_qualified_type_decl): New. (read_file): Handle elements named "qualified-type-def". (read::context::add_type_decl): Assert that the type being associated to the unique ID is non-null. (handle_type_decl): Fix this in the process; don't crash if some attributes are not present. Associate the unique id present in the xml document with the type we just parsed. (handle_namespace_decl): Add some comments. Don't crash if the name attribute is not present. * src/abg-writer.cc (write_context::get_id_for_type) (write_context::m_type_id_map, write_decl_location) (write_qualified_type_def): New. (write_decl): Handle instances of qualified_type_def. (write_type_decl): Use the new write_decl_location and write_context::get_id_for_type. * tests/data/test-read-write/test0.xml: Update id format since we are now using the new write_context::get_id_for_type to generate it. * tests/data/test-read-write/test1.xml: Likewise. * tests/data/test-read-write/test2.xml: Likewise. * tests/data/test-read-write/test3.xml: New test. * tests/test-read-write.cc: Test De-serializing tests/data/test-read-write/test3.xml and serializing it back. Also don't bail out if we fail on one input. * tests/Makefile.am: Add tests/data/test-read-write/test3.xml to the distribution. 2013-03-27 Benjamin Kosnik Various autotool adjustments * configure: Add. * configure.ac (AM_INIT_AUTOMAKE): Use gcc versions. (PKG_CHECK_MODULES): Re-use libjava/classpath solution, naming. * m4/pkg.m4: Add, take from classpath. * src/Makefile.am: Adjust names. 2013-03-26 Dodji Seketeli Remove the 'm_kind' member from the IR * src/abg-ir.{h,cc}: Remove use of the m_kind field. We are using full blown rtti so this uselessly just clutter the code. 2013-03-26 Dodji Seketeli Fix parallel build * tests/Makefile.am: Remove useless absolute reference to the current directory. 2013-03-26 Dodji Seketeli Fix depth handling during the parsing * src/abg-reader.cc (read_context::get_cur_scope): Remove useless const overload. Don't make this rely on m_cur_scope. Rather, use the path to the current decl (from the root element) to compute the cur scope. (read_context::m_cur_scope, read_context::set_cur_scope): Remove these. (update_read_context): Re-think logic. * tests/data/test-read-write/test2.xml: Add new test input. * tests/Makefile.am: Add data/test-read-write/test2.xml to the distribution. * tests/test-read-write.cc: Add data/test-read-write/test2.xml to the harness. 2013-03-25 Dodji Seketeli Debug read-write of a type-decl in a namespace-decl * abg-ir.{h,cc} (decl_base::decl_base, scope_decl::scope_decl) (type_decl::type_decl, namespace_decl::namespace_decl): Do not append a decl to its context from within its constructor. It's better doing that in a function that takes shared_ptrs to decl and context. That way we avoid memory management havoc. (decl_base::set_scope): New private function. (scope_decl::add_member_decl): Make this private. (add_decl_to_scope): New function, friend of decl_base and scope_decl. * abg-reader.cc (read_context::get_cur_scope): Add a non-const overload. (handle_type_decl, handle_namespace_decl): Use add_decl_to_scope. Adjust to new type_decl and namespace_decl constructor signature. * src/abg-writer.cc (write_type): Emit 'id', not 'xml:id'. (write_namespace_decl): Emit "namespace-decl", not "namespace-decl-name", as the name of namespace element. * tests/Makefile.am (test0.xml): Rename input0.xml into this. (test1.xml): New test input. * tests/data/test-read-write/test0.xml: Update to use 'id' as id attribute, rather than xml:id. * tests/data/test-read-write/test1.xml: New test. * test-read-write.cc (struct InOutSpec): New (main): Reorganize to give a list of input files to read and to write to an output file, have the test read the input files, write them, and diff the two. 2013-03-22 Dodji Seketeli Update tests/data/test-read-write/input0.xml * tests/data/test-read-write/input0.xml: Make this identical to how it would look like when serialized. 2013-03-22 Dodji Seketeli Debug type-decl serialization * src/abg-writer.cc (do_indent): New function. (write_corpus&): Use do_indent. Don't forget to close the abi-instr tag. (write_type_decl): Use do_indent. Handle null decls pointers. Emit the id at the end of the element. (write_namespace_decl): Use do_indent. Handle null decls pointers. * tests/test-utils.{h,cc} (get_src_dir,get_build_dir): Constify the returned reference to string. (is_dir, ensure_dir_path_created, ensure_parent_dir_created): New function definitions. * tests/test-read-write.cc (main): Augment the test to serialize the corpus too. 2013-03-21 Dodji Seketeli Debugged type-decl de-serialization * src/abg-ir.cc (namespace_decl::~namespace_decl): Add this missing virtual constructor definition. * src/abg-reader.cc (read_context::{get_cur_decl,pop_decl}): Return a null pointer when the decls stack is empty. (update_read_context): Don't try to de-reference a NULL cur_decl. (read_input): Don't try to poke at file validity here. What was I thinking. Really test for advance_cursor to return 1, expressing success. * src/abg-reader.h (read_file): Fix style. * Makefile.am: Add tests sub-directory. * configure.ac: Build with debugging-friendly options if the ABIGAIL_DEBUG env variable is set. Generate tests/Makefile. * tests/Makefile.am: New file. * tests/test-read-write.cc: Likewise. * tests/test-utils.{h,cc}: Likewise. * tests/data/test-read-write/input0.xml: Likewise. 2013-03-21 Dodji Seketeli Initial implementation of serialization of basic types and namespaces. * src/Makefile.am: Add abg-writer.{h,cc} and abg-config.{h,cc}. * src/abg-config.{h,cc}: New files. * src/abg-corpus.h (abi_corpus::decls_type): New typedef. (abi_corpus::{add,get_decls,get_loc_mgr}): Fix style. (abi_corpus::is_empty): Declare new function. * src/abg-corpus.cc (abi_corpus::add): really add the declaration to the corpus. (abi_corpus::is_empty): Define new function. * src/abg-ir.{h,cc} (location_manager::expand_location): Consti-fy this function. * src/abg-reader.cc (read_file): Add a corpus parameter. * src/abg-serialize.cc: Delete this file. * src/abg-writer.h (write_to_ostream): Rename write into this. Make it take a corpus and an ostream as parameters. * abg-writer.cc: New file. 2013-03-08 Dodji Seketeli Parse type-decl and namespace-decl elements * configure.ac: Add libxml2 dependencies. * src/abg-corpus.{h,cc}: New files. * src/abg-hash.{h,cc}: Likewise. * src/abg-libxml-utils.{h,cc}: Likewise. * src/abg-reader.{h,cc}: Likewise. * src/abg-serialize.{h,cc}: Likewise. * src/abg-writer.h: Likewise. * src/Makefile.am: Build the new files above. * src/abg-ir.h (class location): Add public accessors for the value, and a truth operator. Make the methods be inline. (class decl_base): Renamed decl into this. Renamed what_decl_kind into what_kind. Renamed get_context into get_scope. Add virtual destructor, accessors for location and name. (class {scope_decl, type_base, type_decl} ): Add virtual dtor. Re-style. (struct {decl_base_hash, type_decl_hash}): New hashing functors. (class {scope_type_decl, namespace_decl}): Add virtual dtor. * src/abg-ir.cc (location::*): Remove location definitions. There are now inline in the header. (class decl_base): Renamed decl into this. Remove most of the definitions from here as their are now inline in the header. (scope_decl::~scope_decl, type_base::~type_base) (type_decl::~type_decl, scope_type_decl::~scope_type_decl): New definitions. 2013-03-04 Dodji Seketeli Updated hierarchy up to namespace_decl * src/abg-ir.h (location): Make the default ctor public. (class decl): Declare data member and proper constructors. Make the context be a shared_ptr. Add a kind data member to avoid RTTI for now. (class scope_decl): Added protected constructor to handle the kind data member. (class type_base): Add data members proper and clean the iface up. (class type_decl, scope_type_decl, namespace_decl): Iron out constructors. * src/abg-ir.cc (class location): Fix style. (class decl, scope_decl, type_base, type_decl, scope_type_decl) (namespace_decl): Define these types. 2013-03-01 Dodji Seketeli Add missing autoconfiscation files into version control * config.guess: Added to VCS. * config.sub: Likewise. * depcomp: Likewise. * install-sh: Likewise. * ltmain.sh: Likewise. * missing: Likewise 2013-03-01 Dodji Seketeli Upload m4 file * m4/: Import this directory into version control. 2013-03-01 Dodji Seketeli Create and expand locations * src/abg-ir.h (class {location, location_manager, decl, scoped_decl, type_base, type_decl, scope_type_decl): Declare new types. * src/abg-ir.cc (class {location, location_manager}): Define new types. 2013-03-01 Dodji Seketeli Adjust src/Makefile.am after some file rename * src/Makefile.am: Update build system for renaming files from abgl-* into abg-*. 2013-03-01 Dodji Seketeli Update the README file * README: Update. 2013-02-28 Dodji Seketeli Initial AUTHORS and README * AUTHORS: * README: 2013-02-28 Dodji Seketeli Leave license stuff for later * COPYING: 2013-02-28 Dodji Seketeli Initial import Abigail * AUTHORS: * COPYING: * ChangeLog: * INSTALL: * Makefile.am: * NEWS: * README: * config.h.in: * configure.ac: * src/Makefile.am: * src/abg-ir.cc: * src/abg-ir.h: