[lld] r248580 - COFF: Fix local varaible type.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 12:08:03 PDT 2015


On Fri, Sep 25, 2015 at 11:27 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Fri, Sep 25, 2015 at 9:38 AM, Rui Ueyama via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: ruiu
>> Date: Fri Sep 25 11:38:13 2015
>> New Revision: 248580
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=248580&view=rev
>> Log:
>> COFF: Fix local varaible type.
>>
>> This is intended to be 64-bit integer, but size_t is not guranteed
>> to be the same or larger type than uint64_t.
>>
>> Modified:
>>     lld/trunk/COFF/ICF.cpp
>>
>> Modified: lld/trunk/COFF/ICF.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ICF.cpp?rev=248580&r1=248579&r2=248580&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/COFF/ICF.cpp (original)
>> +++ lld/trunk/COFF/ICF.cpp Fri Sep 25 11:38:13 2015
>> @@ -156,7 +156,7 @@ bool ICF::partition(ChunkIterator Begin,
>>      });
>>      if (Bound == End)
>>        return R;
>> -    size_t ID = NextID++;
>> +    uint64_t ID = NextID++;
>
>
> Not sure if it's better: but you could just use auto to make sure it's the
> same type as NextID?
>

I didn't think about that, and I'm not sure if that's better too. As you
can imagine, there are pros and cons. But at least this is consistent with
other code in LLD which does not use auto unless it can be inferred very
easily (from RHS of expression or something like that), so I'll let it
alone.


>      std::for_each(It, Bound, [&](SectionChunk *SC) { SC->GroupID = ID; });
>>      It = Bound;
>>      R = true;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150925/df5a229c/attachment.html>


More information about the llvm-commits mailing list