]> sourceware.org Git - libabigail.git/commit
XML writer: use consistent type pointers for type ids and emission tracking
authorMatthias Maennich <maennich@google.com>
Fri, 3 Dec 2021 11:46:19 +0000 (11:46 +0000)
committerDodji Seketeli <dodji@redhat.com>
Thu, 9 Dec 2021 17:41:25 +0000 (18:41 +0100)
commit74a2866e4f8deec05d6ef08c54a9bf3414f953d2
tree07ec4a94e17a26f67eaa5272e84e40bdef52178b
parent762949ce3e717e062d522e59636f838e0fdd80c8
XML writer: use consistent type pointers for type ids and emission tracking

Insertion uses the canonical type, if available, but look-up did
not. Given that type id insertion and look-up also use canonical
types, it makes sense to adjust the remaining code accordingly.

Neither decl_only_type_is_emitted nor record_decl_only_type_as_emitted
do the check, but very few types end up being recorded this way.

The functions write_class_decl and write_union_decl (but not
write_class_decl_opening_tag and write_union_decl_opening_tag which
can be called in other contexts) resolve declaration-only types to a
definition where possible.

To ensure type ids consistently refer to the same canonical type we
should use canonical types and definitions-of-declarations more
consistently.

This change introduces get_exemplar_type to return the exemplar type
that should be used for type id and emitted checks.  That exemplar
type is the canonical type of a given type, or the canonical type of
the definition-of-declaration-only-type when applicable.

However, it does not also change all the write functions to write out
the exemplar types.

* include/abg-fwd.h (get_exemplar_type): Declare new function.
* src/abg-ir.cc (get_exemplar_type): Define new function.
* src/abg-writer.cc (type_has_existing_id): use get_exemplar_type
for resolution.
(get_id_for_type): Likewise.
(record_type_as_emitted): Likewise.
(type_is_emitted): Likewise.

Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-fwd.h
src/abg-ir.cc
src/abg-writer.cc
This page took 0.032159 seconds and 5 git commands to generate.