[10/16] ir: Add fn types to type lookup maps

Message ID 87a5tyf5dn.fsf@redhat.com
State New
Headers
Series Fixing various issues found while working on PR30309 |

Commit Message

Dodji Seketeli Sept. 7, 2023, 2:02 p.m. UTC
  Hello,

This is a fix to an inconsistency I stumbled upon while looking at
something else.

So, function types were not being added to the type lookup maps.
Fixed this.

	* src/abg-ir.cc (maybe_update_types_lookup_map): Handle function
	types.
	(translation_unit::bind_function_type_life_time): Update types
	lookup map.

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

Patch

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index cb230082..93d79b33 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -1479,6 +1479,8 @@  translation_unit::bind_function_type_life_time(function_type_sptr ftype) const
     ABG_ASSERT(existing_tu == this);
   else
     ftype->set_translation_unit(const_cast<translation_unit*>(this));
+
+  maybe_update_types_lookup_map(ftype);
 }
 
 /// This implements the ir_traversable_base::traverse virtual
@@ -14198,6 +14200,8 @@  maybe_update_types_lookup_map(const decl_base_sptr& decl)
     maybe_update_types_lookup_map(array_type);
   else if (array_type_def::subrange_sptr subrange_type = is_subrange_type(decl))
     maybe_update_types_lookup_map(subrange_type);
+  else if (function_type_sptr fn_type = is_function_type(decl))
+    maybe_update_types_lookup_map(fn_type);
   else
     ABG_ASSERT_NOT_REACHED;
 }
@@ -14218,6 +14222,8 @@  maybe_update_types_lookup_map(const type_base_sptr& type)
 {
   if (decl_base_sptr decl = get_type_declaration(type))
     maybe_update_types_lookup_map(decl);
+  else if (function_type_sptr fn_type = is_function_type(type))
+    maybe_update_types_lookup_map(fn_type);
   else
     ABG_ASSERT_NOT_REACHED;
 }