<div dir="ltr">On 21 August 2013 11:43, Stephan Bergmann <span dir="ltr"><<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 08/21/2013 06:18 PM, Richard Smith wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 20 Aug 2013 21:15, "Nick Lewycky" <<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a><br></div><div class="im">
<mailto:<a href="mailto:nicholas@mxc.ca" target="_blank">nicholas@mxc.ca</a>>> wrote:<br>
><br>
> Author: nicholas<br>
> Date: Tue Aug 20 23:10:58 2013<br>
> New Revision: 188863<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=188863&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=188863&view=rev</a><br>
> Log:<br>
> Issue fixits replacing invalid character literals with the equivalent<br>
\xNN<br>
> escape code.<br>
><br>
> Added:<br>
> cfe/trunk/test/Lexer/char-<u></u>literal-encoding-fixit.c<br>
> Modified:<br>
> cfe/trunk/lib/Lex/<u></u>LiteralSupport.cpp<br>
><br>
> Modified: cfe/trunk/lib/Lex/<u></u>LiteralSupport.cpp<br>
> URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=188863&r1=188862&r2=188863&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/Lex/<u></u>LiteralSupport.cpp?rev=188863&<u></u>r1=188862&r2=188863&view=diff</a><br>
><br>
==============================<u></u>==============================<u></u>==================<br></div><div class="im">
> --- cfe/trunk/test/Lexer/char-<u></u>literal-encoding-fixit.c (added)<br>
> +++ cfe/trunk/test/Lexer/char-<u></u>literal-encoding-fixit.c Tue Aug 20<br>
23:10:58 2013<br>
> @@ -0,0 +1,11 @@<br>
> +// RUN: cp %s %t<br>
> +// RUN: %clang_cc1 -fixit -x c %t<br>
> +// RUN: FileCheck -input-file=%t %t<br>
> +<br>
> +// Note that this file is not valid UTF-8.<br>
> +<br>
> +int test1 = 'ˆ';<br>
> +// CHECK: int test1 = '\x88';<br>
> +<br>
> +int test2 = 'abˆc';<br>
> +// CHECK: int test2 = 'ab\x88c';<br>
</div></blockquote>
<br>
But the latter will be parsed as "a", "b", "\x88c" rather than "a", "b", "\x88", "c". I think the only safe way to do such a replacement esp. for character literals is to use octal \ooo escapes. (For string literals, there would also be the possibility of splitting into adjacent string literals.)</blockquote>
<div><br></div><div>Thanks, reverted in r188918. We should also suggest things like the other simple-escape-sequence characters too.</div><div><br></div><div>Nick</div><div><br></div><div><br></div></div></div></div>