]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Further use of mod_scope in modified_type_die
authorTom Tromey <tromey@adacore.com>
Wed, 21 Aug 2024 17:46:52 +0000 (11:46 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 1 Apr 2025 16:41:34 +0000 (10:41 -0600)
I am working on some changes to GNAT to emit hierarchical DWARF --
i.e., where entities will have simple names nested in a DW_TAG_module.

While working on this I found a couple of paths in modified_type_die
where "mod_scope" should be used, but is not.  I suspect these cases
are only reachable by Ada code, as in both spots (subrange types and
base types), I believe that other languages don't generally have named
types in a non-top-level scope, and in these other situations,
mod_scope will still be correct.

gcc

* dwarf2out.cc (modified_type_die): Use mod_scope for
ranged types, base types, and array types.

gcc/dwarf2out.cc

index a2acfd1d35654827492b69ec35b571accf2263a4..69e9d775d0d2c2ef635d536c2e7a8a3333197019 100644 (file)
@@ -13926,7 +13926,7 @@ modified_type_die (tree type, int cv_quals, bool reverse,
           || (lang_hooks.types.get_array_descr_info
               && lang_hooks.types.get_array_descr_info (type, &info)))
     {
-      gen_type_die (type, context_die);
+      gen_type_die (type, mod_scope);
       return lookup_type_die (type);
     }
   else if (code == INTEGER_TYPE
@@ -13936,7 +13936,7 @@ modified_type_die (tree type, int cv_quals, bool reverse,
       tree bias = NULL_TREE;
       if (lang_hooks.types.get_type_bias)
        bias = lang_hooks.types.get_type_bias (type);
-      mod_type_die = subrange_type_die (type, low, high, bias, context_die);
+      mod_type_die = subrange_type_die (type, low, high, bias, mod_scope);
       item_type = TREE_TYPE (type);
     }
   else if (is_base_type (type))
@@ -13973,10 +13973,10 @@ modified_type_die (tree type, int cv_quals, bool reverse,
        {
          dw_die_ref after_die
            = modified_type_die (type, cv_quals, false, context_die);
-         add_child_die_after (comp_unit_die (), mod_type_die, after_die);
+         add_child_die_after (mod_scope, mod_type_die, after_die);
        }
       else
-       add_child_die (comp_unit_die (), mod_type_die);
+       add_child_die (mod_scope, mod_type_die);
 
       add_pubtype (type, mod_type_die);
     }