summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-07-11 19:09:37 +0000
committerFangrui Song <maskray@google.com>2018-07-11 19:09:37 +0000
commit24452316c6c5c8e1e84c7dab75c340e4d889438d (patch)
treed5cdef8378d4b922b33cf05b67aa95cc155276fe /llvm/lib/DebugInfo
parent7481f75d769870c7b6f00f72a824e10d97a2c0df (diff)
downloadbcm5719-llvm-24452316c6c5c8e1e84c7dab75c340e4d889438d.tar.gz
bcm5719-llvm-24452316c6c5c8e1e84c7dab75c340e4d889438d.zip
[DebugInfo] Fix getPreviousSibling after r336823
llvm-svn: 336837
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 7581575e2a4..2e965e0b94d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -593,7 +593,8 @@ DWARFDie DWARFUnit::getPreviousSibling(const DWARFDebugInfoEntry *Die) {
return DWARFDie();
// Find the previous DIE whose depth is the same as the Die's depth.
- for (size_t I = getDIEIndex(Die) - 1; I >= 0; --I) {
+ for (size_t I = getDIEIndex(Die); I > 0;) {
+ --I;
if (DieArray[I].getDepth() == Depth - 1)
return DWARFDie();
if (DieArray[I].getDepth() == Depth)
OpenPOWER on IntegriCloud