| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
conversion specifiers. My recent change was a mistake.
llvm-svn: 135048
|
|
|
|
|
|
| |
specifiers for character types.
llvm-svn: 135046
|
|
|
|
|
|
|
| |
either imlicitly (for builtins) or explicitly (due to multiple
specification of the same attributes). Fixes <rdar://problem/9612060>.
llvm-svn: 133045
|
|
|
|
|
|
|
|
| |
never can be a real security issue.
Fixes PR 9314.
llvm-svn: 126447
|
|
|
|
|
|
|
|
| |
-Wformat-security on -Wformat, not vice-versa.
Fixes PR8486. Patch by Oleg Slezberg.
llvm-svn: 126096
|
|
|
|
|
|
|
| |
prefix in a printf format string is matched
with the appropriate conversion specifier.
llvm-svn: 123055
|
|
|
|
|
|
| |
prefix to format conversions (POSIX extension).
llvm-svn: 123054
|
|
|
|
| |
llvm-svn: 120735
|
|
|
|
| |
llvm-svn: 119946
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
(one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.
llvm-svn: 113472
|
|
|
|
|
|
|
|
| |
-Wformat-nonliteral, as
the function processing the format string can decided whether or not to accept a null format string (e.g., asl_log). Fixes <rdar://problem/8269537>.
llvm-svn: 113469
|
|
|
|
|
|
| |
compatible argument). Fixes PR 7981.
llvm-svn: 111978
|
|
|
|
|
|
|
|
| |
positional arguments, since
these don't actually consume an argument.
llvm-svn: 108757
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
Fixes PR 7391.
llvm-svn: 106196
|
|
|
|
|
|
| |
PR 4468.
llvm-svn: 106151
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
(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
|
|
|
|
|
|
| |
Fixes <rdar://problem/7700339>.
llvm-svn: 97482
|
|
|
|
|
|
| |
doing printf format string checking. This is a recent regression.
llvm-svn: 97318
|
|
|
|
|
|
| |
Along the way, coelesce some of the diagnostics.
llvm-svn: 97297
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Windows and Mac OS X. Will investigate later.
llvm-svn: 97016
|
|
|
|
| |
llvm-svn: 97005
|
|
|
|
|
|
| |
arguments of asprintf (<rdar://problem/6657191>).
llvm-svn: 96319
|
|
|
|
| |
llvm-svn: 96311
|
|
|
|
|
|
|
|
|
|
| |
analyze_printf::ArgTypeResult.
Implement printf argument type checking for '%s'.
Fixes <rdar://problem/3065808>.
llvm-svn: 96310
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 95026
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 94894
|
|
|
|
|
|
| |
<rdar://problem/6931734>.
llvm-svn: 94867
|
|
|
|
|
|
| |
arguments. Thanks to Cristian Draghici for his help with this patch!
llvm-svn: 94864
|
|
|
|
|
|
|
| |
the field width and precision of a format specifier instead of just
'int'. This matches GCC, and fixes <rdar://problem/6079850>.
llvm-svn: 94856
|
|
|
|
|
|
|
|
|
| |
checking. It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.
llvm-svn: 94837
|
|
|
|
| |
llvm-svn: 93072
|
|
|
|
|
|
| |
who prefers to be stealthy and mysterious.
llvm-svn: 91888
|
|
|
|
|
|
|
|
|
| |
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).
llvm-svn: 91446
|
|
|
|
|
|
| |
clang-cc when they do.
llvm-svn: 89070
|
|
|
|
| |
llvm-svn: 85450
|
|
|
|
|
|
|
|
|
| |
NumArgs && "Arg access out of range!").
For format string checking, only check the type of the format
specifier for non-vararg functions.
llvm-svn: 71672
|
|
|
|
|
|
| |
This enables one specific class of non-literal format warnings.
llvm-svn: 70368
|
|
|
|
|
|
|
|
|
|
|
| |
1. All all variants of -Wformat*, make them imply -Wformat. GCC warns
if you use -Wformatfoo without -Wformat. We just make one imply the
other.
2. Make -Wformat-nonliteral default to off, like gcc. It is an incredible
nuisance.
3. Accept but currently ignore -Wformat-extra-args.
llvm-svn: 70362
|
|
|
|
|
|
| |
Tests and drivers updated, still need to shuffle dirs.
llvm-svn: 67602
|
|
|
|
|
|
|
|
| |
allow non-literal format strings that are variables that (a) permanently bind to
a string constant and (b) whose string constants are resolvable within the same
translation unit.
llvm-svn: 67404
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and escaped newlines don't throw off the offset computation.
On this testcase:
printf("abc\
def"
"%*d", (unsigned) 1, 1);
Before:
t.m:5:5: warning: field width should have type 'int', but argument has type 'unsigned int'
def"
^
after:
t.m:6:12: warning: field width should have type 'int', but argument has type 'unsigned int'
"%*d", (unsigned) 1, 1);
^ ~~~~~~~~~~~~
llvm-svn: 64930
|