ir: Improve get_debug_representation
authorDodji Seketeli <dodji@seketeli.org>
Fri, 16 Dec 2022 17:01:41 +0000 (18:01 +0100)
committerDodji Seketeli <dodji@seketeli.org>
Mon, 19 Dec 2022 16:04:57 +0000 (17:04 +0100)
* src/abg-ir.cc (get_debug_representation): Prefix
classes/structs/unions with the 'classes/struct/union' prefix.

Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
src/abg-ir.cc

index 0f8c1d2bb4b3bdf822fdebd8dd4cd460f02e8d75..85b5cbb3e51380a2e831374bf49d48fca08d9deb 100644 (file)
@@ -9303,6 +9303,15 @@ get_debug_representation(const type_or_decl_base* artifact)
       class_decl *clazz = is_class_type(c);
       string name = c->get_qualified_name();
       std::ostringstream o;
+      if (clazz)
+       {
+         if (clazz->is_struct())
+           o << "struct ";
+         else
+           o << "class ";
+       }
+      else if (is_union_type(c))
+       o << "union ";
       o << name;
 
       if (clazz)
@@ -9362,7 +9371,7 @@ get_debug_representation(const type_or_decl_base* artifact)
     {
       string name = e->get_qualified_name();
       std::ostringstream o;
-      o << name
+      o << "union " << name
        << " : "
        << e->get_underlying_type()->get_pretty_representation(/*internal=*/false,
                                                               true)