summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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