[applied] ir: Use definition of decl-only parm type in function type names

Message ID 87a5gkgzwq.fsf@redhat.com
State New
Headers
Series [applied] ir: Use definition of decl-only parm type in function type names |

Commit Message

Dodji Seketeli Sept. 6, 2024, 10:50 p.m. UTC
  Hello,

When the type of a function parameter is a declaration-only type and
if it has a definition, then this patch uses that definition in the
representation of the function type name.

Note that the ABIXML writer always emits definitions of
declaration-only types when they are available so if we don't use
those definitions in the function type representations, there might be
subtle self-comparison errors down the road.

This patch fixes the self-comparison of the OpenMolcas package in
Fedora 36 which was failing for the command:

    $ fedabipkgdiff --self-compare -a --from fc36 OpenMolcas

	* src/abg-ir.cc (stream_pretty_representation_of_fn_parms): Use
	the definition of decl-only function parameter types in the
	representation.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-ir.cc | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index bc4eb2b3..a30b77c2 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -28651,6 +28651,12 @@  stream_pretty_representation_of_fn_parms(const function_type& fn_type,
 	    o << ", ";
 	  parm = *i;
 	  type = parm->get_type();
+	  // If the type is a decl-only class, union or enum that has a
+	  // definition, use the definition instead.  That definition
+	  // is what is going to be serialized out in ABIXML anyway,
+	  // so use that for consistency.
+	  if (decl_base_sptr def = look_through_decl_only(is_decl(type)))
+	    type = is_type(def);
 	  if (env.is_variadic_parameter_type(type))
 	    o << "...";
 	  else