summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-04-08 23:39:38 +0000
committerDevang Patel <dpatel@apple.com>2011-04-08 23:39:38 +0000
commit778947c2037cf7f817ab16fe18b396626753ee69 (patch)
tree1d6b3254f9c8f87a4aae046143c622437bf12f93 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent5ae6b64e7f2740a43d5d1508c60269add134ed84 (diff)
downloadbcm5719-llvm-778947c2037cf7f817ab16fe18b396626753ee69.tar.gz
bcm5719-llvm-778947c2037cf7f817ab16fe18b396626753ee69.zip
Simplify array bound checks and clarify comments. One element array can have same non-zero number as lower bound as well as upper bound.
llvm-svn: 129170
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index b9bf37bd5ea..440099f607d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1242,19 +1242,16 @@ void DwarfDebug::constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy){
int64_t L = SR.getLo();
int64_t H = SR.getHi();
- // The L value defines the lower bounds typically zero for C/C++. The H
- // value is the upper bounds. Values are 64 bit. H - L + 1 is the size
- // of the array. If L > H the array will be unbounded. If the L is
- // non zero and same is H then also the array will be unbounded. If L is
- // zero and H is zero then the array has one element and in such case do
- // not emit lower bound.
-
- if (L > H || (L == H && L != 0)) {
- // This is an unbounded subrange.
+ // 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
+ // of the array. If L > H then do not emit DW_AT_lower_bound and
+ // DW_AT_upper_bound attributes. If L is zero and H is also zero then the
+ // array has one element and in such case do not emit lower bound.
+
+ if (L > H) {
Buffer.addChild(DW_Subrange);
return;
}
-
if (L)
addSInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, L);
addSInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, H);
OpenPOWER on IntegriCloud