llvm-dwarfdump: Improve/fix pretty printing of array dimensions
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 19 Dec 2018 19:34:24 +0000 (19:34 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 19 Dec 2018 19:34:24 +0000 (19:34 +0000)
commitac69af7ad6560978883ce08ebf837b49046778c8
tree99e73ff33e407568e433bd5e4e6bd9e00736579b
parent0da49a7ef14b4f0d6fa343b7876209d37f5fe56b
llvm-dwarfdump: Improve/fix pretty printing of array dimensions

This is to address post-commit feedback from Paul Robinson on r348954.

The original commit misinterprets count and upper bound as the same thing (I thought I saw GCC producing an upper bound the same as Clang's count, but GCC correctly produces an upper bound that's one less than the count (in C, that is, where arrays are zero indexed)).

I want to preserve the C-like output for the common case, so in the absence of a lower bound the count (or one greater than the upper bound) is rendered between []. In the trickier cases, where a lower bound is specified, a half-open range is used (eg: lower bound 1, count 2 would be "[1, 3)" and an unknown parts use a '?' (eg: "[1, ?)" or "[?, 7)" or "[?, ? + 3)").

Reviewers: aprantl, probinson, JDevlieghere

Differential Revision: https://reviews.llvm.org/D55721

llvm-svn: 349670
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/BinaryFormat/Dwarf.h
llvm/lib/BinaryFormat/Dwarf.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/test/tools/llvm-dwarfdump/X86/prettyprint_types.s