diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-12-05 18:44:40 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-12-05 18:44:40 +0000 |
commit | 598ec0992d5090004628aade64ee6ba60393b203 (patch) | |
tree | 1589a8760b3c1ba740eae93a04a55ce8cbdb13e8 /clang/lib/Analysis/PrintfFormatString.cpp | |
parent | 6aaa87e0d27b42d1d7a95c8591b57fc5b3725fb0 (diff) | |
download | llvm-598ec0992d5090004628aade64ee6ba60393b203.zip llvm-598ec0992d5090004628aade64ee6ba60393b203.tar.gz llvm-598ec0992d5090004628aade64ee6ba60393b203.tar.bz2 |
Format strings: a character literal should be printed with %c, not %d.
The type of a character literal is 'int' in C, but if the user writes a
character /as/ a literal, we should assume they meant it to be a
character and not a numeric value, and thus offer %c as a correction
rather than %d.
There's a special case for multi-character literals (like 'MooV'), which
have implementation-defined value and usually cannot be printed with %c.
These still use %d as the suggestion.
In C++, the type of a character literal is 'char', and so this problem
doesn't exist.
<rdar://problem/12282316>
llvm-svn: 169398
Diffstat (limited to 'clang/lib/Analysis/PrintfFormatString.cpp')
0 files changed, 0 insertions, 0 deletions