mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-21 09:20:38 +00:00
57d8b7da41
* 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.
15 lines
585 B
XML
15 lines
585 B
XML
<abi-instr version='1.0'>
|
|
<namespace-decl name='foo'>
|
|
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
|
|
</namespace-decl>
|
|
<namespace-decl name='bar'>
|
|
<type-decl name='int32' size-in-bits='32' alignment-in-bits='32' id='type-id-2'/>
|
|
</namespace-decl>
|
|
<namespace-decl name='baz'>
|
|
<namespace-decl name='barbaz'>
|
|
<type-decl name='int64' size-in-bits='64' alignment-in-bits='64' id='type-id-3'/>
|
|
</namespace-decl>
|
|
</namespace-decl>
|
|
<type-decl name='char' size-in-bits='8' alignment-in-bits='8' id='type-id-4'/>
|
|
</abi-instr>
|