Commit Graph

2 Commits

Author SHA1 Message Date
Ted Kremenek da2f405b09 Special case '%C' handling in ObjC format strings to handle integer literals that can represent unicode characters
Fixes <rdar://problem/13991617>.

llvm-svn: 192673
2013-10-15 05:25:17 +00:00
Jordan Rose 0e5badd93b Format strings: offer a cast to 'unichar' for %C in Objective-C contexts.
For most cases where a conversion specifier doesn't match an argument,
we usually guess that the conversion specifier is wrong. However, if
the argument is an integer type and the specifier is %C, it's likely
the user really did mean to print the integer as a character.

(This is more common than %c because there is no way to specify a unichar
literal -- you have to write an integer literal, such as '0x2603',
and then cast it to unichar.)

This does not change the behavior of %S, since there are fewer cases
where printing a literal Unicode *string* is necessary, but this could
easily be changed in the future.

<rdar://problem/11982013>

llvm-svn: 169400
2012-12-05 18:44:49 +00:00