summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/PrintfFormatString.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Suggest '%@' for Objective-C objects in ObjC format strings.Jordan Rose2012-05-301-1/+23
| | | | llvm-svn: 157716
* Format string analysis: give 'q' its own enumerator.Hans Wennborg2012-02-161-2/+6
| | | | | | | | | 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. llvm-svn: 150697
* Make -Wformat fix-its preserve original conversion specifiers.Hans Wennborg2012-02-151-4/+8
| | | | | | | | | | | | | | | | | 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". llvm-svn: 150578
* Let %S, %ls, %C match 16bit types in NSStrings.Nico Weber2012-01-311-3/+10
| | | | | | As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html llvm-svn: 149325
* Fix NSLog format string checking for %@.Ted Kremenek2012-01-251-0/+2
| | | | llvm-svn: 148885
* Teach scanf/printf checking about '%Ld' and friends (a GNU extension). ↵Ted Kremenek2012-01-241-2/+4
| | | | | | Fixes PR 9466. llvm-svn: 148859
* scanf: parse the 'm' length modifier, and check that the right argumentsHans Wennborg2012-01-121-0/+2
| | | | | | are used with that and the 'a' length modifier. llvm-svn: 148029
* Support the 'a' length modifier in scanf format strings as a C90Hans Wennborg2011-12-151-4/+11
| | | | | | | | | extension. This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess errors). llvm-svn: 146649
* Remove unnecessary braces from my previous commit.Hans Wennborg2011-12-091-2/+1
| | | | llvm-svn: 146259
* Make printf warnings refer to wint_t and wchar_t by nameHans Wennborg2011-12-091-6/+9
| | | | | | in addition to underlying type. llvm-svn: 146254
* Move definition of ConversionSpecifier::toString() to FormatString.cppHans Wennborg2011-12-091-40/+0
| | | | | | | It's declared in FormatString.h, so it shouldn't be defined in PrintfFormatString.cpp. llvm-svn: 146253
* fix format specifier fixit for printf("%ld", "foo");Hans Wennborg2011-12-091-0/+2
| | | | | | It should reset the length modifier (unless it's a wchar_t string). llvm-svn: 146252
* Make printf warnings refer to intmax_t et al. by nameHans Wennborg2011-12-071-4/+7
| | | | | | | | | | | | 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.) llvm-svn: 146032
* Revert r145697 and dependent patch r145702. It added a dependency fromNick Lewycky2011-12-021-28/+5
| | | | | | lib/Analysis to lib/Sema which is cyclical. llvm-svn: 145724
* Make r145697 actually work.Hans Wennborg2011-12-021-1/+1
| | | | | | Use the canonical type of the typedef to compare with the underlying type. llvm-svn: 145702
* Make conversion specifier warning refer to typedef if possible.Hans Wennborg2011-12-021-5/+28
| | | | | | | | 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')" llvm-svn: 145697
* Teach format string analysis that "%zu" means size_t.Hans Wennborg2011-10-271-9/+5
| | | | | | | | 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. llvm-svn: 143099
* Tweak printf format string parsing to accept 'hh' conversion specifier to ↵Ted Kremenek2011-10-251-1/+1
| | | | | | accept any char, not just signed char. Fixes <rdar://problem/10303638>. llvm-svn: 142908
* More metaprogramming with builtin types.John McCall2011-10-181-15/+9
| | | | llvm-svn: 142433
* Suggest %zu for size_t args to printf.Hans Wennborg2011-10-181-1/+18
| | | | | | | | 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. llvm-svn: 142342
* Add a new placeholder type to represent "unbridged"John McCall2011-10-171-0/+1
| | | | | | | | casts in ARC. No semantic analysis yet. llvm-svn: 142208
* Provide half floating point support as a storage only type.Anton Korobeynikov2011-10-141-0/+1
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-1/+1
| | | | llvm-svn: 140367
* Fix else style. No functionality change intended.Chad Rosier2011-08-171-4/+2
| | | | llvm-svn: 137896
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-1/+1
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Revert r133024, "[format strings] correctly suggest correct type for '%@'Daniel Dunbar2011-06-281-2/+0
| | | | | | | | | 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. llvm-svn: 134041
* [format strings] correctly suggest correct type for '%@' specifiers. Fixes ↵Ted Kremenek2011-06-141-0/+2
| | | | | | <rdar://problem/9607158>. llvm-svn: 133024
* Don't print fixits for format specifiers in cases where the fixit does not ↵Eli Friedman2011-04-271-12/+27
| | | | | | | | actually fix the warning. PR8781. I'm not sure what the preferred way to write a test for whether a fixit is emitted. llvm-svn: 130335
* When generating printf fixits, preserve the original formating for unsigned ↵Ted Kremenek2011-04-251-1/+3
| | | | | | integers (e.g., 'x', 'o'). llvm-svn: 130164
* Fix whitespace.NAKAMURA Takumi2011-01-271-4/+4
| | | | llvm-svn: 124364
* 7bit-ize.NAKAMURA Takumi2011-01-271-1/+1
| | | | llvm-svn: 124363
* Add semantic checking that the "thousands grouping"Ted Kremenek2011-01-081-0/+18
| | | | | | | prefix in a printf format string is matched with the appropriate conversion specifier. llvm-svn: 123055
* Add printf format string parsing support for 'Ted Kremenek2011-01-081-1/+5
| | | | | | prefix to format conversions (POSIX extension). llvm-svn: 123054
* The -fshort-wchar option causes wchar_t to become unsigned, in addition to beingChris Lattner2010-12-251-1/+2
| | | | | | | 16-bits in size. Implement this by splitting WChar into two enums, like we have for char. This fixes a miscompmilation of XULRunner, PR8856. llvm-svn: 122558
* Fix range in printf warnings for invalid conversion specifiers.Ted Kremenek2010-12-021-1/+1
| | | | llvm-svn: 120735
* The 'X' printf type has a valid alternative form. Fixes PR8641.Anders Carlsson2010-11-211-1/+2
| | | | llvm-svn: 119946
* Previously, the printf warnings would say your arguments type was 'int' when ↵Ted Kremenek2010-10-211-1/+15
| | | | | | | | | | 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! llvm-svn: 116996
* Fix printf format string checking for '%lc' (which expects a wint_t or ↵Ted Kremenek2010-08-241-0/+8
| | | | | | compatible argument). Fixes PR 7981. llvm-svn: 111978
* Move 'hasValidLengthModifier' from PrintfFormatSpecifier to FormatSpecifier.Ted Kremenek2010-07-201-68/+0
| | | | llvm-svn: 108906
* Cleanup whitespace in switch statement. No functionality change.Ted Kremenek2010-07-201-6/+7
| | | | llvm-svn: 108905
* Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace andTed Kremenek2010-07-201-2/+5
| | | | | | | derived 'PrintfConversionSpecifier' from this class. We will do the same for 'ScanfConversionSpecifier'. llvm-svn: 108903
* Rename 'UnicodeStrArg' to 'SArg'.Ted Kremenek2010-07-201-3/+3
| | | | llvm-svn: 108901
* Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and ↵Ted Kremenek2010-07-201-6/+6
| | | | | | printf checking). llvm-svn: 108900
* Rename 'VoidPtrArg' to 'pArg' in printf/scanf checking.Ted Kremenek2010-07-201-4/+4
| | | | llvm-svn: 108899
* Rename 'CStrArg' to 'sArg' for printf checking to match with the analagous ↵Ted Kremenek2010-07-201-6/+6
| | | | | | enum for scanf checking. llvm-svn: 108898
* Rename analyze_printf::ConversionSpecifier::IntAsCharArg to 'cArg' to matchTed Kremenek2010-07-201-4/+4
| | | | | | | analagous enum in analyze_scanf. This is prep for refactoring the logic for handling ConversionSpecifiers for both scanf and printf. llvm-svn: 108897
* Add most of the boilerplate support for scanf format string checking. This ↵Ted Kremenek2010-07-161-405/+43
| | | | | | | | | | | | | 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. llvm-svn: 108500
* Type Type::isRealFloatingType() that vectors are not floating-pointDouglas Gregor2010-06-221-1/+1
| | | | | | | | | 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++. llvm-svn: 106595
* Printf format strings: Added some more tests and fixed some minor bugs.Tom Care2010-06-181-3/+4
| | | | | | | | | | | | | | - 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 llvm-svn: 106275
* Bug 7394 - Fixed toString representation of Precisions in format strings.Tom Care2010-06-171-0/+3
| | | | | | | M include/clang/Analysis/Analyses/PrintfFormatString.h M lib/Analysis/PrintfFormatString.cpp llvm-svn: 106245
OpenPOWER on IntegriCloud