[cfe-commits] r167361 - /cfe/trunk/lib/Frontend/TextDiagnostic.cpp

Richard Smith richard at metafoo.co.uk
Mon Nov 5 11:46:04 PST 2012


Looks like this would only make a difference if isspace() returns true
for some UTF-8 trailing byte in the current locale. However, the code
is still broken in locales in which isspace() returns true for some
UTF-8 leading bytes. We should not be using isspace() here...

On Mon, Nov 5, 2012 at 6:34 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> testcase?
>
> On 3 November 2012 17:21, Seth Cantrell <seth.cantrell at gmail.com> wrote:
>> Author: socantre
>> Date: Sat Nov  3 16:21:17 2012
>> New Revision: 167361
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=167361&view=rev
>> Log:
>> don't step into the middle of multibyte sequences
>>
>> Modified:
>>     cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>>
>> Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=167361&r1=167360&r2=167361&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
>> +++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Sat Nov  3 16:21:17 2012
>> @@ -418,7 +418,7 @@
>>      bool ExpandedRegion = false;
>>
>>      if (SourceStart>0) {
>> -      unsigned NewStart = SourceStart-1;
>> +      unsigned NewStart = map.startOfPreviousColumn(SourceStart);
>>
>>        // Skip over any whitespace we see here; we're looking for
>>        // another bit of interesting text.
>> @@ -445,7 +445,7 @@
>>      }
>>
>>      if (SourceEnd<SourceLine.size()) {
>> -      unsigned NewEnd = SourceEnd+1;
>> +      unsigned NewEnd = map.startOfNextColumn(SourceEnd);
>>
>>        // Skip over any whitespace we see here; we're looking for
>>        // another bit of interesting text.
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list