summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ScanfFormatString.cpp
Commit message (Collapse)AuthorAgeFilesLines
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-1/+1
| | | | llvm-svn: 171367
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-1/+1
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Format strings: %D, %U, and %O are valid on Darwin (same as %d, %u, %o).Jordan Rose2012-09-131-3/+23
| | | | | | | | | These will warn under -Wformat-non-iso, and will still be rejected outright on other platforms. <rdar://problem/12061922> llvm-svn: 163771
* Remove redundant semicolons which are null statements.Dmitri Gribenko2012-09-101-1/+1
| | | | llvm-svn: 163546
* Format strings: %Ld isn't available on Darwin or Windows.Jordan Rose2012-09-081-3/+5
| | | | | | | | | This seems to be a GNU libc extension; we offer a fixit to %lld on these platforms. <rdar://problem/11518237> llvm-svn: 163452
* Properly check length modfiers for %n in format strings.Hans Wennborg2012-08-071-1/+24
| | | | llvm-svn: 161408
* Remove ScanfArgType and bake that logic into ArgType.Hans Wennborg2012-08-071-92/+55
| | | | | | | | 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. llvm-svn: 161407
* Rename analyze_format_string::ArgTypeResult to ArgTypeHans Wennborg2012-08-071-52/+52
| | | | | | Also remove redundant constructors and unused member functions. llvm-svn: 161403
* -Wformat: better handling of qualifiers on pointer argumentsHans Wennborg2012-07-311-3/+9
| | | | | | | Warn about using pointers to const-qualified types as arguments to scanf. Ignore the volatile qualifier when checking if types match. llvm-svn: 161052
* Make -Wformat check the argument type for %n.Hans Wennborg2012-07-301-0/+7
| | | | | | | This makes Clang check that the corresponding argument for "%n" in a format string is a pointer to int. llvm-svn: 160966
* Make -Wformat walk the typedef chain when looking for size_t, etc.Hans Wennborg2012-07-271-15/+2
| | | | | | | | | | | | | | 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". llvm-svn: 160886
* Make suggestions for mismatched enum arguments to printf/scanf.Jordan Rose2012-06-041-0/+5
| | | | llvm-svn: 157962
* Format string analysis: give 'q' its own enumerator.Hans Wennborg2012-02-161-1/+4
| | | | | | | | | 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-8/+10
| | | | | | | | | | | | | | | | | 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
* Teach scanf/printf checking about '%Ld' and friends (a GNU extension). ↵Ted Kremenek2012-01-241-2/+6
| | | | | | Fixes PR 9466. llvm-svn: 148859
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-2/+2
| | | | llvm-svn: 148577
* scanf: parse the 'm' length modifier, and check that the right argumentsHans Wennborg2012-01-121-3/+14
| | | | | | are used with that and the 'a' length modifier. llvm-svn: 148029
* scanf analysis: don't bail out after successful parse of scanlistHans Wennborg2012-01-121-1/+1
| | | | llvm-svn: 148025
* Support the 'a' length modifier in scanf format strings as a C90Hans Wennborg2011-12-151-5/+12
| | | | | | | | | extension. This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess errors). llvm-svn: 146649
* Check that arguments to a scanf call match the format specifier,Hans Wennborg2011-12-101-1/+252
| | | | | | and offer fixits when there is a mismatch. llvm-svn: 146326
* Revert r109428 "Hoist argument type checking into CheckFormatHandler. This ↵Michael J. Spencer2010-07-271-6/+0
| | | | | | | | is prep for scanf format" Got errors about ASTContext being undefined with Visual Studio 2010. llvm-svn: 109491
* Fix namespace polution.Dan Gohman2010-07-261-0/+1
| | | | llvm-svn: 109440
* Hoist argument type checking into CheckFormatHandler. This is prep for ↵Ted Kremenek2010-07-261-0/+6
| | | | | | | | scanf format string argument type checking. llvm-svn: 109428
* Hookup checking for invalid length modifiers in scanf format strings.Ted Kremenek2010-07-201-21/+23
| | | | llvm-svn: 108907
* Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace andTed Kremenek2010-07-201-27/+27
| | | | | | | derived 'PrintfConversionSpecifier' from this class. We will do the same for 'ScanfConversionSpecifier'. llvm-svn: 108903
* Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and ↵Ted Kremenek2010-07-201-1/+1
| | | | | | printf checking). llvm-svn: 108900
* Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'. Fixes ↵Ted Kremenek2010-07-191-0/+4
| | | | | | <rdar://problem/8204052>. llvm-svn: 108742
* Hook up warning for an incomplete scanlist in scanf format strings.Ted Kremenek2010-07-161-2/+2
| | | | llvm-svn: 108542
* Add the main scanf-parsing logic that I meant to include in my previous commit.Ted Kremenek2010-07-161-0/+214
llvm-svn: 108502
OpenPOWER on IntegriCloud