|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Summary: Adds support for %I, %I32 and %I64.
Reviewers: hans, jordan_rose, rnk, majnemer
Reviewed By: majnemer
CC: cfe-commits, cdavis5x
Differential Revision: http://llvm-reviews.chandlerc.com/D1456
llvm-svn: 188937 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.
The commit changes ASTContext to have two different types for this:
  - WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.
  - WideCharTy is the type of a wide character literal. In C++ this is
    the same as WCharTy, and in C  it is an integer type compatible with
    the type in <stddef.h>.
This fixes PR15815.
llvm-svn: 181587 | 
| | 
| 
| 
| | llvm-svn: 175705 | 
| | 
| 
| 
| 
| 
| | Post-commit CR feedback from Jordan Rose regarding r175594.
llvm-svn: 175679 | 
| | 
| 
| 
| | llvm-svn: 171367 | 
| | 
| 
| 
| 
| 
| | <rdar://problem/12061922>
llvm-svn: 163772 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | These will warn under -Wformat-non-iso, and will still be rejected
outright on other platforms.
<rdar://problem/12061922>
llvm-svn: 163771 | 
| | 
| 
| 
| 
| 
| 
| | As a corollary to the previous commit, even when an extension is
available, we can still offer a fixit to the standard modifier.
llvm-svn: 163453 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.
<rdar://problem/11518237>
llvm-svn: 163452 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | Also remove redundant constructors and unused member functions.
llvm-svn: 161403 | 
| | 
| 
| 
| 
| 
| 
| | Warn about using pointers to const-qualified types as arguments to
scanf. Ignore the volatile qualifier when checking if types match.
llvm-svn: 161052 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| | llvm-svn: 157961 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | For "%hhx", printf expects an unsigned char. This makes Clang
accept a 'char' argument for that also when using -funsigned-char.
This fixes PR12761.
llvm-svn: 156388 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | promotion of wchar_t - they may differ in signedness.
Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned.
There'll be a followup commit to fix that.
Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8
llvm-svn: 156165 | 
| | 
| 
| 
| | llvm-svn: 152839 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | This renames the -Wformat-non-standard flag to -Wformat-non-iso,
rewords the current warnings a bit (pointing out that a format string
is not supported by ISO C rather than being "non standard"),
and adds a warning about positional arguments.
llvm-svn: 152403 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | This adds the -Wformat-non-standard flag (off by default,
enabled by -pedantic), which warns about non-standard
things in format strings (such as the 'q' length modifier,
the 'S' conversion specifier, etc.)
llvm-svn: 151154 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | <rdar://problem/10814120>
llvm-svn: 149907 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | This fixes the case where Clang would output:
 error: format specifies type 'wchar_t *' (aka 'wchar_t *')
ArgTypeResult::getRepresentativeTypeName needs to take into account
that wchar_t can be a built-in type (as opposed to in C, where it is a
typedef).
llvm-svn: 149387 | 
| | 
| 
| 
| | llvm-svn: 148885 | 
| | 
| 
| 
| 
| 
| | Fixes PR 9466.
llvm-svn: 148859 | 
| | 
| 
| 
| | llvm-svn: 148586 | 
| | 
| 
| 
| | llvm-svn: 148577 | 
| | 
| 
| 
| 
| 
| | are used with that and the 'a' length modifier.
llvm-svn: 148029 | 
| | 
| 
| 
| 
| 
| 
| | Before r148025 we (accidentally) didn't check whether a length modifier is
appropriate for a scanlist, but now we do.
llvm-svn: 148026 | 
| | 
| 
| 
| 
| 
| 
| | It should not be supported in C++11, since that uses the C99 standard
library, in which 'a' is a format specifier.
llvm-svn: 147310 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | extension.
This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess
errors).
llvm-svn: 146649 | 
| | 
| 
| 
| 
| 
| | in addition to underlying type.
llvm-svn: 146254 | 
| | 
| 
| 
| 
| 
| 
| | It's declared in FormatString.h, so it shouldn't be defined in
PrintfFormatString.cpp.
llvm-svn: 146253 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | lib/Analysis to lib/Sema which is cyclical.
llvm-svn: 145724 | 
| | 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | accept any char, not just signed char.  Fixes <rdar://problem/10303638>.
llvm-svn: 142908 | 
| | 
| 
| 
| | llvm-svn: 140407 | 
| | 
| 
| 
| | llvm-svn: 140367 | 
| | 
| 
| 
| 
| 
| 
| 
| | LLVM.h imports
them into the clang namespace.
llvm-svn: 135852 | 
| | 
| 
| 
| 
| 
| | thing to do.
llvm-svn: 135152 | 
| | 
| 
| 
| 
| 
| | comparing integers to integers.  This happens not to be an issue now, but the extra check helps future proof in case of future refactorings.
llvm-svn: 135147 | 
| | 
| 
| 
| 
| 
| | cases to be more portable with an explicit target triple.
llvm-svn: 135134 | 
| | 
| 
| 
| 
| 
| 
| 
| | on 32-bit, so we shouldn't warn about using"
It fails on freebsd, mingw and msvc10.
llvm-svn: 135129 | 
| | 
| 
| 
| 
| 
| 
| 
| | shouldn't warn about using
an "int" format specifier with a "long" type in 32-bit.
llvm-svn: 135075 | 
| | 
| 
| 
| 
| 
| | conversion specifiers.  My recent change was a mistake.
llvm-svn: 135048 | 
| | 
| 
| 
| 
| 
| | specifiers for character types.
llvm-svn: 135046 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | <rdar://problem/9607158>.
llvm-svn: 133024 | 
| | 
| 
| 
| | llvm-svn: 118344 | 
| | 
| 
| 
| 
| 
| | compatible argument).  Fixes PR 7981.
llvm-svn: 111978 |