]> granicus.if.org Git - llvm/commitdiff
[DebugInfo] Fix getPreviousSibling after r336823
authorFangrui Song <maskray@google.com>
Wed, 11 Jul 2018 19:09:37 +0000 (19:09 +0000)
committerFangrui Song <maskray@google.com>
Wed, 11 Jul 2018 19:09:37 +0000 (19:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336837 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/DWARF/DWARFUnit.cpp

index 7581575e2a4ecfb9e110845d17f0a54cf7fef09f..2e965e0b94d55786d6812276a4fbc074ebc4a1ae 100644 (file)
@@ -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)