[llvm] r336837 - [DebugInfo] Fix getPreviousSibling after r336823

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 17:37:24 PDT 2018


In the future if you could describe what exactly you are fixing in your commit message, it would help readers like me understand what's going on.

thanks!
vedant

> On Jul 11, 2018, at 5:34 PM, Vedant Kumar <vsk at apple.com> wrote:
> 
> Hi Fangrui,
> 
> If the Die has a non-zero depth, isn't it guaranteed to have a non-zero index? If this really needs to be clearer, why not assert that the index is non-zero?
> 
> vedant
> 
> 
>> On Jul 11, 2018, at 12:09 PM, Fangrui Song via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>> 
>> Author: maskray
>> Date: Wed Jul 11 12:09:37 2018
>> New Revision: 336837
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=336837&view=rev
>> Log:
>> [DebugInfo] Fix getPreviousSibling after r336823
>> 
>> Modified:
>>   llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
>> 
>> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=336837&r1=336836&r2=336837&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
>> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Wed Jul 11 12:09:37 2018
>> @@ -593,7 +593,8 @@ DWARFDie DWARFUnit::getPreviousSibling(c
>>    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)
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 



More information about the llvm-commits mailing list