* 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.
* src/abg-reader.cc (read_context::get_cur_scope): Remove useless
const overload. Don't make this rely on m_cur_scope. Rather, use
the path to the current decl (from the root element) to compute
the cur scope.
(read_context::m_cur_scope, read_context::set_cur_scope): Remove
these.
(update_read_context): Re-think logic.
* tests/data/test-read-write/test2.xml: Add new test input.
* tests/Makefile.am: Add data/test-read-write/test2.xml to the
distribution.
* tests/test-read-write.cc: Add data/test-read-write/test2.xml to
the harness.