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/PrintfFormatString.cpp
|
be6126a2a784e1446460b8d15c2b26f880c871fc |
|
15-Feb-2012 |
Hans Wennborg <hans@hanshq.net> |
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
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
339b9072e26a2a0fe796dc69c4d28d964d0ec86d |
|
31-Jan-2012 |
Nico Weber <nicolasweber@gmx.de> |
Let %S, %ls, %C match 16bit types in NSStrings. As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.cpp
|
630821869c4ec4604ab479d66e5ff81147a858e1 |
|
09-Dec-2011 |
Hans Wennborg <hans@hanshq.net> |
Remove unnecessary braces from my previous commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.cpp
|
117348caf0a8f91782e9e32e32a8689576f394d7 |
|
09-Dec-2011 |
Hans Wennborg <hans@hanshq.net> |
fix format specifier fixit for printf("%ld", "foo"); It should reset the length modifier (unless it's a wchar_t string). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.cpp
|
377cc6e3e8a6d9d0c90a315d29ce84836383d059 |
|
02-Dec-2011 |
Hans Wennborg <hans@hanshq.net> |
Make r145697 actually work. Use the canonical type of the typedef to compare with the underlying type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.cpp
|
29e97cb35fab314388f62b68fefa78947e93c1dc |
|
27-Oct-2011 |
Hans Wennborg <hans@hanshq.net> |
Teach format string analysis that "%zu" means size_t. The code had it backwards, thinking size_t was signed, and using that for "%zd". Also let the analysis get the types for (u)intmax_t while we are at it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.cpp
|
2dde35bc626153492f5f58202506c88a27fbff5b |
|
19-Oct-2011 |
John McCall <rjmccall@apple.com> |
More metaprogramming with builtin types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
a7da2155167676a6a5d9fca4de947a9cab2a4908 |
|
18-Oct-2011 |
Hans Wennborg <hans@hanshq.net> |
Suggest %zu for size_t args to printf. For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc. rather than looking at the underlying type and suggesting "%llu" or other platform-specific length modifiers. Applies to C99 and C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
0ddaeb9b031070ec64afe92d9892875ac44df427 |
|
17-Oct-2011 |
John McCall <rjmccall@apple.com> |
Add a new placeholder type to represent "unbridged" casts in ARC. No semantic analysis yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
aa4a99b4a62615db243f7a5c433169f2fc704420 |
|
15-Oct-2011 |
Anton Korobeynikov <asl@math.spbu.ru> |
Provide half floating point support as a storage only type. Lack of half FP was a regression compared to llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.cpp
|
3060178ad9df29789505c1e6debcfc80a3a13587 |
|
18-Aug-2011 |
Chad Rosier <mcrosier@apple.com> |
Fix else style. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.cpp
|
06d88ec4204be7af2cf935f39a3e3391d281ad52 |
|
28-Apr-2011 |
Eli Friedman <eli.friedman@gmail.com> |
Don't print fixits for format specifiers in cases where the fixit does not actually fix the warning. PR8781. I'm not sure what the preferred way to write a test for whether a fixit is emitted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130335 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
1e713f50e904b96623425efa7119fcb98243e111 |
|
26-Apr-2011 |
Ted Kremenek <kremenek@apple.com> |
When generating printf fixits, preserve the original formating for unsigned integers (e.g., 'x', 'o'). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
dfbb02a16ac8c764b5ba1742450513d6212d2f9f |
|
27-Jan-2011 |
NAKAMURA Takumi <geek4civic@gmail.com> |
Fix whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
0099530a2288df7c2140dd8992b7310b9f6930a9 |
|
27-Jan-2011 |
NAKAMURA Takumi <geek4civic@gmail.com> |
7bit-ize. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
65197b4b0c55bb74af0450230d61ee9461223721 |
|
08-Jan-2011 |
Ted Kremenek <kremenek@apple.com> |
Add semantic checking that the "thousands grouping" prefix in a printf format string is matched with the appropriate conversion specifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
bd18d4584aae0ed6f7111ef5713784cf29fe663f |
|
08-Jan-2011 |
Ted Kremenek <kremenek@apple.com> |
Add printf format string parsing support for ' prefix to format conversions (POSIX extension). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
3f59c975aa5d047f7edd1b900b5e885c38af0ef7 |
|
26-Dec-2010 |
Chris Lattner <sabre@nondot.org> |
The -fshort-wchar option causes wchar_t to become unsigned, in addition to being 16-bits in size. Implement this by splitting WChar into two enums, like we have for char. This fixes a miscompmilation of XULRunner, PR8856. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
7966297a70996977f167a8676568f02f4283bdd6 |
|
02-Dec-2010 |
Ted Kremenek <kremenek@apple.com> |
Fix range in printf warnings for invalid conversion specifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
2e6c19abcf97c25f4d7458a9db89c5ab0158717d |
|
21-Nov-2010 |
Anders Carlsson <andersca@mac.com> |
The 'X' printf type has a valid alternative form. Fixes PR8641. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
4d8ae4d57ed18d60da4d3786fb740607aa7c3688 |
|
21-Oct-2010 |
Ted Kremenek <kremenek@apple.com> |
Previously, the printf warnings would say your arguments type was 'int' when it was really a 'char' or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints. Patch by Justin Bogner! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.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/PrintfFormatString.cpp
|
7fdba13847f01cfcdc7c9261b13e99e3cbecb5fc |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Cleanup whitespace in switch statement. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
6ecb950c65329f8d6ce9ad0514632df35a5ab61f |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace and derived 'PrintfConversionSpecifier' from this class. We will do the same for 'ScanfConversionSpecifier'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
de183a48dd8fcff5e0343e84c8a6b563088447ce |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Rename 'UnicodeStrArg' to 'SArg'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
35d353b47bce29200b910371dd9b8ba7f3058ab8 |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf checking). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
66932056da99d2441e27c10b27c82706671e1dbf |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Rename 'VoidPtrArg' to 'pArg' in printf/scanf checking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
99196b1031d37d37f395a3291ccdd12a3fc01242 |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Rename 'CStrArg' to 'sArg' for printf checking to match with the analagous enum for scanf checking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108898 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
92a6febe130dd9ad726983835297e11b2fa3b93f |
|
20-Jul-2010 |
Ted Kremenek <kremenek@apple.com> |
Rename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to match analagous enum in analyze_scanf. This is prep for refactoring the logic for handling ConversionSpecifiers for both scanf and printf. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108897 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.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/PrintfFormatString.cpp
|
0c293ea13d452c1a47a05ada5a5ee9acc69c66cc |
|
23-Jun-2010 |
Douglas Gregor <dgregor@apple.com> |
Type Type::isRealFloatingType() that vectors are not floating-point types, updating callers of both isFloatingType() and isRealFloatingType() accordingly. Caught at least one issue where we allowed one to declare a vector of vectors (!), along with cleaning up the standard-conversion logic for C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
4c6021995032a898fb0502d5d1fd2df37638e57b |
|
18-Jun-2010 |
Tom Care <tcare@apple.com> |
Printf format strings: Added some more tests and fixed some minor bugs. - Precision toStrings shouldn't print a dot when they have no value. - Length of char length modifier is now returned correctly. - Added several fixit tests. Note: fixit tests are currently broken due to a bug in HighlightRange. Marking as XFAIL for now. M test/Sema/format-strings-fixit.c M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
f521d6e151e0cf443bb767c6a83c06ea411530f8 |
|
18-Jun-2010 |
Tom Care <tcare@apple.com> |
Bug 7394 - Fixed toString representation of Precisions in format strings. M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
e4ee9663168dfb2b4122c768091e30217328c9fa |
|
17-Jun-2010 |
Tom Care <tcare@apple.com> |
Bug 7377: Fixed several bad printf format string bugs. - Added warning for undefined behavior when using field specifier - Added warning for undefined behavior when using length modifier - Fixed warnings for invalid flags - Added warning for ignored flags - Added fixits for the above warnings - Fixed accuracy of detecting several undefined behavior conditions - Receive normal warnings in addition to security warnings when using %n - Fix bug where '+' flag would remain on unsigned conversion suggestions Summary of changes: - Added expanded tests - Added/expanded warnings - Added position info to OptionalAmounts for fixits - Extracted optional flags to a wrapper class with position info for fixits - Added several methods to validate a FormatSpecifier by component, each checking for undefined behavior - Fixed conversion specifier checking to conform to C99 standard - Added hooks to detect the invalid states in CheckPrintfHandler::HandleFormatSpecifier Note: warnings involving the ' ' (space) flag are temporarily disabled until whitespace highlighting no longer triggers assertions. I will make a post about this on cfe-dev shortly. M test/Sema/format-strings.c M include/clang/Basic/DiagnosticSemaKinds.td M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp M lib/Sema/SemaChecking.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
13927a431dd733336cfd664bf0840747a71b0a43 |
|
16-Jun-2010 |
Ted Kremenek <kremenek@apple.com> |
Extend format string type-checking to include '%p'. Fixes remaining cases PR 4468. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
876e994957472eda4b40136d4e1d6e08e2be338f |
|
11-Jun-2010 |
Tom Care <tcare@apple.com> |
Small fixes regarding printf fix suggestions. - Added some handling of flags that become invalid when changing the conversion specifier. - Changed fixit behavior to remove unnecessary length modifiers. - Separated some tests out and added some comments. modified: lib/Analysis/PrintfFormatString.cpp test/Sema/format-strings-fixit.c git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
c8c4b4088cf0b3afeda425b25fa7c77d3873b12c |
|
09-Jun-2010 |
Douglas Gregor <dgregor@apple.com> |
Fix a typo that breaks the GCC build. Turns out that Clang isn't diagnosing this code as an error when it should, so I've filed http://llvm.org/bugs/show_bug.cgi?id=7325. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
3bfc5f49e0e37e235bb0d33bcbcb36af9d1f84ab |
|
09-Jun-2010 |
Tom Care <tcare@apple.com> |
Added FixIt support to printf format string checking. - Refactored LengthModifier to be a class. - Added toString methods in all member classes of FormatSpecifier. - FixIt suggestions keep user specified flags unless incorrect. Limitations: - The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation. A test/Sema/format-strings-fixit.c M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp M lib/Sema/SemaChecking.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
fdb703ab3a3c28aeb53b3db4c54e14a30d78dc4e |
|
25-Mar-2010 |
Ted Kremenek <kremenek@apple.com> |
Fix '+=' accumulation error when parsing numeric amounts in a format string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
d49d87719b8e272134e76601e3efc0197785aa8a |
|
01-Mar-2010 |
Ted Kremenek <kremenek@apple.com> |
Allow a '0' precision in format strings (as the man page says it is okay). Fixes <rdar://problem/7700339>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
efaff195ba1fa55b6fe0b0b2435b81451387d241 |
|
27-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
For printf format string checking, add support for positional format strings. Along the way, coelesce some of the diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
7f70dc85d5055c19c8003f43a59135de211ad1b9 |
|
26-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
For printf format string checking, move the tracking of the data argument index out of Sema and into analyze_printf::ParseFormatString(). Also use a bitvector to determine what arguments have been covered (instead of just checking to see if the last argument consumed is the max argument). This is prep. for support positional arguments (an IEEE extension). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
87260c7eabf88eb2009ba2ba20150cd897483241 |
|
24-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
Add support for '%C' and '%S' printf conversion specifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97005 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
4e4b30ec62d78b24e6556fea2624855c193d0e3e |
|
16-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
Refactor the logic for printf argument type-checking into analyze_printf::ArgTypeResult. Implement printf argument type checking for '%s'. Fixes <rdar://problem/3065808>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
df17f9d95ba03ba41d8d39ccb688a4eb2ee00e9a |
|
09-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
Convert tabs to spaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95621 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
74d56a168966ff015824279a24aaf566180ed97d |
|
04-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
Move ParseFormatString() and FormatStringHandler back into the analyze_printf namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
f911eba72e6d7275e5cfdb79ab23fb2aa9cc01d0 |
|
02-Feb-2010 |
Ted Kremenek <kremenek@apple.com> |
Add format string type checking support for 'long double'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
01aefc6d20fbfd50bfb83926226dee86dd31c9c5 |
|
30-Jan-2010 |
Daniel Dunbar <daniel@zuster.org> |
Recognize 'q' as a format length modifier (from BSD). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
c9a89fec60a20eb3269caa95eca048d45ab215ad |
|
30-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
40888ada6022cfd4ab2a7c07ab276639860ffc5a |
|
30-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Fix spacing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
33567d2feb3e52fac6e0b46d5b3d137fc8467fb0 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Per a suggestion from Cristian Draghici, add a method to FormatSpecifier that returns the expected type of the matching data argument. It isn't complete, but should handle several of the important cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
4dcb18ff9d92c66c78077ac5cae4b83af37292e4 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Enhancements to the alternate (WIP) format string checking: - Add ConversionSpecifier::consumesDataArgument() as a helper method to determine if a conversion specifier requires a matching argument. - Add support for glibc-specific '%m' conversion - Add an extra callback to HandleNull() for locations within the format specifier that have a null character git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
808015a18bd97781ce437831a95a92fdfc8d5136 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Alternate format string checking: issue warnings for incomplete format specifiers. In addition, move ParseFormatString() and FormatStringHandler() from the clang::analyze_printf to the clang namespace. Hopefully this will resolve some link errors on Linux. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
26ac2e07b46bfb4d4f00752c96481c0a98c79c69 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Alternate format string checking: issue a warning for invalid conversion specifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
4b220fae2f525fda39685ddfa7759950db1185e2 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Yet another attempt to make the Linux buildbots happy. Apparently there are differences on how nested namespaces are handled... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94790 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
d7a3f01a5109807b4fad48a7ab75fa806b8b899d |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Move definition of FormatStringHandler::~FormatStringHandler() within namespace directives. Hopefully this will make the Linux buildbots happy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94784 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
0d27735c51f5bd392e673cf39a675e14e9442387 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Add precision/field width checking to AlternateCheckPrintfString(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
e729acbba75903f42e79e72e46cdebe3f4c35521 |
|
29-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Fix off-by-one error in ParseFormatSpecifier() when reporting the location of a null character. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
a8d8fec7876666d90bb2a144d3b832b2d89a088a |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Add position of conversion specifier character to 'ConversionSpecifier'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
d2dcece5882215e92a80bff8a7b7fd2fd81d7086 |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Rename namespace clang::printf to clang::analyze_printf to avoid problems where the reference to 'printf' is ambiguous. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
d5f2096e266b7905df660b7839e69e9ed6ba9018 |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Allow HandleFormatSpecifier() to indicate that no more processing of the format string is desired. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
c7cbb9bf8e0bf8c3191ef0b782ec198c433d2a4e |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Add '@' conversion specifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
f291976ecf537dc4f2d5537b1664d47ff4b94865 |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Remove invalid conversion specifiers from format string checking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
c7ae51a3cd9460db8280e8623c90614f246e46d2 |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Add a few more conversion specifiers to ParseFormatSpecifier (these appear in SemaChecking). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|
8f0a1c73fd2b83afd4b1fce6f964535b51d13659 |
|
28-Jan-2010 |
Ted Kremenek <kremenek@apple.com> |
Add skeleton for a more structured way to analyzing pring format strings than what we currently have in Sema. This is both an experiment and a WIP. The idea is simple: parse the format string incrementally, constructing a well-structure representation of each format specifier. Each format specifier is then handed back one-by-one to a client via a callback. Malformed format strings are also handled with callbacks. The idea is to separate the parsing of the format string from the emission of diagnostics. Currently what we have in Sema for handling format strings is a mongrel of both that is hard to follow and difficult to modify (I can apply this label since I'm the original author of that code). This is in libAnalysis as it is reasonable generic and can potentially be used both by libSema and libChecker. Comments welcome. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Analysis/PrintfFormatString.cpp
|