[cfe-dev] Fixits with multibyte chars

Jordan Rose jordan_rose at apple.com
Mon Jul 16 10:49:42 PDT 2012


On Jul 16, 2012, at 10:47 , Benjamin Kramer <benny.kra at gmail.com> wrote:

> 
> On 16.07.2012, at 19:32, Jordan Rose <jordan_rose at apple.com> wrote:
> 
>> Hi, everyone. We recently hit an assertion when trying to output a fixit with Unicode characters in it; it reduces down to this:
>> 
>> void test() {
>> printf("∆: %d", 1L);
>> }
>> 
>> I could of course just disable fixits when there are Unicode characters involved, but I'd like to fix this the right way. The trouble is -fdiagnostics-parseable-fixits, which is supposed to be machine-readable output, and in this case is a three-byte UTF-8 character three columns or one column? I think one column is the right way to go, but I wanted to get some other opinions before I start working on a patch.
> 
> This actually depends on the system. On some systems we'll print the unicode codepoint in hex, others will get the 1 column char. There is the llvm::sys::locale::columnWidth function to get this information in a portable way.

Okay, that gives us two problems, then…for user-visible fixits we can use llvm::sys::locale::columnWidth (thanks, Ben), but then -fdiagnostics-parseable-fixits will have different column numbers? Is that okay?

(Currently -fdiagnostics-parseable-fixits counts columns in bytes rather than characters.)



More information about the cfe-dev mailing list