libabigail/tests/data/test-read-write/test10.xml
Dodji Seketeli ee19845a94 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-07-23 23:13:49 +02:00

29 lines
1.2 KiB
XML

<abi-instr version='1.0'>
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-1'/>
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-2'/>
<pointer-type-def type-id='type-id-2' size-in-bits='64' alignment-in-bits='64' id='type-id-3'/>
<namespace-decl name='ns0'>
<class-decl name='base0' size-in-bits='40' alignment-in-bits='8' visibility='default' id='type-id-4'>
<member-type access='public'>
<typedef-decl name='TINT' type-id='type-id-2' id='type-id-5'/>
</member-type>
<data-member access='private'>
<var-decl name='m_first' type-id='type-id-1'/>
</data-member>
<data-member access='private'>
<var-decl name='m_second' type-id='type-id-2'/>
</data-member>
</class-decl>
</namespace-decl>
<namespace-decl name='ns1'>
<class-decl name='C' size-in-bits='40' alignment-in-bits='8' visibility='default' id='type-id-6'>
<base-class access='public' type-id='type-id-4'/>
<member-function access='public'>
<function-decl name='get_first' mangled-name='blibli' binding='global'>
<return type-id='type-id-1'/>
</function-decl>
</member-function>
</class-decl>
</namespace-decl>
</abi-instr>