]> sourceware.org Git - libabigail.git/commitdiff
WIP: ir: Fix real type name setting
authorDodji Seketeli <dodji@redhat.com>
Fri, 13 Sep 2024 07:07:01 +0000 (09:07 +0200)
committerDodji Seketeli <dodji@redhat.com>
Sat, 14 Sep 2024 15:41:10 +0000 (17:41 +0200)
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-ir.cc

index a30b77c267ab3ed7260b5f2bd33db747b7f7acd6..8040301b17724412f04b9f68cc50464a677a51c4 100644 (file)
@@ -214,6 +214,9 @@ get_generic_anonymous_internal_type_name(const decl_base *d);
 static string
 get_internal_real_type_name(const type_base*);
 
+static string
+get_real_type_name(const type_base* t);
+
 static void
 update_qualified_name(decl_base * d);
 
@@ -8739,6 +8742,22 @@ get_internal_real_type_name(const type_base* t)
   return name;
 }
 
+static string
+get_real_type_name(const type_base* t)
+{
+    string name;
+  type_decl *type = is_real_type(t);
+
+  if (!type)
+    return name;
+
+  real_type int_type;
+  if (parse_real_type(type->get_name(), int_type))
+    name = int_type.to_string(/*internal=*/false);
+
+  return name;
+}
+
 /// Get the name of a given type and return a copy of it.
 ///
 /// @param t the type to consider.
@@ -16741,26 +16760,43 @@ type_decl::get_qualified_name(bool internal) const
 {
   const environment& env = get_environment();
 
-
-  if (internal)
-    if (is_real_type(this))
-      {
-       if (get_naked_canonical_type())
-         {
-           if (decl_base::priv_->internal_qualified_name_.empty())
-             decl_base::priv_->internal_qualified_name_ =
+  if (is_real_type(this))
+    {
+      if (get_naked_canonical_type())
+       {
+         if (internal)
+           {
+             if (decl_base::priv_->internal_qualified_name_.empty())
+               decl_base::priv_->internal_qualified_name_ =
+                 env.intern(get_internal_real_type_name(this));
+             return decl_base::priv_->internal_qualified_name_;
+           }
+         else
+           {
+             if (decl_base::priv_->qualified_name_.empty())
+               decl_base::priv_->qualified_name_ =
+                 env.intern(get_real_type_name(this));
+             return decl_base::priv_->qualified_name_;
+           }
+       }
+      else
+       {
+         if (internal)
+           {
+             decl_base::priv_->temporary_internal_qualified_name_ =
                env.intern(get_internal_real_type_name(this));
-           return decl_base::priv_->internal_qualified_name_;
-         }
-       else
-         {
-           decl_base::priv_->temporary_internal_qualified_name_ =
-             env.intern(get_internal_real_type_name(this));
-           return decl_base::priv_->temporary_internal_qualified_name_;
-         }
-      }
+             return decl_base::priv_->temporary_internal_qualified_name_;
+           }
+         else
+           {
+             decl_base::priv_->temporary_qualified_name_ =
+               env.intern(get_real_type_name(this));
+             return decl_base::priv_->temporary_qualified_name_;
+           }
+       }
+    }
 
-  return decl_base::get_qualified_name(/*internal=*/false);
+  return decl_base::get_qualified_name(internal);
 }
 
 /// Get the pretty representation of the current instance of @ref
@@ -29965,15 +30001,24 @@ qualified_name_setter::do_update(abigail::ir::decl_base* d)
        d->priv_->qualified_name_ = abigail::interned_string();
       else
        {
-         d->priv_->qualified_name_ =
-           env.intern(d->priv_->qualified_parent_name_ + "::" + d->get_name());
-         d->priv_->internal_qualified_name_ = env.intern(d->get_name());
+         if (abigail::ir::type_decl* t = is_real_type(d))
+           {
+             d->priv_->qualified_name_ = env.intern(get_real_type_name(t));
+             d->priv_->internal_qualified_name_ =
+               env.intern(get_internal_real_type_name(t));
+           }
+         else
+           {
+             d->priv_->qualified_name_ =
+               env.intern(d->priv_->qualified_parent_name_ + "::" + d->get_name());
+             d->priv_->internal_qualified_name_ = env.intern(d->get_name());
+           }
        }
     }
   // Make sure the internal qualified name (used for type
-  // canonicalization puroses) is always the qualified name.  For
+  // canonicalization purposes) is always the qualified name.  For
   // integral/real types however, only the non qualified type is used.
-  if (!is_integral_type(d))
+  if (!is_real_type(d))
     d->priv_->internal_qualified_name_ = d->priv_->qualified_name_;
 
   if (d->priv_->scoped_name_.empty())
This page took 0.04915 seconds and 5 git commands to generate.