[4/4] ir: Handle ptr to fn type member with empty void return type
Commit Message
If a pointer to member type points to a function type that has an
empty return type, sometimes that can lead to a crash. This patch
considers that the empty return type is a void type.
* src/abg-ir.cc (add_outer_ptr_to_mbr_type_expr): If the function
type has no return type, consider it as void type.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
src/abg-ir.cc | 3 +++
1 file changed, 3 insertions(+)
@@ -28903,6 +28903,7 @@ add_outer_ptr_to_mbr_type_expr(const ptr_to_mbr_type* p,
return "";
std::ostringstream left, right, inner;
+ type_base_sptr void_type = p->get_environment().get_void_type();
string containing_type_name = get_type_name(p->get_containing_type(),
qualified, internal);
type_base_sptr mbr_type = p->get_member_type();
@@ -28913,6 +28914,8 @@ add_outer_ptr_to_mbr_type_expr(const ptr_to_mbr_type* p,
stream_pretty_representation_of_fn_parms(*fn_type, right,
qualified, internal);
type_base_sptr return_type = fn_type->get_return_type();
+ if (!return_type)
+ return_type = void_type;
if (is_npaf_type(return_type)
|| !(is_pointer_to_function_type(return_type)
|| is_pointer_to_array_type(return_type)