[cfe-commits] r144521 - in /cfe/trunk: lib/Lex/LiteralSupport.cpp test/CodeGen/string-literal-unicode-conversion.c

Eli Friedman eli.friedman at gmail.com
Sun Nov 13 21:41:14 PST 2011


On Sun, Nov 13, 2011 at 9:17 PM, Nico Weber <nicolasweber at gmx.de> wrote:
> Author: nico
> Date: Sun Nov 13 23:17:37 2011
> New Revision: 144521
>
> URL: http://llvm.org/viewvc/llvm-project?rev=144521&view=rev
> Log:
> Fix a regression in wide character codegen. See PR11369.
>
>
> Modified:
>    cfe/trunk/lib/Lex/LiteralSupport.cpp
>    cfe/trunk/test/CodeGen/string-literal-unicode-conversion.c
>
> Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=144521&r1=144520&r2=144521&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
> +++ cfe/trunk/lib/Lex/LiteralSupport.cpp Sun Nov 13 23:17:37 2011
> @@ -1095,13 +1095,13 @@
>           // FIXME: Make the type of the result buffer correct instead of
>           // using reinterpret_cast.
>           UTF32 *ResultWidePtr = reinterpret_cast<UTF32*>(ResultPtr);
> -          *ResultWidePtr = ResultChar & 0xFF;
> +          *ResultWidePtr = ResultChar;
>           ResultPtr += 4;
>         } else if (CharByteWidth == 2) {
>           // FIXME: Make the type of the result buffer correct instead of
>           // using reinterpret_cast.
>           UTF16 *ResultWidePtr = reinterpret_cast<UTF16*>(ResultPtr);
> -          *ResultWidePtr = ResultChar & 0xFF;
> +          *ResultWidePtr = ResultChar & 0xFFFF;
>           ResultPtr += 2;
>         } else {
>           assert(CharByteWidth == 1 && "Unexpected char width");

Yes, that's correct; thanks for spotting it.

-Eli




More information about the cfe-commits mailing list