[cfe-commits] [Patch] Fix off-by-one error in StringLiteral::getLocationOfByte, PR10223

Hans Wennborg hans at chromium.org
Thu Jun 30 13:18:38 PDT 2011


On Thu, Jun 30, 2011 at 1:06 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Jun 29, 2011, at 11:56 AM, Hans Wennborg wrote:
>
>> The attached patch fixes an off-by-one error in
>> StringLiteral::getLocationOfByte, exposed by PR10223.
>>
>> I don't really know what's going on in this code, so it would be good
>> if someone could review.
>>
>> It seems that TokNo == getNumConcatenated() would never be true,
>> because it's asserted earlier that TokNo < getNumConcatenated(). I
>> assume the author's intention was "TokNo is the last token", i.e.
>> TokNo == getNumConcatenated() - 1
>
> LGTM, please commit.
>
> -Chris
>

Thanks, committed r134183.

Hans



More information about the cfe-commits mailing list