mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 16:04:34 +00:00
cfaa7d42b6
Many types and decls are redefined in every translation unit that make up an ELF binary. This patch detects that a DIE represents a type or decl that has already been defined in the current corpus and so will not create a new internal representation for it. The patch defines facilities to build the pretty representation of a type or decl. It's by looking at the pretty representation of a DIE that the patch detects that a different DIE has already defined the same type or decl. The patch also fixes detection of the const-ness of member functions as there were many cases where const member functions were not recognized as const. This fix makes it so that the pretty representation of the DIE of said member functions match the pretty representation of their internal representation, as far as the const-ness is concerned. One bit of infrastructure change that is used by the const-ness fix is that method_type now carries const-ness. So a method_decl that has a const method_type is going to be const itself. * include/abg-ir.h (method_type::priv_): Introduce new pimpl pointer here. (method_type::class_type_): Move this into the pimpl idiom. (method_type::method_type): Take a new is_const flag. (method_type::get_class_type): Make this method out-of-line. (method_type::{s,g}et_is_const): Declare new member functions. (get_method_type_name): Declare this function as a friend of the method_type type. * src/abg-dwarf-reader.cc: Include the new abg-ir-priv.h and abg-corpus-priv.h. (typedef die_tu_map_type): Fix comment. (typedef die_istring_map_type): New typedef. (class read_context::die_source_dependant_container_set): New class template. (read_context::{die_qualified_name_maps_, die_pretty_repr_maps_, die_pretty_type_repr_maps_}): Define new data members. (read_context::{get_die_qualified_name, get_die_qualified_name, get_die_qualified_type_name, get_die_pretty_type_representation, get_die_pretty_representation, lookup_type_artifact_from_die, lookup_artifact_from_die, lookup_artifact_from_die_representation, associate_die_to_artifact_by_repr, associate_die_to_artifact_by_repr_internal, lookup_type_from_die}): Define new member functions. (read_context::lookup_type_from_die_offset): Fix comment. (get_parent_die, get_scope_die, die_is_decl) (die_is_namespace, die_is_unspecified, die_is_void_type) (die_is_pointer_type, die_is_reference_type) (die_is_pointer_or_reference_type, die_is_class_type) (die_has_object_pointer, die_this_pointer_from_object_pointer) (die_this_pointer_is_const, is_decl_tag) (die_object_pointer_is_for_const_method, die_is_at_class_scope) (die_name, die_qualified_type_name, die_qualified_decl_name) (die_qualified_name, die_qualified_type_name_empty) (die_return_and_parm_names_from_fn_type_die) (die_function_signature, die_peel_qual_ptr) (die_function_type_is_method_type, die_pretty_print_type) (die_pretty_print_decl, die_pretty_print) (build_subranges_from_array_type_die) (build_or_get_fn_decl_if_not_suppressed) (lookup_class_or_typedef_type) (lookup_class_typedef_or_enum_type_from_corpus) (is_function_for_die_a_member_of_class) (add_or_update_member_function): Define new static functions. (read_context::associate_die_to_decl): Call associate_die_to_artifact_by_repr. (read_context::{associate_die_to_type, schedule_type_for_late_canonicalization}): Take just one "die" parameter rather than taking a die offset and a die source; adjust accordingly. (maybe_canonicalize_type): Likewise. (finish_member_function_reading): Take a const reference to function_decl_sptr. (die_loc_and_name): Use the new die_name function. (die_is_type): Rename is_type_die into this. (build_type_decl): Take a new "where_offset" parameter. Adjust. If a type of the same name as the one for the current DIE is is already present, do not create a new type; just return the already-existing one. (build_enum_type): Take a new "where_offset" parameter. Adjust. (finish_member_function_reading): Pass two smart pointers by const reference. Assert that the type of the member function is a method_type. Some light cleanups. (add_or_update_class_type): Rename build_class_type_and_add_to_ir. If a DIE defining the same class has already been seen, then return that class; don't construct any other internal representation for the same class. Better handle the updating of member data and functions. Do not duplicate member types. (build_qualified_type, build_pointer_type_def) (build_reference_type): Support de-duplication here. (build_function_type): Likewise. Support detection and building of method type. This also supports *const* method type building. (build_array_type): Use the new build_subranges_from_array_type_die. (build_type_decl): Cleanup logic. (build_or_get_var_decl_if_not_suppressed): Renamed build_var_decl_if_not_suppressed into this. Perform de-duplication for data members. (build_function_decl): Don't set an empty source location. If the function type cannot be constructed, do not construct the function decl either. Adjust. (build_ir_node_from_die): Adjust. When building a function for a DW_TAG_subroutine_type DIE, use the new build_or_get_fn_decl_if_not_suppressed. * src/abg-ir.cc (translation_unit::bind_function_type_life_time): Fix comment. (strip_typedef): Adjust. (qualified_type_def::build_name): Set the prefix name of a the name of a noop qualifier to "noop-qual", just like what is done in the new die_qualified_name function. (struct method_type::priv): New priv type for the method_type class. (method_type::method_type): Take a new 'is_const' parameter. Adjust as the method_type is now pimpl'ed. (method_type::{get_class_type, set_is_const, get_is_const}): Define new member functions. (function_decl::get_pretty_representation_of_declarator): Better detecter of const-ness. (class_decl::insert_member_decl): Better setting of the const-ness. (class_decl::method_decl::method_decl): Adjust. Deduce the const-ness of the method_decl from the const-ness of its method_type. (copy_member_function): Adjust. (set_member_is_static): Do not assume a non-nil scope anymore because member_decl can now be scope-less, at least for a little while. * src/abg-reader.cc (push_decl_to_current_scope): Adjust. (build_function_decl): Style adjustment. Adjust for method_type const-ness changes. (build_function_type): Likewise. Also, support the new "method-class-id" property that flags a function type as being a method type. * src/abg-writer.cc (write_function_decl): Style fixes. (write_function_type): Likewise. Emit a new "method-class-id" property for function type that is actually a method type. That property's value is the id of the class of the method type. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Adjust. * 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/test30-pr18904-rvalueref-report0.txt: Adjust. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Adjust. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Adjust. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Adjust. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Adjust. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust. * tests/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
abg-comp-filter.h | ||
abg-comparison.h | ||
abg-config.h | ||
abg-corpus.h | ||
abg-diff-utils.h | ||
abg-dwarf-reader.h | ||
abg-fwd.h | ||
abg-hash.h | ||
abg-ini.h | ||
abg-interned-str.h | ||
abg-ir.h | ||
abg-libxml-utils.h | ||
abg-libzip-utils.h | ||
abg-reader.h | ||
abg-sptr-utils.h | ||
abg-suppression.h | ||
abg-tools-utils.h | ||
abg-traverse.h | ||
abg-version.h.in | ||
abg-viz-common.h | ||
abg-viz-dot.h | ||
abg-viz-svg.h | ||
abg-workers.h | ||
abg-writer.h | ||
Makefile.am |