reader: Avoid empty return type node for a function type IR

Sometimes, the function type IR can have an empty node as return type,
to represent void.  This can wreak havoc on some part of the code that
don't expect that.  This patch uses a proper void type node for that
instead.

	* src/abg-reader.cc (build_function_type): If the return type node
	is empty, use a void type node.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2024-08-16 14:48:39 +02:00
parent 798c013de0
commit 2e1dbb2a6f
1 changed files with 7 additions and 2 deletions

View File

@ -4515,11 +4515,16 @@ build_function_type(reader& rdr,
if (xml_char_sptr s =
xml::build_sptr(xmlGetProp(n, BAD_CAST("type-id"))))
type_id = CHAR_STR(s);
type_base_sptr ret_type;
if (!type_id.empty())
fn_type->set_return_type(rdr.build_or_get_type_decl
(type_id, true));
ret_type = rdr.build_or_get_type_decl (type_id, true);
if (!ret_type)
ret_type = return_type;
fn_type->set_return_type(ret_type);
}
}
if (!fn_type->get_return_type())
fn_type->set_return_type(return_type);
fn_type->set_parameters(parms);