summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-04 06:20:49 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-04 06:20:49 +0000
commitbfc0e5725f94a52e92d8f53ab5285a8a0eb1a314 (patch)
tree90d7edc33226261d8deab66915dd823edff6747b /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parent628c2dba60ea6978ba9aa9292c8a7e2064cbd0ef (diff)
downloadbcm5719-llvm-bfc0e5725f94a52e92d8f53ab5285a8a0eb1a314.tar.gz
bcm5719-llvm-bfc0e5725f94a52e92d8f53ab5285a8a0eb1a314.zip
Add a 'count' field to the DWARF subrange.
The count field is necessary because there isn't a difference between the 'lo' and 'hi' attributes for a one-element array and a zero-element array. When the count is '0', we know that this is a zero-element array. When it's >=1, then it's a normal constant sized array. When it's -1, then the array is unbounded. llvm-svn: 169218
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 718e0dceb06..f5f36e461f1 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();
+ int64_t Count = 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,8 @@ 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);
+ if (H > 0 || Count != 0)
+ addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
Buffer.addChild(DW_Subrange);
}
OpenPOWER on IntegriCloud