libabigail/tests/data/test-read-write/test25.xml

51 lines
2.8 KiB
XML
Raw Normal View History

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>
2014-08-18 09:56:43 +00:00
<abi-instr version='1.0' address-size='64' path='data/text-read-write/test25.xml'>
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
<class-decl name='S' size-in-bits='2240' is-struct='yes' visibility='default' id='type-id-2'>
<data-member access='public' layout-offset-in-bits='0'>
<var-decl name='a' type-id='type-id-3' visibility='default'/>
</data-member>
<data-member access='public' layout-offset-in-bits='192'>
<var-decl name='b' type-id='type-id-4' visibility='default'/>
</data-member>
<data-member access='public' layout-offset-in-bits='640'>
<var-decl name='c' type-id='type-id-5' visibility='default'/>
</data-member>
<data-member access='public' layout-offset-in-bits='1600'>
<var-decl name='d' type-id='type-id-6' visibility='default'/>
</data-member>
<data-member access='public' layout-offset-in-bits='2240'>
<var-decl name='f' type-id='type-id-7' visibility='default'/>
</data-member>
</class-decl>
<array-type-def dimensions='1' type-id='type-id-1' size-in-bits='160' alignment-in-bits='32' id='type-id-3'>
<subrange length='5'/>
</array-type-def>
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-8'/>
<pointer-type-def type-id='type-id-8' size-in-bits='64' alignment-in-bits='64' id='type-id-9'/>
<array-type-def dimensions='1' type-id='type-id-9' size-in-bits='448' alignment-in-bits='64' id='type-id-4'>
<subrange length='7'/>
</array-type-def>
<type-decl name='double' size-in-bits='64' alignment-in-bits='64' id='type-id-10'/>
<array-type-def dimensions='2' type-id='type-id-10' size-in-bits='512' alignment-in-bits='64' id='type-id-5'>
<subrange length='5'/>
<subrange length='3'/>
</array-type-def>
<pointer-type-def type-id='type-id-1' size-in-bits='64' alignment-in-bits='64' id='type-id-11'/>
<array-type-def dimensions='1' type-id='type-id-11' size-in-bits='256' alignment-in-bits='64' id='type-id-12'>
<subrange length='4'/>
</array-type-def>
<pointer-type-def type-id='type-id-12' size-in-bits='64' alignment-in-bits='64' id='type-id-13'/>
<array-type-def dimensions='1' type-id='type-id-13' size-in-bits='640' alignment-in-bits='64' id='type-id-6'>
<subrange length='10'/>
</array-type-def>
<array-type-def dimensions='1' type-id='type-id-8' size-in-bits='infinite' alignment-in-bits='8' id='type-id-7'>
<subrange length='infinite'/>
</array-type-def>
<reference-type-def kind='lvalue' type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-14'/>
<qualified-type-def type-id='type-id-14' const='yes' id='type-id-15'/>
<function-decl name='foo' size-in-bits='64'>
<parameter type-id='type-id-15'/>
<return type-id='type-id-1'/>
</function-decl>
</abi-instr>