[cfe-commits] [patch] Unicode character literals for UTF-8 source encoding

Seth Cantrell seth.cantrell at gmail.com
Sun Jan 8 01:00:21 PST 2012


Here's a patch that improves support for Unicode character literals.

* adds errors for multiple characters in Unicode character literals and for char16_t character literals where the value can't be represented in 16 bits (2.14.3 p2)

* allows unicode escapes in character and string literals to represent control characters and basic source characters (2.3 p2)

* treats valid UTF-8 encoded code points as single c-chars so that these are no longer counted as multi-chars. narrow character literals will probably get warnings about the character value being too large for the type, Unicode and wide character literals will get the correct Unicode codepoint value if it can be represented.

* added error for invalid source encodings of character literals.

The patch builds without warnings in xcode and with llvm make, and, after applying my changes to the tests, make test in the clang directory passes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Adds-support-for-Unicode-character-literals.patch
Type: application/octet-stream
Size: 11364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120108/bc18de89/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-add-tests-for-unicode-character-literals.patch
Type: application/octet-stream
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120108/bc18de89/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-stop-claiming-unicode-escape-sequences-are-too-long-.patch
Type: application/octet-stream
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120108/bc18de89/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-update-existing-tests-for-unicode-character-literal-.patch
Type: application/octet-stream
Size: 3624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120108/bc18de89/attachment-0003.obj>


More information about the cfe-commits mailing list