]> granicus.if.org Git - clang/commit
Make -Wformat fix-its preserve original conversion specifiers.
authorHans Wennborg <hans@hanshq.net>
Wed, 15 Feb 2012 09:59:46 +0000 (09:59 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 15 Feb 2012 09:59:46 +0000 (09:59 +0000)
commitbe6126a2a784e1446460b8d15c2b26f880c871fc
treedcd82b29009df602ff45a73ab58053e9e883d25a
parent37ce0104b182c9410cf2a76fe5a63a81dac876ac
Make -Wformat fix-its preserve original conversion specifiers.

This commit makes PrintfSpecifier::fixType() and ScanfSpecifier::fixType()
only fix a conversion specification enough that Clang wouldn't warn about it,
as opposed to always changing it to use the "canonical" conversion specifier.
(PR11975)

This preserves the user's choice of conversion specifier in cases like:

printf("%a", (long double)1);
where we previously suggested "%Lf", we now suggest "%La"

printf("%x", (long)1);
where we previously suggested "%ld", we now suggest "%lx".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150578 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/Analyses/FormatString.h
lib/Analysis/PrintfFormatString.cpp
lib/Analysis/ScanfFormatString.cpp
lib/Sema/SemaChecking.cpp
test/Sema/format-strings-fixit.c