[llvm] Add debuginfo C support for a SetType, Subrangetype, dynamic array type and replace arrays (PR #135607)
Tom Tromey via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 4 07:15:42 PDT 2025
tromey wrote:
> I had another look after that query about Fortran and changed the unwrap to unwrapDI for those parameters and now they support null values. I'm not an expert on unwrapping and am mostly confused about the whole business.
I think the rule is that `unwrap` requires a non-`NULL` value and `unwrapDI` allows one. `unwrap` ultimately uses `cast<>`, which disallows `NULL`, while `unwrapDI` explicitly checks for an allows it. So then for each parameter one must consider whether `NULL` makes sense.
Like in the patch, the set type constructor uses `unwrapDI<DIType>(BaseTy)`. But this means you could construct a set type without an underlying element type -- which probably is fine in the sense that it won't cause a crash or whatever, but at the same time is sort of useless.
On the other hand, the patch requires a non-`NULL` bias: `unwrap(Bias)`. But this field is pretty specific to Ada, as in, I've never heard of another language that has this idea (a value can be stored with a bias so it will fit in fewer bits). So the patch as-is forces most callers to pass a wrapped `0` here.
Anyway, that's my understanding. Hopefully it's accurate, if not I'd appreciate a correction.
https://github.com/llvm/llvm-project/pull/135607
More information about the llvm-commits
mailing list