]> sourceware.org Git - libabigail.git/commit
xml reader: Fix recursive qualified & reference type definition
authorDodji Seketeli <dodji@redhat.com>
Fri, 21 May 2021 23:07:26 +0000 (01:07 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 25 May 2021 10:48:12 +0000 (12:48 +0200)
commitb00ba10e1deae4eae58cb783c01c69f384f392c1
tree10ac6f3b5365ed03a1d1eb0044d8483df218c87d
parent7a9fa3fe5a823d1627e83571dd862b3f07196ae0
xml reader: Fix recursive qualified & reference type definition

This is a followup patch for the fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1944088, which was in the
patch:

    commit 51ae965305f9eaa554d5d2111fa24eeb07d35244
    Author: Dodji Seketeli <dodji@redhat.com>
    Date:   Fri May 21 23:55:44 2021 +0200

abixml reader: Fix recursive type definition handling

After that patch, I noticed that qualified and reference types also
need to be able to handle the case where their underlying/pointed-to
type recursively refers to the type being created.  Just like typedef
and pointer types in that patch.

This patch thus adjusts build_qualified_type_decl and
build_reference_type_def to support that.  It also adjusts the
qualified_type_def and reference_type_def classes to support being
created without underlying/pointed-to type initially.

* include/abg-ir.h (qualified_type_def::qualified_type_def):
Declare a constructor with no underlying type.
(reference_type_def::reference_type_def): Declare a constructor
with no pointed-to type.
(reference_type_def::set_pointed_to_type): Declare new method.
* src/abg-ir.cc (qualified_type_def::priv::priv): Define a
constructor that takes no underlying type.
(qualified_type_def::build_name): Make this work even on
incomplete types with no underlying type.  In that case, this
behaves like if the underlying type is "void".
(qualified_type_def::qualified_type_def): Define a constructor
that takes no underlying type.
(qualified_type_def::get_size_in_bits): Make this work on
incomplete types with no underlying type.
(qualified_type_def::set_underlying_type): Adjust to properly
update this type when a new underlying type is set.  Particularly,
its name and the lookup maps from the type scope.
(reference_type_def::reference_type_def): Define a constructor
that takes no pointed-to type.
(reference_type_def::set_pointed_to_type): Define new function.
* src/abg-reader.cc (build_qualified_type_decl): Construct the
qualified type early before we try to construct its underlying
type.  Associate this incomplete type with the type-id.  Then try
to construct the underlying type.  During its construction, if
this incomplete qualified type is needed due to recursion then it
can be used, leading to just one qualified type being used as it
should be.
(build_reference_type_def): Likewise for building incomplete
reference type first before its pointed-to type.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-ir.h
src/abg-ir.cc
src/abg-reader.cc
This page took 0.031272 seconds and 5 git commands to generate.