On Thu, Mar 27, 2025 at 5:31 PM Tom Tromey <tro...@adacore.com> wrote:
>
> >>>>> "Richard" == Richard Biener <richard.guent...@gmail.com> writes:
>
> Sorry about the delay on this.
>
> >> -      mod_type_die = subrange_type_die (type, low, high, bias, 
> >> context_die);
> >> +      mod_type_die = subrange_type_die (type, low, high, bias, mod_scope);
>
> Richard> that looks good.  But why not for the ARRAY_TYPE case dircetly
> Richard> above?
>
> I think I just didn't happen to need it.
>
> I can make this change if you think it's desirable.

I think so, for consistency.

> >> -         add_child_die_after (comp_unit_die (), mod_type_die, after_die);
> >> +         add_child_die_after (mod_scope, mod_type_die, after_die);
>
> Richard> For the next DW_AT_endianity there's an assert for the correct
> Richard> placement but not here So I'm not positive this change is
> Richard> according to the comment.  In fact we're realing with base-type
> Richard> DIEs here, and those are usually directly at comp_unit_die (),
> Richard> no?
>
> In C/C++, I think base types are normally only emitted at comp-unit
> scope.
>
> Ada (with my patches that are still in progress) may emit base types
> that have a different scope.  For a type like:
>
> package body Pck is
>    type My_Other_Int is mod 2**8;
>
>  <1><9a>: Abbrev Number: 1 (DW_TAG_base_type)
>     <9b>   DW_AT_byte_size   : 1
>     <9c>   DW_AT_encoding    : 7        (unsigned)
>     <9d>   DW_AT_name        : (indirect string, offset: 0xf): 
> pck__my_other_int
>
> This is the "encoded" (non-hierarchical) form, which is why it's
> currently a child of the CU DIE and why that "pkg__" prefix is in there.
>
> My patches will change this to emit a DW_TAG_module named "pck" that
> contains a base type named "my_other_int".

Let's involve Eric here, I have no idea what was intended here.

Richard.

>
> thanks,
> Tom

Reply via email to