Hans Wennborg
abc1e22d65
Properly check length modfiers for %n in format strings.
...
llvm-svn: 161408
2012-08-07 09:13:19 +00:00
Hans Wennborg
b1ab2a84f0
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.
llvm-svn: 161407
2012-08-07 08:59:46 +00:00
Hans Wennborg
16250c7c18
-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.
llvm-svn: 161052
2012-07-31 16:37:47 +00:00
Hans Wennborg
ebcd1c7ca2
Make -Wformat check the argument type for %n.
...
This makes Clang check that the corresponding argument for "%n" in a
format string is a pointer to int.
llvm-svn: 160966
2012-07-30 17:11:32 +00:00
Hans Wennborg
9bc9bcc247
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.
llvm-svn: 150697
2012-02-16 16:34:54 +00:00
Jean-Daniel Dupas
cb197b0e42
FormatCheckers should emit all diagnostics using EmitFormatDiagnostic().
...
llvm-svn: 149394
2012-01-31 18:12:08 +00:00
Ted Kremenek
6fa5727939
Teach scanf/printf checking about '%Ld' and friends (a GNU extension). Fixes PR 9466.
...
llvm-svn: 148859
2012-01-24 21:29:54 +00:00
Ted Kremenek
9139892728
The 'l' length modifier makes sense with the scanlist conversion specifier.
...
llvm-svn: 148586
2012-01-20 22:11:52 +00:00
Ted Kremenek
e7b9d4342b
Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).
...
llvm-svn: 148579
2012-01-20 21:52:58 +00:00
Hans Wennborg
507b567707
Treat -Wformat=0 as an alias for -Wformat.
...
Fixes PR9195.
llvm-svn: 148300
2012-01-17 09:30:38 +00:00
Hans Wennborg
6073e31baa
scanf: parse the 'm' length modifier, and check that the right arguments
...
are used with that and the 'a' length modifier.
llvm-svn: 148029
2012-01-12 17:11:12 +00:00
Hans Wennborg
fd950878fa
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.
llvm-svn: 148026
2012-01-12 15:07:16 +00:00
Hans Wennborg
32f115f9c1
scanf analysis: don't bail out after successful parse of scanlist
...
llvm-svn: 148025
2012-01-12 14:44:54 +00:00
Hans Wennborg
29b653413a
Fix test/Sema/format-strings-scanf.c
...
llvm-svn: 146651
2011-12-15 11:43:45 +00:00
Hans Wennborg
23926bd2d7
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).
llvm-svn: 146649
2011-12-15 10:25:47 +00:00
Hans Wennborg
4951c67875
Fix signature of vsscanf in Builtins.def
...
llvm-svn: 146392
2011-12-12 18:46:05 +00:00
Hans Wennborg
8d5a4093f5
Fix signature of sscanf in Builtins.def
...
llvm-svn: 146390
2011-12-12 18:33:02 +00:00
Hans Wennborg
bb4189db23
Make fscanf, vscanf, etc. be recognized as scanf-like functions.
...
llvm-svn: 146367
2011-12-12 10:34:18 +00:00
Hans Wennborg
b1a5e09f6f
Check that arguments to a scanf call match the format specifier,
...
and offer fixits when there is a mismatch.
llvm-svn: 146326
2011-12-10 13:20:11 +00:00
Richard Trieu
03cf7b70e0
Fix for PR9751 to change the behavior of -Wformat warnings. If the format
...
string is part of the function call, then there is no difference. If the
format string is not, the warning will point to the call site and a note
will point to where the format string is.
Fix-it hints for strings are moved to the note if a note is emitted. This will
prevent changes to format strings that may be used in multiple places.
llvm-svn: 143168
2011-10-28 00:41:25 +00:00
Ted Kremenek
4407ea4948
Hookup checking for invalid length modifiers in scanf format strings.
...
llvm-svn: 108907
2010-07-20 20:04:47 +00:00
Ted Kremenek
6cd694233d
Don't warn when a '%%' or '%*d' (scanf) is used in a format string with positional arguments, since
...
these don't actually consume an argument.
llvm-svn: 108757
2010-07-19 22:01:06 +00:00
Ted Kremenek
ce81542d61
Hook up 'invalid conversion' warning for scanf format strings.
...
llvm-svn: 108750
2010-07-19 21:25:57 +00:00
Ted Kremenek
5c3e1b9a54
Add missing conversion specifier parsing for 'u', 'x', 'o', and 's'. Fixes <rdar://problem/8204052>.
...
llvm-svn: 108742
2010-07-19 19:47:40 +00:00
Ted Kremenek
0030be81f5
Remove unicode quotes characters that somehow made it into a recent commit of mine.
...
llvm-svn: 108552
2010-07-16 20:49:01 +00:00
Ted Kremenek
d7b31cc60d
Hook up warning for an incomplete scanlist in scanf format strings.
...
llvm-svn: 108542
2010-07-16 18:28:03 +00:00
Ted Kremenek
c618728e8d
Tweak zero-field width in scanf format string diagnostic.
...
llvm-svn: 108541
2010-07-16 18:27:56 +00:00
Ted Kremenek
5530131bb7
Add initial test cases for scanf format string checking.
...
llvm-svn: 108503
2010-07-16 02:11:34 +00:00