History log of /llvm-project/clang/test/Sema/format-strings.c (Results 76 – 100 of 128)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-2.8.0-rc1, llvmorg-2.8.0-rc0
# 5f0c0660 24-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.

llvm-svn: 111978


# 6cd69423 19-Jul-2010 Ted Kremenek <kremenek@apple.com>

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


# 3f272b85 21-Jun-2010 Tom Care <tcare@apple.com>

Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377

Updated format string highlighting and fixits to take advantage of the new CharSourceRange

Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377

Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases

M test/Sema/format-strings.c
M test/Sema/format-strings-fixit.c
M lib/Frontend/TextDiagnosticPrinter.cpp
M lib/Sema/SemaChecking.cpp

llvm-svn: 106480

show more ...


# b49ec690 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 warn

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

llvm-svn: 106233

show more ...


# 98008a47 17-Jun-2010 Ted Kremenek <kremenek@apple.com>

Fix format string checking of '%c' by treating it as an integer conversion. Fixes PR 7391.

llvm-svn: 106196


# 64c235e4 16-Jun-2010 Ted Kremenek <kremenek@apple.com>

Extend format string type-checking to include '%p'. Fixes remaining cases PR 4468.

llvm-svn: 106151


# 9af03022 26-May-2010 Douglas Gregor <dgregor@apple.com>

Tell the string literal parser when it's not permitted to emit
diagnostics. That would be while we're parsing string literals for the
sole purpose of producing a diagnostic about them. Fixes
<rdar://

Tell the string literal parser when it's not permitted to emit
diagnostics. That would be while we're parsing string literals for the
sole purpose of producing a diagnostic about them. Fixes
<rdar://problem/8026030>.

llvm-svn: 104684

show more ...


Revision tags: llvmorg-2.7.0
# 4f4946aa 22-Apr-2010 Douglas Gregor <dgregor@apple.com>

Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/metho

Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:

t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
type 'int *' [-pedantic]
f(long_ptr);
^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
^

llvm-svn: 102038

show more ...


# 4d745dd5 25-Mar-2010 Ted Kremenek <kremenek@apple.com>

Fix two bugs in format-string checking:
(1) Do not assume the data arguments start after the format string
(2) Do not use the fact that a function is variadic to treat it like a va_list printf functi

Fix two bugs in format-string checking:
(1) Do not assume the data arguments start after the format string
(2) Do not use the fact that a function is variadic to treat it like a va_list printf function

Fixes PR 6697.

llvm-svn: 99480

show more ...


# 80263e59 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>.

llvm-svn: 97482


# 09597b46 27-Feb-2010 Ted Kremenek <kremenek@apple.com>

Fix crasher caused by setting a bit in a possibly empty bitvector while
doing printf format string checking. This is a recent regression.

llvm-svn: 97318


# d166819c 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.

llvm-svn: 97297


# 4a49d981 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 c

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).

llvm-svn: 97248

show more ...


# 4e5f30ca 24-Feb-2010 Ted Kremenek <kremenek@apple.com>

Disable one test case because of the inconsistent results it is giving on
Windows and Mac OS X. Will investigate later.

llvm-svn: 97016


# 74a4ce7f 24-Feb-2010 Ted Kremenek <kremenek@apple.com>

Add support for '%C' and '%S' printf conversion specifiers.

llvm-svn: 97005


# 588fc83c 16-Feb-2010 Ted Kremenek <kremenek@apple.com>

Add test case to show that Clang now checks the format string
arguments of asprintf (<rdar://problem/6657191>).

llvm-svn: 96319


# ccf701d3 16-Feb-2010 Ted Kremenek <kremenek@apple.com>

Fix test case.

llvm-svn: 96311


# c8b188d5 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>.

llvm-svn: 96310


# d31b2637 11-Feb-2010 Ted Kremenek <kremenek@apple.com>

Patch by Cristian Draghici:

Enhance the printf format string checking when using the format
specifier flags ' ', '0', '+' with the 'p' or 's' conversions (since
they are nonsensical and undefined).

Patch by Cristian Draghici:

Enhance the printf format string checking when using the format
specifier flags ' ', '0', '+' with the 'p' or 's' conversions (since
they are nonsensical and undefined). This is similar to GCC's
checking.

Also warning when a precision is used with the 'p' conversin
specifier, since it has no meaning.

llvm-svn: 95869

show more ...


# a71cc153 02-Feb-2010 Douglas Gregor <dgregor@apple.com>

Implement promotion for enumeration types.

WHAT!?!

It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despi

Implement promotion for enumeration types.

WHAT!?!

It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despite having properly computed the promotion type when the
enum was defined. Various operations on values of enum type just
"worked" because we could still compute the integer rank of an enum
type; the oddity, however, is that operations such as "add an enum and
an unsigned" would often have an enum result type (!). The bug
actually showed up as a spurious -Wformat diagnostic
(<rdar://problem/7595366>), but in theory it could cause miscompiles.

In this commit:
- Enum types with a promotion type of "int" or "unsigned int" are
promotable.
- Tweaked the computation of promotable types for enums
- For all of the ABIs, treat enum types the same way as their
underlying types (*not* their promotion types) for argument passing
and return values
- Extend the ABI tester with support for enumeration types

llvm-svn: 95117

show more ...


# 016b6052 01-Feb-2010 Ted Kremenek <kremenek@apple.com>

Add format string type checking support for 'long double'.

llvm-svn: 95026


# cd831061 01-Feb-2010 Ted Kremenek <kremenek@apple.com>

Format string checking: selectively ignore implicit casts to 'int'
when checking if the format specifier matches the type of the data
argument and the length modifier indicates the data type is 'char

Format string checking: selectively ignore implicit casts to 'int'
when checking if the format specifier matches the type of the data
argument and the length modifier indicates the data type is 'char' or
'short'.

llvm-svn: 94992

show more ...


# 19b70bd4 30-Jan-2010 Daniel Dunbar <daniel@zuster.org>

Recognize 'q' as a format length modifier (from BSD).

llvm-svn: 94894


# 9ff02052 30-Jan-2010 Ted Kremenek <kremenek@apple.com>

Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.

llvm-svn: 94867


# c3bdff7c 30-Jan-2010 Ted Kremenek <kremenek@apple.com>

Add basic type checking of format string conversion specifiers and their arguments. Thanks to Cristian Draghici for his help with this patch!

llvm-svn: 94864


123456