]> granicus.if.org Git - llvm/commit
Implement DW_TAG_subrange_type with DW_AT_count rather than DW_AT_upper_bound
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 1 Oct 2014 00:56:55 +0000 (00:56 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 1 Oct 2014 00:56:55 +0000 (00:56 +0000)
commit06c13730536269a70e61e6729927c8a04d0ad471
tree28dc69f4fd9983e401aaf9a1aa9772050b745e9d
parentd0d5b08fbd68e725996734352bf427eba61c4352
Implement DW_TAG_subrange_type with DW_AT_count rather than DW_AT_upper_bound

This allows proper disambiguation of unbounded arrays and arrays of zero
bound ("struct foo { int x[]; };" and "struct foo { int x[0]; }"). GCC
instead produces an upper bound of -1 in the latter situation, but count
seems tidier. This way lower_bound is provided if it's not the language
default and count is provided if the count is known, otherwise it's
omitted. Simple.

If someone wants to look at rdar://problem/12566646 and see if this
change is acceptable to that bug/fix, that might be helpful (see the
empty-and-one-elem-array.ll test case which cites that radar).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218726 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
test/DebugInfo/X86/dbg-subrange.ll
test/DebugInfo/X86/empty-and-one-elem-array.ll
test/DebugInfo/X86/nondefault-subrange-array.ll