[cfe-commits] r148389 - in /cfe/trunk: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/LiteralSupport.cpp

Eli Friedman eli.friedman at gmail.com
Sat Mar 24 19:11:09 PDT 2012


On Sat, Mar 24, 2012 at 5:21 PM, Seth Cantrell <seth.cantrell at gmail.com> wrote:
> Okay, here's a different approach. I'm trying to treat the column numbers as being a code unit offset and using that to calculate the real column numbers. It relies on being able to compute the column width of characters, and this hacked up version uses wcswidth to do that even though that's not really going to work (since it's locale based an also because wcswidth seems to be broken). Anyway, here are what the results look like for me in Terminal:

The results seem roughly correct... this patch doesn't look right,
though.  Primarily, I really don't like relying on column numbers: the
source buffer is in bytes, and we want to print the output in columns
as measured on the terminal.  The column number is neither of those
(or at least, it isn't supposed to be), so using it here just seems to
make everything more complicated.

On a side note, the handling for source ranges looks it doesn't handle
multiple source ranges correctly.

-Eli

>
>
> On Mar 23, 2012, at 4:42 PM, Eli Friedman wrote:
>
>> On Fri, Mar 23, 2012 at 1:49 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
>>> On Thu, Mar 22, 2012 at 11:57 PM, Seth Cantrell <seth.cantrell at gmail.com> wrote:
>>>> Here are some patches for review. One enables setting reverse colors with raw_ostreams in LLVM. The other is to print unprintable characters in clang diagnostics in hex with reversed colors.
>>>
>>> The patch for color reversal seems fine, although maybe someone more
>>> familiar with that code should take a look.  The patch for unprintable
>>> characters is a step in the right direction, but completely ignores
>>> the caret/ranges and fixits (so things won't line up).
>>>
>>> I was actually hacking on this code from that angle recently; I'll
>>> send you what I have soon.
>>
>> Attaching my work-in-progress, which lines up the caret correctly (but
>> doesn't have your nice color-formatting, and there are still a couple
>> other issues with making everything line up).
>>
>> -Eli
>> <diagencoding.txt>
>




More information about the cfe-commits mailing list