mirror of
git://sourceware.org/git/libabigail.git
synced 2025-01-22 01:03:02 +00:00
f2437aabad
2 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
59c0a2ac7c |
Initial support for Ada ranges
In order for abipkgdiff to handle the gnat sub-packages GCC, Libabigail needs to understand some Ada-specific constructs. So far, the only unsupported construct that was problematic is the Ada Range type. This patch thus adds support for that Range type and so makes it possible to handle the gnat sub-packages of GCC. In Ada, the range type is emitted as a DW_TAG_subrange_type that is not necessarily emitted as a property of an array type. In C and C++ however, that DW_TAG_subrange_type is always a property of an array type. So the patch adds support for a so-called "free-form" DW_TAG_subrange_type. First, in the IR, the abigail::array_type_def::subrange_types is now a real full blown type which can have a name and an underlying type. That type can now be created by the both the DWARF and abixml readers. It can also be serialized by the abixml writer. Note that changes in the underlying type and on the name of the range are not yet reported by the reporting engine. That would have to be added in a subsequent patch set. * include/abg-ir.h (type_maps::subrange_types): Declare new accessors. (is_ada_language, is_subrange_type): Declare new functions. (class array_type_def::subrange_type): Make this extend type_base and decl_base. (array_type_def::subrange_type::{get_language, operator==, get_pretty_representation, traverse}): Declare new member functions. (ir_node_visitor::visit_begin): Add new overloads for array_type::def::subrange_type. * src/abg-dwarf-reader.cc (build_subrange_type): Define new static function. (build_subranges_from_array_type_die): Cleanup the parameters of this function. (build_array_type): Adjust. (build_ir_node_from_die): Support free-form DW_TAG_subrange_type. (read_context::odr_is_relevant): Handle Ada. (die_qualified_type_name): Support DW_TAG_subrange_type. (die_pretty_print_type): Likewise. Make the handling of DW_TAG_subrange_type use die_qualified_type_name. Adjust the use of build_subranges_from_array_type_die. (get_scope_die): a DW_TAG_array_type cannot be a scope. Rather, it's its scope that can be a scope. * src/abg-ir.cc (type_maps::priv::subrange_types_): New data member. (type_maps::empty): Adjust. (type_maps::subrange_types): Define new accessors. (is_ada_language, is_subrange_type): Define new functions. (odr_is_relevant): Support Ada. (maybe_update_types_lookup_map): Add an overload for array_type_def::subrange_type. In the decl_base_sptr overload, add support for the array_type_def::subrange_type type. (struct array_type_def::subrange_type::priv::location_): Remove this as it's now carried by the parent decl_base type. (array_type_def::subrange_type::subrange_type): Adjust. Take an environement pointer, a name, an underlying type and a language. (array_type_def::subrange_type::{g,s}et_underlying_type): Define new accessors. (array_type_def::subrange_type::{get_language, get_pretty_representation, traverse}): Define new member functions. (array_type_def::subrange_type::as_string): Add a representation for Ada. (equals): Define new overload for array_type_def::subrange_type. (array_type_def::subrange_type::operator==): Define three new overloads for decl_base, type_base and subrange_type. (array_type_def::subrange_type::operator!=): Define new operator. (get_type_representation): In the overload for array_type_def, support Ada. (array_type_def::get_language): Define new member function. (ir_node_visitor::visit_{begin,end}): Define new overloads for array_type_def::subrange_type. * src/abg-reader.cc (build_subrange_type): Adjust documentation. Support the new 'id', 'name', and 'type-id' properties. * src/abg-writer.cc (write_array_subrange_type): Define new static function. (write_array_type_def): Use the new write_array_subrange_type function. * tests/data/test-abidiff/test-PR18166-libtirpc.so.abi: Adjust. * tests/data/test-annotate/libtest23.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. * tests/data/test-read-write/test25.xml: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
055a789abe |
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. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |