History log of /external/clang/lib/Analysis/FormatString.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
8be066e6733364cd34f25c4f7b7344f72aa23369 08-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: suggest %lld instead of %qd and %Ld with -Wformat-non-iso.

As a corollary to the previous commit, even when an extension is
available, we can still offer a fixit to the standard modifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
bbb6bb4952b77e57b842b4d3096848123ae690e7 08-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: %Ld isn't available on Darwin or Windows.

This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.

<rdar://problem/11518237>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
58e1e54476d610d6c33ef483f216ed8a1282d35c 07-Aug-2012 Hans Wennborg <hans@hanshq.net> Remove ScanfArgType and bake that logic into ArgType.

This is useful for example for %n in printf, which expects
a pointer to int with the same logic for checking as %d
would have in scanf.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
f3749f4168c5cee59627a681ca4ca6e4116d0761 07-Aug-2012 Hans Wennborg <hans@hanshq.net> Rename analyze_format_string::ArgTypeResult to ArgType

Also remove redundant constructors and unused member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
5deddafd3ef51e94b4ac4d80e38271d3768b1af6 31-Jul-2012 Hans Wennborg <hans@hanshq.net> -Wformat: better handling of qualifiers on pointer arguments

Warn about using pointers to const-qualified types as arguments to
scanf. Ignore the volatile qualifier when checking if types match.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
4684778993c667246039b4664acbce59dc99440c 27-Jul-2012 Hans Wennborg <hans@hanshq.net> Make -Wformat walk the typedef chain when looking for size_t, etc.

Clang's -Wformat fix-its currently suggest using "%zu" for values of
type size_t (in C99 or C++11 mode). However, for a type such as
std::vector<T>::size_type, it does not notice that type is actually
typedeffed to size_t, and instead suggests a format for the underlying
type, such as "%lu" or "%u".

This commit makes the format string fix mechanism walk the typedef chain
so that it notices if the type is size_t, even if that isn't "at the
top".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
ee0259d308e72141982a85b40863e760a8447edf 05-Jun-2012 Jordan Rose <jordan_rose@apple.com> Teach printf/scanf about enums with fixed underlying types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
101d4e0c8ffbcdaaa58cddf1c20f98aa1b4501c4 08-May-2012 Hans Wennborg <hans@hanshq.net> Make -Wformat accept printf("%hhx", c); with -funsigned-char

For "%hhx", printf expects an unsigned char. This makes Clang
accept a 'char' argument for that also when using -funsigned-char.

This fixes PR12761.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
392da48160bd92ceb486792780467cbfdb2d0e8c 04-May-2012 James Molloy <james.molloy@arm.com> Fix handling of wint_t - we can't assume wint_t is purely an integer promotion of wchar_t - they may differ in signedness.

Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned.

There'll be a followup commit to fix that.

Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
afcd1954be90965d832ae56f1413beae836c3346 15-Mar-2012 Ted Kremenek <kremenek@apple.com> Support '%p' format specifier with block pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
f85626453123f9691bcef13cff963f556e209c27 09-Mar-2012 Hans Wennborg <hans@hanshq.net> -Wformat-non-iso: warn about positional arguments (pr12017)

This renames the -Wformat-non-standard flag to -Wformat-non-iso,
rewords the current warnings a bit (pointing out that a format string
is not supported by ISO C rather than being "non standard"),
and adds a warning about positional arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
76517426dc8bf7734c07eefc35171a6bfdba1a2b 22-Feb-2012 Hans Wennborg <hans@hanshq.net> Warn about non-standard format strings (pr12017)

This adds the -Wformat-non-standard flag (off by default,
enabled by -pedantic), which warns about non-standard
things in format strings (such as the 'q' length modifier,
the 'S' conversion specifier, etc.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
32addd519c6699000ff79c387a1c87f0ab7c3698 16-Feb-2012 Hans Wennborg <hans@hanshq.net> Format string analysis: give 'q' its own enumerator.

This is in preparation for being able to warn about 'q' and other
non-standard format string features.

It also allows us to print its name correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
b4a3ef783cb3e9c8a927130d65385988a6aabaa3 06-Feb-2012 Ted Kremenek <kremenek@apple.com> Tweak format string checking to work with %@ and ObjC toll-free bridging. <rdar://problem/10814120>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
7da1f4679332277614b6c583df66c3bfd94ded66 31-Jan-2012 Hans Wennborg <hans@hanshq.net> Format string warnings: don't a.k.a. wchar_t with wchar_t.

This fixes the case where Clang would output:
error: format specifies type 'wchar_t *' (aka 'wchar_t *')

ArgTypeResult::getRepresentativeTypeName needs to take into account
that wchar_t can be a built-in type (as opposed to in C, where it is a
typedef).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
e6ca97f2aeb301e28d20988b27c4297a9b540991 25-Jan-2012 Ted Kremenek <kremenek@apple.com> Fix NSLog format string checking for %@.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
9d24c2cbd9cf1b7c165ccb13221f2efb2f4b49b0 24-Jan-2012 Ted Kremenek <kremenek@apple.com> Teach scanf/printf checking about '%Ld' and friends (a GNU extension). Fixes PR 9466.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
ef1440b6eca118d46291166ce3302f9bba8e639b 20-Jan-2012 Ted Kremenek <kremenek@apple.com> The 'l' length modifier makes sense with the scanlist conversion specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
3026348bd4c13a0f83b59839f64065e0fcbea253 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
37969b7e14d6a4dfd934ef6d3738cc90b832ec1d 12-Jan-2012 Hans Wennborg <hans@hanshq.net> scanf: parse the 'm' length modifier, and check that the right arguments
are used with that and the 'a' length modifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
28058d179ae40edc66135458849f1073c841bc74 12-Jan-2012 Hans Wennborg <hans@hanshq.net> scanf analysis: the 'a' length modifier is valid with a scanlist

Before r148025 we (accidentally) didn't check whether a length modifier is
appropriate for a scanlist, but now we do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
5294c792c715b8dba26711be482b7a32be04d4d5 28-Dec-2011 Hans Wennborg <hans@hanshq.net> Support the 'a' scanf length modifier as an extension in C++.

It should not be supported in C++11, since that uses the C99 standard
library, in which 'a' is a format specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
d02deebce5f1b283101e035a7f5d5bab0d2068ec 15-Dec-2011 Hans Wennborg <hans@hanshq.net> Support the 'a' length modifier in scanf format strings as a C90
extension.

This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess
errors).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
f4f0c6095d1f481b94c6821c65e3bf1c9df42af7 09-Dec-2011 Hans Wennborg <hans@hanshq.net> Make printf warnings refer to wint_t and wchar_t by name
in addition to underlying type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
b8ec3e35d2d7a56b21cb449d4a7bde8d9d12c2a5 09-Dec-2011 Hans Wennborg <hans@hanshq.net> Move definition of ConversionSpecifier::toString() to FormatString.cpp

It's declared in FormatString.h, so it shouldn't be defined in
PrintfFormatString.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
a792aff1c7de253b89c473fdb7eef4a5bba83aec 07-Dec-2011 Hans Wennborg <hans@hanshq.net> Make printf warnings refer to intmax_t et al. by name
in addition to underlying type.

For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"

(This is a second attempt after r145697, which got reverted.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
687b5df89d4ba91219df578d02087c68c09a0332 03-Dec-2011 Nick Lewycky <nicholas@mxc.ca> Revert r145697 and dependent patch r145702. It added a dependency from
lib/Analysis to lib/Sema which is cyclical.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
5fdc1b993dcb01e8a994fdacfc4eb089832c82e3 02-Dec-2011 Hans Wennborg <hans@hanshq.net> Make conversion specifier warning refer to typedef if possible.

For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
6ca4a9ae99d65948e578d3e7d1f58ab6a947d2d7 25-Oct-2011 Ted Kremenek <kremenek@apple.com> Tweak printf format string parsing to accept 'hh' conversion specifier to accept any char, not just signed char. Fixes <rdar://problem/10303638>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
eb2d1f1c88836bd5382e5d7aa8f6b85148a88b27 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Removing a bunch of dead returns/breaks after llvm_unreachables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
1ad35bebcc07d34202850f46b5b7be46fda1c5d1 14-Jul-2011 Ted Kremenek <kremenek@apple.com> Revert r135147 and r135075. The consensus was that this wasn't the right thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
9dbe16eb808ed3b58be6be48bf4ae7317db63e89 14-Jul-2011 Ted Kremenek <kremenek@apple.com> Add extra sanity checking in FormatString::matchesType() that we are comparing integers to integers. This happens not to be an issue now, but the extra check helps future proof in case of future refactorings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
826d5b4782d5c4c38c30eaae70a243c33a76edad 14-Jul-2011 Ted Kremenek <kremenek@apple.com> Reapply r135075, but modify format-strings.c and format-strings-fixit.c test cases to be more portable with an explicit target triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
13d99bf2e9e13820d74ecc6a28630721736c1f10 14-Jul-2011 NAKAMURA Takumi <geek4civic@gmail.com> Revert r135075, "format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using"

It fails on freebsd, mingw and msvc10.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
8da9316c5a97887da0bf84a2ea45daf43ddf572b 13-Jul-2011 Ted Kremenek <kremenek@apple.com> format string checking: long and int have the same widths on 32-bit, so we shouldn't warn about using
an "int" format specifier with a "long" type in 32-bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
dc00d8158db573f4a1f91cfaa2a89171c2e5f637 13-Jul-2011 Ted Kremenek <kremenek@apple.com> Re-relax conversion specifier checking for printf format strings and conversion specifiers. My recent change was a mistake.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135048 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
45eb7022ff059ff5a291e24f57ff56428a1e8210 13-Jul-2011 Ted Kremenek <kremenek@apple.com> Fix inversion in argument type checking for format strings with conversion specifiers for character types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
d6a4d18f52a775ec9012f5eaec9e5190b0499823 29-Jun-2011 Daniel Dunbar <daniel@zuster.org> Revert r133024, "[format strings] correctly suggest correct type for '%@'
specifiers. Fixes <rdar://problem/9607158>." because it causes false positives
on some code that uses CF toll free bridging.
- I'll let Doug or Ted figure out the right fix here, possibly just to accept
any pointer type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
84862f6a0bdaad6f0648e10dfab6058cfa512864 15-Jun-2011 Ted Kremenek <kremenek@apple.com> [format strings] correctly suggest correct type for '%@' specifiers. Fixes <rdar://problem/9607158>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
624259984448cf19f4e94b7e31c7c32e99a39ea5 06-Nov-2010 Anders Carlsson <andersca@mac.com> Don't warn when matching %p to nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
9325eaf08fcccbc0d038e703f570c64daacdaa31 25-Aug-2010 Ted Kremenek <kremenek@apple.com> Fix printf format string checking for '%lc' (which expects a wint_t or compatible argument). Fixes PR 7981.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
a7e6845660f91ec611427e1db842780e1ec12bdb 22-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Detabify.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
96827eb52405a71c65c200949f3e644368e86454 27-Jul-2010 Michael J. Spencer <bigcheesegs@gmail.com> Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format"

Got errors about ASTContext being undefined with Visual Studio 2010.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
f762905bdefad77f91c7c6782a9c17e6b274d393 26-Jul-2010 Ted Kremenek <kremenek@apple.com> Hoist argument type checking into CheckFormatHandler. This is prep for scanf format
string argument type checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
a412a499162c46211c10ad92045b9b5fd2298ede 20-Jul-2010 Ted Kremenek <kremenek@apple.com> Move 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp
826a3457f737f1fc45a22954fd1bfde38160c165 16-Jul-2010 Ted Kremenek <kremenek@apple.com> Add most of the boilerplate support for scanf format string checking. This includes
handling the parsing of scanf format strings and hooking the checking into Sema.
Most of this checking logic piggybacks on what was already there for checking printf format
strings, but the checking logic has been refactored to support both.

What is left to be done is to support argument type checking in format strings and of course
fix the usual tail of bugs that will follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/FormatString.cpp