[cfe-commits] Patch - String literal UCN conversion should use post-concatenation string type

Craig Topper craig.topper at gmail.com
Sat Jul 2 21:53:31 PDT 2011


When a multiple piece string literal is parsed by clang, each piece
performs UCN conversion depending whether it was written as "" or L"".
This means the "" are converted using UTF-8 and the L"" are converted
using UTF-16 or UTF-32 depending on the size of wchar_t. When a narrow
string and wide string are concatenated, the final string is a wide
string. So if you put a UCN in the part declared as narrow you can end
up with UTF-8 data in a wide string.

This patch fixes this by using the final type of the string to do UCN
conversion.

-- 
~Craig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ucn_wide.patch
Type: application/octet-stream
Size: 923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110702/79669c75/attachment.obj>


More information about the cfe-commits mailing list