]> granicus.if.org Git - llvm/commit
[codeview] VLAs and unsized arrays should use a size of zero
authorReid Kleckner <rnk@google.com>
Wed, 13 Sep 2017 21:54:20 +0000 (21:54 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 13 Sep 2017 21:54:20 +0000 (21:54 +0000)
commit68b15df8a122baa46465b937cac64c5aedc53302
tree41b9a03a8a22a882cd9193ee3620a697649806a6
parente8c0dd7abf45e023c47b156de896482974de48f6
[codeview] VLAs and unsized arrays should use a size of zero

Previously we used a size of '1' for VLAs because we weren't sure what
MSVC did. However, MSVC does support declaring an array without a size,
for which it emits an array type with a size of zero. Clang emits the
same DI metadata for VLAs and arrays without bound, so we would describe
arrays without bound as having one element. This lead to Microsoft
debuggers only printing a single element.

Emitting a size of zero appears to cause these debuggers to search the
symbol information to find a definition of the variable with accurate
array bounds.

Fixes http://crbug.com/763580

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313203 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
test/DebugInfo/COFF/types-array-advanced.ll
test/DebugInfo/COFF/types-array-unsized.ll [new file with mode: 0644]