[flang-commits] [flang] [flang][debug] Support ClassType. (PR #114809)
Abid Qadeer via flang-commits
flang-commits at lists.llvm.org
Tue Nov 12 05:16:38 PST 2024
abidh wrote:
> DW_TAG_dynamic_type
> he `fir.class` type is used for polymorphic entities (including unlimited polymorphic entities, `CLASS(*)`).
>
> Does DWARF provide support for querying the dynamic type at runtime?
>
> I saw dwarf has a DW_TAG_dynamic_type tag, but that seems related to POINTER/ALLOCATABLE length parametrized derived types rather than polymorphism.
Sorry I missed this comment earlier. I agree that `DW_TAG_dynamic_type` does not seem to be intended for polymorphism. I have noticed that gfortran uses an artificial type in such cases which have a data, vptr and len field. I was thinking that we can also use a type that exposes `elem_len` and `type` field from the descriptor.
```
(gdb) ptype p_t2
type = Type __class__STAR_p
PTR TO -> ( void :: _data )
PTR TO -> ( Type __vtype__STAR :: _vptr )
integer(kind=8) :: _len
End Type __class__STAR_p
```
https://github.com/llvm/llvm-project/pull/114809
More information about the flang-commits
mailing list