summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-11-13 02:31:47 +0000
committerBill Wendling <isanbard@gmail.com>2012-11-13 02:31:47 +0000
commitf454dfb6b5af1ff34602577b5f546c3370be315e (patch)
treeb9508ad75aee559b021e54245c9ac841df36c066 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parentc24eacc85d0530d1b85850cd54af35a4f31a3d28 (diff)
downloadbcm5719-llvm-f454dfb6b5af1ff34602577b5f546c3370be315e.tar.gz
bcm5719-llvm-f454dfb6b5af1ff34602577b5f546c3370be315e.zip
Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the same for both of them because we use the 'upper_bound' attribute. Instead use the 'count' attrbute, which gives the correct number of elements in the array. <rdar://problem/12566646> llvm-svn: 167806
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 2b07dda31ff..bcb002cdac3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1252,6 +1252,7 @@ void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR,
addDIEEntry(DW_Subrange, dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IndexTy);
uint64_t L = SR.getLo();
uint64_t H = SR.getHi();
+ uint64_t C = SR.getCount();
// The L value defines the lower bounds which is typically zero for C/C++. The
// H value is the upper bounds. Values are 64 bit. H - L + 1 is the size
@@ -1265,7 +1266,7 @@ void CompileUnit::constructSubrangeDIE(DIE &Buffer, DISubrange SR,
}
if (L)
addUInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
- addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
+ addUInt(DW_Subrange, dwarf::DW_AT_count, 0, C);
Buffer.addChild(DW_Subrange);
}
OpenPOWER on IntegriCloud