[PATCH] D55721: llvm-dwarfdump: Improve/fix pretty printing of array dimensions

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 08:42:48 PST 2018


dblaikie added a comment.

In D55721#1333018 <https://reviews.llvm.org/D55721#1333018>, @probinson wrote:

> In D55721#1331847 <https://reviews.llvm.org/D55721#1331847>, @dblaikie wrote:
>
> > In D55721#1331812 <https://reviews.llvm.org/D55721#1331812>, @probinson wrote:
> >
> > > Note that the lower-bound might be implicit, but it's never "unknown."
> > >  We do need to account for the cases where the implicit lower-bound is 1. The Fortran people will need this, and the OpenVMS folks support several other languages that also have a default LB of 1.
> > >
> > > Using `[C]` (C = count) for both the count-only and upper-bound-only cases suggests that we're being descriptive rather than carefully reflecting the attributes that are in the subrange DIE, which is fine.  So, if an explicit LB matches the language default, then the display should also be `[C]` (where C = count if we have a count, or C = U + (1 - L) if we have upper_bound).
> >
> >
> > The only change you're suggesting is to detect when an explicit LB matches the language default, and treating that case the same as if the LB were not specified (in terms of how it's printed out)?
>
>
> Sorry, no, in the course of editing the comment I lost the important part:  When converting UB-only to Count, you need to correctly factor in the default LB: `C = UB + (1 - DefaultLBForLanguage)` otherwise the display for 1-based languages will be incorrect.
>
> Then, since you have to know the default LB anyway, the rest seems not too hard.


Ah, fair enough - done those two things (omitting the lower bound when an explicit lower bound matches the language default & using the lower bound to accurately compute the size for [size] rendering).

I chose to use half open ranges always (even in the case where the input was lower/upper_bound, not lower_bound+count) to avoid visual ambiguity of "int[[x, y]]" - it's not clear what those x and y mean, why there are double squares around them, etc. Whereas "int[[x, y)]" is hopefully a bit more clear.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55721/new/

https://reviews.llvm.org/D55721





More information about the llvm-commits mailing list