History log of /external/clang/lib/Sema/SemaChecking.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/Sema/SemaChecking.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/Sema/SemaChecking.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/Sema/SemaChecking.cpp
624bb5e59dbcc24efeee7dff12c9b48d2b5077e9 14-Nov-2013 Kevin Qin <Kevin.Qin@arm.com> [AArch64 neon] support poly64 and relevant intrinsic functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
186b26d01f2876e8b4b1f0f233e13fc4c613cddc 12-Nov-2013 Weiming Zhao <weimingz@codeaurora.org> add intrinsics: __builtin_arm_{dmb,dsb} for ARM


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
54de9bb0e67a3c06f6daad27af74e87f84944fa3 07-Nov-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed bug in return type of __builtin_va_start().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0004329758b99d2b92096b353e35c427ebbee622 05-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Simplify: we don't care why constant evaluation might have failed when we're
checking an expression for constant overflow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cbc198785c8ec64c1f869e65132cd4336f5c750a 01-Nov-2013 Richard Trieu <rtrieu@google.com> Disable -Wtautological-compare in template instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
311cb2b3221f6253ef86580151662f6c6788a320 01-Nov-2013 Richard Trieu <rtrieu@google.com> Disable -Wtautological-constant-out-of-range-compare in template instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a6306fc4b03672f7ecc0ae43d2620a0fc36764e9 29-Oct-2013 Tim Northover <tnorthover@apple.com> ARM: fix AST for __builtin_arm_strex call

The AST was constructed so that this builtin returned the default BoolTy and
since I'd opted for custom SemaChecking, I should have set it properly at that
point.

This caused an assertion failure when the types didn't match up with what we
generated. This makes it return an IntTy, which is as good as anything.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c85832f6feffd646458f5493710e433724e0cf34 18-Oct-2013 Fariborz Jahanian <fjahanian@apple.com> ObjectiveC. Added support for methods annotated with format_arg
attributes when such methods are actually envoked in message
expression. // rdar://15242010


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
656465d6743e24022b28f831f1fe249f69b8626e 15-Oct-2013 Ted Kremenek <kremenek@apple.com> Special case '%C' handling in ObjC format strings to handle integer literals that can represent unicode characters

Fixes <rdar://problem/13991617>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
728a1fb4fd6c1bcb200b5eed398e982fe1856ee1 14-Oct-2013 Ted Kremenek <kremenek@apple.com> GetExprRange() (used by -Wconversion checking) should look through OpaqueValueExprs.

Fixes a false positive with -Wconversion involving Objective-C properties.

Fixes <rdar://problem/14415662>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192611 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8adf837adc65b55a3f74643c02c1ee077dc26f06 20-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17290: Use 'false' macro in fix-it hint for initializing a variable of type
_Bool in C, if the macro is defined. Also teach FixItUtils to look at whether
the macro was defined at the source location for which it is creating a fixit,
rather than looking at whether it's defined *now*. This is especially relevant
for analysis-based warnings which are delayed until end of TU.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
414a1bdbdaf250e0488589f12865c8961831b65d 18-Sep-2013 Hal Finkel <hfinkel@anl.gov> Add the intrinsic __builtin_convertvector

LLVM supports applying conversion instructions to vectors of the same number of
elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to
cause such instructions to be generated when using builtin vector types.

C-style casting on vectors is already defined in terms of bitcasts, and so
cannot be used for these conversions as well (without leading to a very
confusing set of semantics). As a result, this adds a __builtin_convertvector
intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is
intended to aid the creation of vector intrinsic headers that create generic IR
instead of target-dependent intrinsics (in other words, this is a generic
_mm_cvtepi32_ps). As noted in the documentation, the action of
__builtin_convertvector is defined in terms of the action of a C-style cast on
each vector element.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a3d727ba775eaecd4fd69e1c90b81732394716a6 11-Sep-2013 Eli Friedman <eli.friedman@gmail.com> volatile types are not trivially copyable.

PR17123.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190484 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
caa5ab264ddea332e8423af1ebcea50d0cb37206 03-Sep-2013 Aaron Ballman <aaron@aaronballman.com> Switched FormatAttr to using an IdentifierArgument instead of a StringArgument since that is a more accurate modeling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4e1a82c14cba135ebd86bcc914fcbbc524d70a61 30-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Adjust clang for change to APFloat::toString.

I changed the diagnostic printing code because it's probably better
to cut off a digit from DBL_MAX than to print something like
1.300000001 when the user wrote 1.3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
344472ebeded2fca2ed5013b9e87f81d09bfa908 23-Aug-2013 Robert Wilhelm <robert.wilhelm@gmx.net> Use pop_back_val() instead of both back() and pop_back().
No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
24146975f1af8c1b4b14e8545f218129d0e7dfeb 22-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Split isFromMainFile into two functions.

Basically, isInMainFile considers line markers, and isWrittenInMainFile
doesn't. Distinguishing between the two is useful when dealing with
files which are preprocessed files or rewritten with -frewrite-includes
(so we don't, for example, print useless warnings).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e7205c0e2472dd66238f4c6b6db1b7cc2957b42a 10-Aug-2013 Robert Wilhelm <robert.wilhelm@gmx.net> Omit llvm:: before SmallVector and SmallVectorImpl. We have using directive in include/clang/Basic/LLVM.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
541a28f4eed4b2d8c057d5c51142d176c9c561de 09-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> Put back a microoptimization with a comment to make it more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
47abb25dda5cb9d5cd340809549dffdc41ca74bf 08-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> Remove unused variable. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0e2189791acf7fcec4f1b32af24efb2d363f30c1 05-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++'s restrictions on the type of an expression passed to a vararg
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).

Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6f4f8083931a92f9959168d4430da7ddf9183100 03-Aug-2013 Craig Topper <craig.topper@gmail.com> Add support for passing -1 to __builtin_shufflevector to signify an undefined element value to match IR capabilities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b61c294a24324ca0a403df770c01e0ba0b88770b 02-Aug-2013 Craig Topper <craig.topper@gmail.com> Fix indentation. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187644 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b793f0d3448a15277cd6b6cc4ba558ded39a8084 01-Aug-2013 Tim Northover <tnorthover@apple.com> AArch64: initial NEON support

Patch by Ana Pazos

- Completed implementation of instruction formats:
AdvSIMD three same
AdvSIMD modified immediate
AdvSIMD scalar pairwise

- Completed implementation of instruction classes
(some of the instructions in these classes
belong to yet unfinished instruction formats):
Vector Arithmetic
Vector Immediate
Vector Pairwise Arithmetic

- Initial implementation of instruction formats:
AdvSIMD scalar two-reg misc
AdvSIMD scalar three same

- Intial implementation of instruction class:
Scalar Arithmetic

- Initial clang changes to support arm v8 intrinsics.
Note: no clang changes for scalar intrinsics function name mangling yet.

- Comprehensive test cases for added instructions
To verify auto codegen, encoding, decoding, diagnosis, intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187568 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bbe759cf95a5df5497549abadb56282939868da1 29-Jul-2013 Craig Topper <craig.topper@gmail.com> Return ExprError if both arguments to the mask form of __builtin_shufflvector don't have the same number of elements or the mask isn't an integer vector.

Previously a diagnostic was issued, but the code went ahead and built the ShuffleVectorExpr. While I'm here also simplify a couple lines by wrapping the return ExprError around the Diag calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b44545aa3419eba3c5ad5fe5e30d534f27cfcb46 28-Jul-2013 Craig Topper <craig.topper@gmail.com> Fix up formatting. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e3fbbe9a486c4c8709726d8c79af33140eb02e53 19-Jul-2013 Craig Topper <craig.topper@gmail.com> Remove trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
09df2b066221d869f17f4b5762405f111a65f983 16-Jul-2013 Tim Northover <tnorthover@apple.com> ARM: implement low-level intrinsics for the atomic exclusive operations.

This adds three overloaded intrinsics to Clang:
T __builtin_arm_ldrex(const volatile T *addr)
int __builtin_arm_strex(T val, volatile T *addr)
void __builtin_arm_clrex()

The intent is that these do what users would expect when given most sensible
types. Currently, "sensible" translates to ints, floats and pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5154dce6388e3aaa445467030df7a45ed1211abe 11-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a __builtin_addressof that performs the same functionality as the built-in
& operator (ignoring any overloaded operator& for the type). The purpose of
this builtin is for use in std::addressof, to allow it to be made constexpr;
the existing implementation technique (reinterpret_cast to some reference type,
take address, reinterpert_cast back) does not permit this because
reinterpret_cast between reference types is not permitted in a constant
expression in C++11 onwards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
09bddcf8c0ce4cc2f2a18e050e971539e8a396f8 08-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix Sema for compares with _Atomic vars.

Use UsualArithmeticConversions unconditionally in analysis of
comparisons and conditional operators: the method performs
the usual arithmetic conversions if both sides are arithmetic, and
usual unary conversions if they are not. This is just a cleanup
for conditional operators; for comparisons, it fixes the issue that
we would try to check isArithmetic() on an atomic type.

Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables
of atomic type correctly.

Fixes PR15537.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4cb3d909cb4af5efc073fd4122d4998c466a220e 06-Jul-2013 Sylvestre Ledru <sylvestre@debian.org> Remove some useless declarations (found by scan-build)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0c0b3909d11de7440d77556089516918b9c04cef 30-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Teach -Wunsequenced that the side-effects of a function evaluation are sequenced
before the value computation of the result. In C, this is implied by there being
a sequence point after their evaluation, and in C++, it's implied by the
side-effects being sequenced before the expressions and statements in the
function body.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185282 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
418dd3eb3e813235af089b5c88182941f8a03d20 27-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment's
side-effect is not sequenced before its value computation. Also fix a
mishandling of ?: expressions where the condition is constant that was
exposed by the tests for this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8c0501c7370d894a735692b92fab62bbb05d86bd 24-Jun-2013 Reid Kleckner <reid@kleckner.net> [Sema] Call CheckParmForFunctionDef on ObjC method parameters

CheckParmForFunctionDef performs standard checks for type completeness
and other things like a destructor check for the MSVC++ ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184740 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0538f0e9200df56974b5a71bc276dbce456e9781 22-Jun-2013 Richard Trieu <rtrieu@google.com> Extend -Wnon-pod-varargs to more cases, such as function pointers as return
types and function pointer arrays.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c8fa525b5b81eeb7a62294dd3218ca2a6ccf0a6a 22-Jun-2013 David Blaikie <dblaikie@gmail.com> Provide suggested no-arg calls for overloaded member functions missing calls

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9b60195ad4843c9e2e231673a0dbc0d5c8c6eb2b 21-Jun-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Destroy temporary record arguments in the callee

Itanium destroys them in the caller at the end of the full expression,
but MSVC destroys them in the callee. This is further complicated by
the need to emit EH-only destructor cleanups in the caller.

This should help clang compile MSVC's debug iterators more correctly.
There is still an outstanding issue in PR5064 of a memcpy emitted by the
LLVM backend, which is not correct for C++ records.

Fixes PR16226.

Reviewers: rjmccall

Differential Revision: http://llvm-reviews.chandlerc.com/D929

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a4993778f65212f01168c857cf3043e99ba85c9f 21-Jun-2013 Richard Trieu <rtrieu@google.com> Add back a condition accidentially removed in r184470.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
674700516fb7ef0277fbb2a01f56f0c2fa8e7ce5 21-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Avoid repeatedly evaluating subexpressions when checking for unsequenced
operations in the case where evaluating a subexpression fails. No functionality
change, but test/Sema/many-logical-ops.c gets ~100x faster with this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f462b0152f10eed0b989b07bcf457b6fb0d83bdb 20-Jun-2013 Richard Trieu <rtrieu@google.com> Extend -Wnon-pod-varargs to check calls made from function pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2243e78a6580ead4d17b76c924cd4b630b50d6ae 18-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Correctly compute the index of the first string format argument when deciding
whether to emit a -Wformat-security warning. <rdar://problem/14178260>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f9eaf98bf524f7e2dcb9875a9f4afd9e25fc615d 08-Jun-2013 David Majnemer <david.majnemer@gmail.com> Revert "Properly consider the range of enum for range comparisons in C mode"

The approach r183084 took was wrong, back it out.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ad69e0cc6590f2d208fa863c48697563960e4a61 02-Jun-2013 David Majnemer <david.majnemer@gmail.com> Properly consider the range of enum for range comparisons in C mode

In some cases, clang applies the C++ rules for computing the range of a
value when said value is an enum.

Instead, apply C semantics when in C mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
538bbe597b935a74d95c668ad209536753f13481 28-May-2013 Fariborz Jahanian <fjahanian@apple.com> Patch to issue error when target of MacOS and iOS
does not support large load/store of atomic objects.
// rdar://13973577


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b07d448a625d7399d871079d55491c6b10316e6f 25-May-2013 Nico Weber <nicolasweber@gmx.de> Warn on va_start() when called with a reference parameter.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf 18.7p3
explicitly calls this (and some other things) out as undefined.

Also move 2 other existing warnings behind the new -Wvarargs flag.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a1bfe1ceeb633fe955bcaf218a101106ad97fc74 16-May-2013 Fariborz Jahanian <fjahanian@apple.com> Objective-C: More cases of -Wsign-conversion not
working on new Objective-C array subscripting
syntax. // rdar://13855682


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6f2a9fa0f787d3023b643496e8c321bdb7a85fa0 15-May-2013 Fariborz Jahanian <fjahanian@apple.com> Objective-C: patch to issue the conversion
warning when property-dot syntax is used
with -Wsign-conversion. // rdar://13855394


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
993f43f24d7a45a5cd4678a3316b0852261fc5d4 06-May-2013 John McCall <rjmccall@apple.com> Grab-bag of bit-field fixes:

- References to ObjC bit-field ivars are bit-field lvalues;
fixes rdar://13794269, which got me started down this.
- Introduce Expr::refersToBitField, switch a couple users to
it where semantically important, and comment the difference
between this and the existing API.
- Discourage Expr::getBitField by making it a bit longer and
less general-sounding.
- Lock down on const_casts of bit-field gl-values until we
hear back from the committee as to whether they're allowed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
287f24d3991994b9a263af9e2a873f4feadfb8fa 05-May-2013 Dmitri Gribenko <gribozavr@gmail.com> ArrayRef'ize Sema::CheckObjCMethodCall

Patch by Robert Wilhelm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5543169296beeb183b9c9392debc774fcf493eeb 05-May-2013 Dmitri Gribenko <gribozavr@gmail.com> Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef constructor from None

Patch by Robert Wilhelm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d237d2e6b85a74f31c986dc585fa6c39733b74a2 30-Apr-2013 Fariborz Jahanian <fjahanian@apple.com> c language: diagnose use of "[*]" on any array dimension
in the parameter of a function definition. Currently,
it crashes in irgen if it is on other than the 1st dimension.
// rdar://13705391


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
02be968a08184acd42aaefa6f9a7dc883a4d1937 10-Apr-2013 Ted Kremenek <kremenek@apple.com> Handle "typeof" in Objective-C format string checking. This previously crashed.

Yes, this came from actual code.

Fixes <rdar://problem/13557053>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179155 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dff2be8ba441f5c61af8444479f7133b22dcfcf4 29-Mar-2013 Timur Iskhodzhanov <timurrrr@google.com> Revert r178273 as it broke the Linux bootstrap due to false positives

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
25ffbef84450f0c666957a2d00cdf928c61b44d7 28-Mar-2013 Sam Panzer <espanz@gmail.com> Implemented a warning when an input several bitwise operations are
likely be implicitly truncated:

* All forms of Bitwise-and, bitwise-or, and integer multiplication.
* The assignment form of integer addition, subtraction, and exclusive-or
* The RHS of the comma operator
* The LHS of left shifts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6edb029026d290f12393ed8389a3e1de596c77ec 25-Mar-2013 Ted Kremenek <kremenek@apple.com> For printf checking, handle nested typedefs for darwin-specific checking.

Fixes <rdar://problem/13491605>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9de50947ba381561a5236b3c878c83e4bb8c1088 15-Mar-2013 Ted Kremenek <kremenek@apple.com> Simplify print logic, per feedback from Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7adf3a9f84688f334a1cd977317bb42f9e06c9f4 15-Mar-2013 Ted Kremenek <kremenek@apple.com> Enhance -Wtautological-constant-out-of-range-compare to include the name of the enum constant.

This is QoI. Fixes <rdar://problem/13076064>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1fd8d46d222fab7f17b91846e2c50bef640a60a0 15-Mar-2013 Fariborz Jahanian <fjahanian@apple.com> c: perform integer overflow check on all binary
operations. // rdar://13423975


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a30bab4b5d421fb148a732da31621cffe51519ee 15-Mar-2013 Fariborz Jahanian <fjahanian@apple.com> c: Also chek for integer overflow for '%' operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2cd889d6d97db0cf73930873871aa4a542e84b89 15-Mar-2013 Fariborz Jahanian <fjahanian@apple.com> c: add the missing binary operatory when checking
for integer overflow. // rdar://13423975


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
83972f128e9218c051692bf96361327a701aeb79 09-Mar-2013 John McCall <rjmccall@apple.com> Add TagDecl::hasNameForLinkage(), which is true if the tag
is non-anonymous or is defined in a typedef of itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fc09336a5965040736f9bc63a70416003972364e 01-Mar-2013 Stefanus Du Toit <stefanus.dutoit@rapidmind.com> Fix typos: [Dd]iagnosic -> [Dd]iagnostic

These all appear in comments or (ironically) diagnostics output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dc84cd5efdd3430efb22546b4ac656aa0540b210 20-Feb-2013 David Blaikie <dblaikie@gmail.com> Include llvm::Optional in clang/Basic/LLVM.h

Post-commit CR feedback from Jordan Rose regarding r175594.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
39e6ab4be93d9c5e729a578ddd9d415cd2d49872 18-Feb-2013 David Blaikie <dblaikie@gmail.com> Replace TypeLoc llvm::cast support to be well-defined.

The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
896c7dd62801c0aacf14b05183c3c471c1fe9f7a 16-Feb-2013 David Blaikie <dblaikie@gmail.com> Don't warn on conversion from NULL to nullptr_t

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3f6f51e28231f65de9c2dd150a2d757b2162cfa3 08-Feb-2013 Jordan Rose <jordan_rose@apple.com> Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.

Nearly all of these changes are one-to-one replacements; the few that
aren't have to do with custom identifier validation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5e25301c24c92a9b7018cee20e524c4eb7192bf0 06-Feb-2013 Chad Rosier <mcrosier@apple.com> Use a dyn_cast to avoid a crash when the TypeLoc is not a ConstantArrayTypeLoc.
rdar://13153516


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cb5620c9b213f4bd323912159fdddda35e258a14 30-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support

This is required to use them in TableGen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7adf4179f827b14b025135829dadeaa2442e1d42 30-Jan-2013 Fariborz Jahanian <fjahanian@apple.com> c: When checking on validity of sizeof passed as size of
argument to be memset, check for its type to be complete
before calling Context.getTypeSize(PointeeTy) to prevent
crash. // rdar://13081751.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ad48a500596d7d678b99c7f94326cfa856c3b49f 24-Jan-2013 Fariborz Jahanian <fjahanian@apple.com> Patch to check for integer overflow. It has been
commented on and approved by Richard Smith.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3edf387e4338ff98d9874b4c1b41d787e49d6c2b 23-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Make __attribute__((nonnull)) use the general expression evaluator to search for
nulls instead of limiting itself to the language-defined "null pointer
constant".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173227 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1a2dcd55a1924b46c919474390a3f0cdf2cebeb0 18-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Defer checking for unsequenced operations on the RHS of && and || in order to
reduce stack usage and hopefully bring back the linux x86_64 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
995e4a7530d705147c875b63608532c483c011a8 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> -Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
unsequenced operations in the RHS. We don't compare the RHS with the rest of
the expression yet; such checks will need care to avoid diagnosing unsequenced
operations which are both in conditionally-evaluated subexpressions which
actually can't occur together, such as in '(b && ++x) + (!b && ++x)'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e5096c8f2f2e64d5ac98531ff9aa952bbe60d5fc 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Attempt to work around bug in older GCCs to fix buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6c3af3d0e3e65bcbca57bfd458d684941f6d0531 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn on
expressions which have undefined behavior due to multiple unsequenced
modifications or an unsequenced modification and use of a variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1c030e9a3f290a1eea5de82fe1e63dfde2bd8f1e 13-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> ArrayRef'ize Sema APIs related to format string checking


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
80ad52f327b532bded5c5b0ee38779d841c6cd35 02-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> s/CPlusPlus0x/CPlusPlus11/g


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d3292c88ad6360823818b78d67875eceb3caedfb 21-Dec-2012 Ted Kremenek <kremenek@apple.com> Tweak Sema::CheckLiteralKind() to also include block literals

This simplifies some diagnostic logic in checkUnsafeAssignLiteral(),
hopefully making it less error prone.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f530ff76de3b270f2287d3555d93b5d270643eeb 21-Dec-2012 Ted Kremenek <kremenek@apple.com> Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().

Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses
in boxed expressions for purpose of classification.

In other words, both @42 and @(42) should be classified as numeric
literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e63a603c797b1a83c844923fb17dc31b4d96a031 21-Dec-2012 Ted Kremenek <kremenek@apple.com> Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b29b30f9631937916786dc2e06c2842acf9c1500 21-Dec-2012 Ted Kremenek <kremenek@apple.com> Sink call to checkUnsafeAssignLiteral() into checkUnsafeAssignObject().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
87aa2fbc75a897e7c4a4082374aaba3f50db6f0f 21-Dec-2012 Roman Divacky <rdivacky@freebsd.org> Remove duplicate includes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9d0840141a0922e2d8b1d322f21ef51803ede23d 21-Dec-2012 Ted Kremenek <kremenek@apple.com> Extend checkUnsafeAssigns() to also handle assigning an object literal to a weak reference.

Thanks to Jordan Rose and John McCall for their sage code review.

Fixes <rdar://problem/12569201>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b1ea510de0ef4ebfbbe8fa7668ab1635410fc080 21-Dec-2012 Ted Kremenek <kremenek@apple.com> Refactor checkUnsafeAssigns() to avoid code duplication with while loop.

This is just a minor bit of refactoring, but it is nice cleanup for
the subsequent patch that adds warning support for assigning literals
to weak variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ad017fa7a4df7389d245d02a49b3c79ed70bedb9 20-Dec-2012 Bill Wendling <isanbard@gmail.com> Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
094dbf917127a1228147587076d59ca45b7c258d 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2cd3440369d9241173e994485ddf2589a50a7d80 05-Dec-2012 Jordan Rose <jordan_rose@apple.com> Format strings: offer a cast to 'unichar' for %C in Objective-C contexts.

For most cases where a conversion specifier doesn't match an argument,
we usually guess that the conversion specifier is wrong. However, if
the argument is an integer type and the specifier is %C, it's likely
the user really did mean to print the integer as a character.

(This is more common than %c because there is no way to specify a unichar
literal -- you have to write an integer literal, such as '0x2603',
and then cast it to unichar.)

This does not change the behavior of %S, since there are fewer cases
where printing a literal Unicode *string* is necessary, but this could
easily be changed in the future.

<rdar://problem/11982013>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169400 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
17ddc54b8b94c58286dec6f99ae1f9e12e30d297 05-Dec-2012 Jordan Rose <jordan_rose@apple.com> Format strings: add more expression types that don't need parens to cast.

No functionality change (the test change is a comment only, and the new
functionality can't be tested using the current test).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
448ac3e6d1f10264cea86c89cc14c266ba2da4a2 05-Dec-2012 Jordan Rose <jordan_rose@apple.com> Format strings: a character literal should be printed with %c, not %d.

The type of a character literal is 'int' in C, but if the user writes a
character /as/ a literal, we should assume they meant it to be a
character and not a numeric value, and thus offer %c as a correction
rather than %d.

There's a special case for multi-character literals (like 'MooV'), which
have implementation-defined value and usually cannot be printed with %c.
These still use %d as the suggestion.

In C++, the type of a character literal is 'char', and so this problem
doesn't exist.

<rdar://problem/12282316>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169398 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d87de7bdbc25dd84ae3dbefffda4539c443000d2 01-Dec-2012 Eli Friedman <eli.friedman@gmail.com> Make -Wtautological-constant-out-of-range-compare behave sanely for enums with a signed fixed type.
<rdar://problem/12780159>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0c5d005cd383e2d8c2bea388419ac26ace12e0f0 20-Nov-2012 David Blaikie <dblaikie@gmail.com> Fix some trailing whitespace (on a blank line) to cycle/test bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8f50b24c8b17368f68c2e71240d487dde53f6da8 16-Nov-2012 Richard Trieu <rtrieu@google.com> Take into account the zero sign bit for positive numbers when computing the bit
width of an enum with negative values in IntRange. Include a test for
-Wtautological-constant-out-of-range-compare where this had manifested.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5d1cf4f292cb060b1973eb197607fc6d5716bd12 15-Nov-2012 Richard Trieu <rtrieu@google.com> Fix an off-by-one error by switching < to <= in -Wtautological-constant-out-of-range-compare and added test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
526e627d2bd7e8cbf630526d315c90864898d9ff 14-Nov-2012 Richard Trieu <rtrieu@google.com> Improve -Wtautological-constant-out-of-range-compare by taking into account
type conversion between integers. This allows the warning to be more accurate.

Also, turned the warning off in an analyzer test. The relavent test cases
are covered by the tests in Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e81b43bc306d361fcf4d411aeb14b43f8464bf4a 08-Nov-2012 David Blaikie <dblaikie@gmail.com> PR14284: crash on ext-valid returning NULL from a void function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b57ce4e8918656f5f4070f59d74354fcefbbb6f8 03-Nov-2012 Dmitri Gribenko <gribozavr@gmail.com> Address review comments for r167358: explicitly check for CK_BitCast instead of
checking against a blacklist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5a24980d059cd9fbe8375a4c549313101ad20698 03-Nov-2012 Dmitri Gribenko <gribozavr@gmail.com> Handle CK_NullToPointer casts in -Wtype-safety properly. Fixes PR14249.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0234bfa2b03470b8ce379a7485e60ffa35c1d550 11-Oct-2012 Ted Kremenek <kremenek@apple.com> Add null check for malformed code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
df75b0c74b277c6b46af2f9e90e13160fbc14d6f 11-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Minor cleanup for r165678; no functional change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2edcde8747a000113b434a5c88b4648beed4197b 11-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Make sure we perform the variadic method check correctly for calls to a member operator(). PR14057.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d13eff6f77216a6fb25e18f600b492db4f0492e8 02-Oct-2012 Ted Kremenek <kremenek@apple.com> Check if an IdentifierInfo* is null when the FunctionDecl isn't a simple C function.

Fixes <rdar://problem/12355298>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
66360e224689dc23a0acd8a6705ba50bec13bc97 02-Oct-2012 Jordan Rose <jordan_rose@apple.com> -Wformat: Don't check format strings in uninstantiated templates.

Also applies to -Wnonnull, -Wtype-safety, and -Wnon-pod-varargs.
All of these can be better checked at instantiation time.

This change does not actually affect regular CallExpr function calls,
since the checks there only happen after overload resolution.
However, it will affect Objective-C method calls.

<rdar://problem/12373934>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7a2704800943fbb69207e125d28186278712af36 29-Sep-2012 Jordan Rose <jordan_rose@apple.com> -Warc-repeated-use-of-weak: check ivars and variables as well.

Like properties, loading from a weak ivar twice in the same function can
give you inconsistent results if the object is deallocated between the
two loads. It is safer to assign to a strong local variable and use that.

Second half of <rdar://problem/12280249>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f3477c13eeaf11b32a41f181398fb5deffd0dd73 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
94ff8e1f57c6382d91d0de981a4f311509d83e37 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2ad11cd666f8e80463b5fd155072633f8e1283a4 22-Sep-2012 Abramo Bagnara <abramo.bagnara@bugseng.com> Avoid multiple atomic builtin declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a193f20916f0e0e5a3b0f76ca69e2b3870c1a325 20-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> Improvements to my patch in r164143 per
Richard's comments. // rdar://12202422


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ab4702febef82409773f7c80ec02d53ddbb4d80e 18-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> minor refactoring of my last check-in.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
15a9356464f0809e1cb24aa3a7cc2577914ff5bb 18-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> c: warn when an integer value comparison with an
integral expression have the obvious result.
Patch reviewed by John McCall off line.
// rdar://12202422


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1fac58a2ff3c56a18765b2c7395ed91ac7b80544 17-Sep-2012 Jordan Rose <jordan_rose@apple.com> -Warc-retain-cycles: look through [^{...} copy] and Block_copy(^{...})

Retain cycles happen in the case where a block is persisted past its
life on the stack, and the way that occurs is by copying the block.
We should thus look through any explicit copies we see.

Note that Block_copy is actually a type-safe wrapper for _Block_copy,
which does all the real work.

<rdar://problem/12219663>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bc57b108b2253e26b83768dba196c28564952f18 15-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> const _Atomic(T) is not an atomic type, so do not allow it as the type 'A' in
C11 7.17's atomic operations. GNU's __atomic_* builtins do allow const-qualified
atomics, though (!!) so don't restrict those.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e10f4d384f5ae113d72a5193a1332c1930635ccc 15-Sep-2012 Jordan Rose <jordan_rose@apple.com> -Warc-retain-cycles: warn at variable initialization as well as assignment.

Specifically, this should warn:

__block block_t a = ^{ a(); };

Furthermore, this case which previously warned now does not, since the value
of 'b' is captured before the assignment occurs:

block_t b; // not __block
b = ^{ b(); };

(This will of course warn under -Wuninitialized, as before.)

<rdar://problem/11015883>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
670941c28c0683ecc251dafdf093a71629625dc9 13-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: offer a fixit for Darwin's %D/%U/%O to ISO %d/%u/%o.

<rdar://problem/12061922>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163772 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
275b6f52c7bcafc1f3cf291813b5c60ee776965a 13-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: %D, %U, and %O are valid on Darwin (same as %d, %u, %o).

These will warn under -Wformat-non-iso, and will still be rejected
outright on other platforms.

<rdar://problem/12061922>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8be066e6733364cd34f25c4f7b7344f72aa23369 08-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: suggest %lld instead of %qd and %Ld with -Wformat-non-iso.

As a corollary to the previous commit, even when an extension is
available, we can still offer a fixit to the standard modifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bbb6bb4952b77e57b842b4d3096848123ae690e7 08-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: %Ld isn't available on Darwin or Windows.

This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.

<rdar://problem/11518237>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
31ba6135375433b617a8587ea6cc836a014ebd86 06-Sep-2012 Roman Divacky <rdivacky@freebsd.org> Dont cast away const needlessly. Found by gcc48 -Wcast-qual.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ec08735e1b6a51c11533311b774bf6336c0a5d63 06-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format strings: suggest casts for NS(U)Integer and [SU]Int32 on Darwin.

These types are defined differently on 32-bit and 64-bit platforms, and
trying to offer a fixit for one platform would only mess up the format
string for the other. The Apple-recommended solution is to cast to a type
that is known to be large enough and always use that to print the value.

This should only have an impact on compile time if the format string is
incorrect; in cases where the format string matches the definition on the
current platform, no warning will be emitted.

<rdar://problem/9135072&12164284>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163266 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
614a8656279b6549750e83143635cec63ac0e8b7 06-Sep-2012 Jordan Rose <jordan_rose@apple.com> Format string checking: change long if-statement to early returns.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7e2e4c33cdd347d0f3faac3e391245d06fa42811 31-Aug-2012 Fariborz Jahanian <fjahanian@apple.com> objective-C ARC; detect and warn on retain cycle when
property-dot syntax is used on an object whose
capture causes retain cycle. // rdar://11702054


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a6c66cedc022c9e5d45a937d6b8cff491a6bf81b 31-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call. Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
88617a24adafed42e33d196972f97c72d9a5e0a0 28-Aug-2012 Hans Wennborg <hans@hanshq.net> Warn about suspicious implicit conversions from floating point to bool

This warns in two specific situations:

1) For potentially swapped function arguments, e.g.

void foo(bool, float);
foo(1.7, false);

2) Misplaced brackets around function call arguments, e.g.

bool InRange = fabs(a - b < delta);

Where the last argument in a function call is implicitly converted
from bool to float, and the function returns a float which gets
implicitly converted to bool.

Patch by Andreas Eckleder!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162763 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
be22cb84f32cfa6cf0b6bdaf523288b747bb0f18 27-Aug-2012 Simon Atanasyan <satanasyan@mips.com> Support MIPS DSP Rev2 intrinsics.
The patch reviewed by Akira Hatanaka.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162669 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3b6bef9a213249c6ab6d67c07b1ac6380961be3e 24-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Push ArrayRef through the Expr hierarchy.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162552 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3fe198bf0d6118c7b080c17c3bb28d7c84e458b9 23-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Rip out remnants of move semantic emulation and smart pointers in Sema.

These were nops for quite a while and only lead to confusion. ASTMultiPtr
now behaves like a proper dumb array reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
70517ca5c07c4b41ff8662b94ee22047b0299f8c 23-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix a bunch of -Wdocumentation warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0d5a069f66df09b3308ccfdce84a88170034c657 17-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Add support for "type safety" attributes that allow checking that 'void *'
function arguments and arguments for variadic functions are of a particular
type which is determined by some other argument to the same function call.

Usecases include:
* MPI library implementations, where these attributes enable checking that
buffer type matches the passed MPI_Datatype;
* for HDF5 library there is a similar usecase as MPI;
* checking types of variadic functions' arguments for functions like
fcntl() and ioctl().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d1420c6fa788669e49f21e184927c7833881e399 16-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Store SourceManager pointer on PrintingPolicy in the case where we're dumping,
and remove ASTContext reference (which was frequently bound to a dereferenced
null pointer) from the recursive lump of printPretty functions. In so doing,
fix (at least) one case where we intended to use the 'dump' mode, but that
failed because a null ASTContext reference had been passed in.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f8ee6bc1ef0eec8e22b413dfc2baa3cfa4f19f91 14-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix undefined behavior (and wrong code, as far as I can tell) in NEON builtin
tablegen code, found by -fcatch-undefined-behavior. I would appreciate if
someone more familiar with the NEON code could point me in the direction of how
to write a test for this. We appear to have essentially no test coverage
whatsoever for these builtins.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161827 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0f38acee92014cb15af980808f87144e5564031d 08-Aug-2012 Anna Zaks <ganna@apple.com> Address code review comments for Wstrncat-size warning (r161440).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
58e1e54476d610d6c33ef483f216ed8a1282d35c 07-Aug-2012 Hans Wennborg <hans@hanshq.net> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f3749f4168c5cee59627a681ca4ca6e4116d0761 07-Aug-2012 Hans Wennborg <hans@hanshq.net> Rename analyze_format_string::ArgTypeResult to ArgType

Also remove redundant constructors and unused member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
71f55f771794674a410171dbf3cb5dbedf95d033 07-Aug-2012 David Blaikie <dblaikie@gmail.com> Refactor checks for unevaluated contexts into a common utility function.

The one caller that's surrounded by nearby code manipulating the underlying
evaluation context list is left unmodified for readability.

Review by Sean Silva and Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
78a1b196cc6854a29c0ff2d6ea5f5643be6040c6 30-Jul-2012 Matt Beaumont-Gay <matthewbg@google.com> Do not warn on correct use of the '%n' format specifier.

While '%n' can be used for evil in an attacker-controlled format string, there
isn't any acute danger in using it in a literal format string with an argument
of the appropriate type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cec9ce49dcf4b4b768043f96c8ef8c1d4cdbb6b9 30-Jul-2012 Hans Wennborg <hans@hanshq.net> 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e1ecdc168175719d74e112bcacd4aae5e12d4631 23-Jul-2012 Richard Trieu <rtrieu@google.com> Change APInt to APSInt in one instance. Also change a call to operator==() to
APSInt::isSameValue() when comparing different sized APSInt's.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bed28ac1d1463adca3ecf24fca5c30646fa9dbb2 23-Jul-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo (the the => the)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ddcfbc9ad1817f545610999d655ac6c28d4c0c12 19-Jul-2012 Jordan Rose <jordan_rose@apple.com> For varargs, diagnose passing ObjC objects by value like other non-POD types.

While we still want to consider this a hard error (non-POD variadic args are
normally a DefaultError warning), delaying the diagnostic allows us to give
better error messages, which also match the usual non-POD errors more closely.

In addition, this change improves the diagnostic messages for format string
argument type mismatches by passing down the type of the callee, so we can
say "variadic method" or "variadic function" appropriately.

<rdar://problem/11825593>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
48716663e421472cbd590af160a372bc490205e8 19-Jul-2012 Jordan Rose <jordan_rose@apple.com> Don't crash checking a format string if one of the arguments is invalid.

Previously, we would ask for the SourceLocation of an argument even if
it were NULL (i.e. if Sema resulted in an ExprError trying to build it).

<rdar://problem/11890818>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
980343b9a1d0e85f960fa289c2c9a727004964f2 16-Jul-2012 David Blaikie <dblaikie@gmail.com> Simplify float comparison checks by using early return.

Found while investigating PR13330

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fad0a32da8ea34a58aa0a0dd3fd67cd30959b080 08-Jul-2012 Simon Atanasyan <satanasyan@mips.com> MIPS: Range check __builtin_mips_wrdsp / __builtin_mips_rddsp arguments against the upper/lower values.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bd2e27e8484c1d378c9c9d089f61ff496627f391 06-Jul-2012 Fariborz Jahanian <fjahanian@apple.com> objc-arc: warn when assigning retained object to
a 'weak' property just as we do the same for
'weak' variables. // rdar://11814185


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
592a4230c6e91fead00d605f6155080544cdf8c9 29-Jun-2012 Douglas Gregor <dgregor@apple.com> When a builtin that requires a constant is given a type- or
value-dependent expression, don't complain that it wasn't the constant
we wanted. Fixes <rdar://problem/11688587> and PR11074.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159404 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
831421f24057b93ea28bc92d8bd6290631a43caf 25-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r158887, reverted in r158949, along with a fix for the bug which
resulted in it being reverted. A test for that bug was added in r158950.

Original comment:

If an object (such as a std::string) with an appropriate c_str() member function
is passed to a variadic function in a position where a format string indicates
that c_str()'s return type is desired, provide a note suggesting that the user
may have intended to call the c_str() member.

Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and
move it to SemaChecking in order to facilitate this. Factor the call checking
out of function call checking and block call checking, and extend it to cover
constructor calls too.

Patch by Sam Panzer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159159 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4e294eea2c8a8965e24682ed9da8944969830813 22-Jun-2012 Rafael Espindola <rafael.espindola@gmail.com> Revert r158887. This fixes pr13168.

Revert "If an object (such as a std::string) with an appropriate c_str() member function"

This reverts commit 7d96f6106bfbd85b1af06f34fdbf2834aad0e47e.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
28a5f0cdfcc927a94c1bda6a225200762df22411 21-Jun-2012 David Blaikie <dblaikie@gmail.com> PR13165: False positive when initializing member data pointers with NULL.

This now correctly covers, I believe, all the pointer types:
* 'any' pointers (both function and data normal pointers and ObjC object pointers)
* member pointers (both function and data)
* block pointers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7d96f6106bfbd85b1af06f34fdbf2834aad0e47e 21-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> If an object (such as a std::string) with an appropriate c_str() member function
is passed to a variadic function in a position where a format string indicates
that c_str()'s return type is desired, provide a note suggesting that the user
may have intended to call the c_str() member.

Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and
move it to SemaChecking in order to facilitate this. Factor the call checking
out of function call checking and block call checking, and extend it to cover
constructor calls too.

Patch by Sam Panzer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b26331b4ff419b22861b0823daf83bc8f22a6803 19-Jun-2012 David Blaikie <dblaikie@gmail.com> Enable -Wnull-conversion for non-integral target types (eg: double).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
860a319e62b0e256817a458396d191aa91c0787a 16-Jun-2012 Eli Friedman <eli.friedman@gmail.com> Fix Sema and IRGen for atomic compound assignment so it has the right semantics when promotions are involved.
(As far as I can tell, this only affects some edge cases.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
df9ef1bc8c3780307ab2ed81bf5e31c23310b936 13-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13099: Teach -Wformat about raw string literals, UTF-8 strings and Unicode escape sequences.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
50687314f87b67073c202fe46d84d12fb55e25cf 05-Jun-2012 Jordan Rose <jordan_rose@apple.com> Teach format string checking about compile-time CFString constants.

Within the guts of CheckFormatHandler, the IsObjCLiteral flag was being used in
two ways: to see if null bytes were allowed, and to see if the '%@' specifier
is allowed.* The former usage has been changed to an explicit test and the
latter pushed down to CheckPrintfHandler and renamed ObjCContext, since it
applies to CFStrings as well.

* This also changes how wide chars are interpreted; in OS X Foundation, the
wide character type is 'unichar', a typedef for short, rather than wchar_t.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ee0259d308e72141982a85b40863e760a8447edf 05-Jun-2012 Jordan Rose <jordan_rose@apple.com> Teach printf/scanf about enums with fixed underlying types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
90c78328e70cb376754edf87708505a84c044271 31-May-2012 Anna Zaks <ganna@apple.com> Change wording of 'memcpy' type mismatch warning and remove fixit.

As per comments following r157659.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6fcb3727e31280ba816dc86d024586b8c5933c13 30-May-2012 Anna Zaks <ganna@apple.com> Add fixits for memory access warnings.
Also, do not display the builtin name and macro expansion when the
function is a builtin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
abf145ab57fc56bfb9c48333fcc65b49a564dc60 17-May-2012 Matt Beaumont-Gay <matthewbg@google.com> Use the argument location instead of the format string location when warning
about argument type mismatch.

This gives a nicer diagnostic in cases like
printf(fmt,
i);
where previously the snippet just pointed at 'fmt' (with a note at the
definition of fmt).

It's a wash for cases like
printf("%f",
i);
where previously we snippeted the offending portion of the format string,
but didn't indicate which argument was at fault.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9fb1ac520d1806ba2b069f6087f40fc9c704b067 15-May-2012 David Blaikie <dblaikie@gmail.com> Don't warn when NULL is used within a macro but its conversion is outside a macro.

This fixes the included test case & was reported by Nico Weber.

It's a little bit nasty using the difference in the conversion context, but
seems to me like a not unreasonable solution. I did have to fix up the
conversion context for conditional operators (it seems correct to me to include
the context for which we're actually doing the comparison - across all the
nested conditionals, rather than the innermost conditional which might not
actually have the problematic implicit conversion at all) and template default
arguments (this is a bit of a hack, since we don't have the source location of
the '=' anymore, so I just used the start of the parameter - open to
suggestions there)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
de7e7b857c8c6f9dc7fecb18fcb947b003748d16 15-May-2012 David Blaikie <dblaikie@gmail.com> Changing std::string to SmallString for r156826.

Based on code review feedback by Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156827 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
be0ee875d8a91c031a085cbbd73ad9e8dc1aa8ff 15-May-2012 David Blaikie <dblaikie@gmail.com> Improve some of the conversion warnings to fire on conversion to bool.

Moves the bool bail-out down a little in SemaChecking - so now
-Wnull-conversion and -Wliteral-conversion can fire when the target type is
bool.

Also improve the wording/details in the -Wliteral-conversion warning to match
the -Wconstant-conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e2c60667d1bc29b7e148f9c9828dcbdbfc5b82b0 12-May-2012 Matt Beaumont-Gay <matthewbg@google.com> Merge branch 'format-string-braced-init'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156653 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
00e1f6f5fed4f33f67181578be0232accd342282 09-May-2012 Ted Kremenek <kremenek@apple.com> Teach IsTailPaddedMemberArray() (used by -Warray-bounds) that a FieldDecl may have a Typedef type, and not always a ConstantArrayType.

Fixes <rdar://problem/11387038>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dc1702001964c3314f7090e6a4af889b5771d884 04-May-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Inhibit ObjC format warning only in system headers (NSLocalizedString).
Add a test case for the related NSAssert workaround.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d2cf348f0df76bf1745f131db2ceeb59f23a7305 04-May-2012 Sean Callanan <scallanan@apple.com> IsTailPaddedMemberArray uses a FieldDecl's
getTypeSourceInfo() without checking for NULL.
FieldDecls may have NULL TypeSourceInfo, and in
fact some FieldDecls generated by Clang -- and
all FieldDecls generated by LLDB -- have no
TypeSourceInfo.

This patch makes IsTailPaddedMemberArray check
for NULL.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d10099e5c8238fa0327f03921cf2e3c8975c881e 04-May-2012 Douglas Gregor <dgregor@apple.com> Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()
off PartialDiagnostic. PartialDiagnostic is rather heavyweight for
something that is in the critical path and is rarely used. So, switch
over to an abstract-class-based callback mechanism that delays most of
the work until a diagnostic is actually produced. Good for ~11k code
size reduction in the compiler and 1% speedup in -fsyntax-only on the
code in <rdar://problem/11004361>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
392da48160bd92ceb486792780467cbfdb2d0e8c 04-May-2012 James Molloy <james.molloy@arm.com> Fix handling of wint_t - we can't assume wint_t is purely an integer 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156165 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c03f2df2a2b097bf2686bf32411d5022323988b2 03-May-2012 Bob Wilson <bob.wilson@apple.com> Disable -Wformat-extra-args for arguments defined in system headers.

Some of the NSAssert macros in OS X 10.7 are implemented in a way that
adds extra arguments that trigger the -Wformat-extra-args warning.
Earlier versions of clang failed to detect those -Wformat issues, but now
that clang is reporting those problems, we need to quiet them since there's
nothing to be done to fix them. <rdar://problem/11317765>

I don't know how to write a testcase for this. Suggestions welcome.
Patch by Ted Kremenek!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6d3b93d631640125f912339df19b0d2a15af5c9b 01-May-2012 Douglas Gregor <dgregor@apple.com> Turn the mixed-sign-comparison diagnostic into a runtime behavior
diagnostic, from Eitan Adler!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e720ce7a3b1c1bfa5f7482183caa6e31fca9a3fb 01-May-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> When going through references to check if the function returns the address
of a local variable, make sure we don't infinitely recurse when the
reference binds to itself.

e.g:

int* func() {
int& i = i; // assign non-exist variable to a reference which has same name.
return &i; // return pointer
}

rdar://11345441

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2c0abf4ae33ab2ba690ccae724b8d6f196e7cfda 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.

Reviewed by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e59392176c2369df2bdd11b7786cb38abac00198 28-Apr-2012 Julien Lerouge <jlerouge@apple.com> Currently __builtin_annotation() only annotates an i32.

i32 __builtin_annotation(i32, string);

Applying it to i64 (e.g., long long) generates the following IR.

trunc i64 {{.*}} to i32
call i32 @llvm.annotation.i32
zext i32 {{.*}} to i64

The redundant truncation and extension make the result difficult to use.

This patch makes __builtin_annotation() generic.

type __builtin_annotation(type, string);

For the i64 example, it simplifies the generated IR to:

call i64 @llvm.annotation.i64

Patch by Xi Wang!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155764 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
51b92401c9f95023a2ef27064fd5a60fd99175f5 13-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement __atomic_fetch_nand and __atomic_nand_fetch to complete our set of
GNU __atomic builtins.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
37050841d7b852497b85d5275d9ea92c07ddf059 13-Apr-2012 David Blaikie <dblaikie@gmail.com> Warn on 64-to-32 for source value of x bits where 64 >= x > 32.

The codepath already only works for source bits > target bits, it's just that
it was testing for the source expr bits to be exactly 64. This meant simple
cases (int i = x_long / 2) were missed & ended up under the general
-Wconversion warning, which a user might not have enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154626 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ff34d401ff385ef7173ca612432b4ea717fff690 12-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for 18 of the GNU-compatible __atomic builtins.

This is not quite sufficient for libstdc++'s <atomic>: we still need
__atomic_test_and_set and __atomic_clear, and may need a more complete
__atomic_is_lock_free implementation.

We are also missing an implementation of __atomic_always_lock_free,
__atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed
for libstdc++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fafbf06732746f3ceca21d452d77b144ba8652ae 11-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Provide, and document, a set of __c11_atomic_* intrinsics to implement C11's
<stdatomic.h> header.

In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6c656c3d89523d8ddd143f96e11f6bc16c10c60b 04-Apr-2012 Ted Kremenek <kremenek@apple.com> Remove dead assignment to local variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2ebb98a78471f2039af4321bae657e7daacc2a62 29-Mar-2012 David Chisnall <csdavec@swan.ac.uk> Pass parameters in the correct order when assembling an AtomicExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b1360498b0c0794fd7925f4bdac68ae91ff7493b 16-Mar-2012 David Blaikie <dblaikie@gmail.com> Suppress macro expansion of NULL in NULL warnings.

For "int i = NULL;" we would produce:

null.cpp:5:11: warning: implicit conversion of NULL constant to integer [-Wconversion]
int i = NULL;
~ ^~~~
null.cpp:1:14: note: expanded from macro 'NULL'
\#define NULL __null
^~~~~~

But we really shouldn't trace that macro expansion back into the header, yet we
still want macro back traces for code like this:

\#define FOO NULL
int i = FOO;

or

\#define FOO int i = NULL;
FOO

While providing appropriate tagging at different levels of the expansion, etc.

The included test case exercises these cases & does some basic validation (to
ensure we don't have macro expansion notes where we shouldn't, and do where we
should) - but doesn't go as far as to validate the source location/ranges
used in those notes and warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2b2bbee3071cee1b03520d9bf0c80c4f0bbe60eb 15-Mar-2012 David Blaikie <dblaikie@gmail.com> Provide the specific target type in the -Wnull-conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).

The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f4b88a45902af1802a1cb42ba48b1c474474f228 10-Mar-2012 John McCall <rjmccall@apple.com> Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context. I'm amenable to suggestions about the exact meaning
of this bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f85626453123f9691bcef13cff963f556e209c27 09-Mar-2012 Hans Wennborg <hans@hanshq.net> -Wformat-non-iso: warn about positional arguments (pr12017)

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
92b670e1ee0b11d7e558ec659795ddf452e583ed 27-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Fix a couple bugs in the way we handle array indexes in array bounds checking. Specifically, make sure we don't ignore explicit casts in indexes, and make sure we use unsigned extension/comparisons on indexes. Fixes <rdar://problem/10916006>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8b9414e868853fc052251455674bf7512261e14a 24-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Modernize some code which processes CastExprs to use CastKinds. No intended functional change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
76517426dc8bf7734c07eefc35171a6bfdba1a2b 22-Feb-2012 Hans Wennborg <hans@hanshq.net> Warn about non-standard format strings (pr12017)

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa 22-Feb-2012 Douglas Gregor <dgregor@apple.com> Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy)
the lambda closure itself. Some aspects of the block literal are left
unspecified, namely the capture variable (which doesn't actually
exist) and the body (which will be filled in by IRgen because it can't
be written as an AST).

Because we're switching to this model, this patch also eliminates
tracking the copy-initialization expression for the block capture of
the conversion function, since that information is now embedded in the
synthesized block literal. -1 side tables FTW.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f57c413e444b441fa75ae8911d183c19b53bdd56 21-Feb-2012 Jean-Daniel Dupas <devlists@shadowlab.org> When calling a non variadic format function(vprintf, vscanf, NSLogv, …), warn if the format string argument is a parameter that is not itself declared as a format string with compatible format.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
be6126a2a784e1446460b8d15c2b26f880c871fc 15-Feb-2012 Hans Wennborg <hans@hanshq.net> Make -Wformat fix-its preserve original conversion specifiers.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
625bb569df0c34feec0d52c0ec5215f21ef2e054 14-Feb-2012 Dmitri Gribenko <gribozavr@gmail.com> Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)

* if, switch, range-based for: warn if semicolon is on the same line.
* for, while: warn if semicolon is on the same line and either next
statement is compound statement or next statement has more
indentation.

Replacing the semicolon with {} or moving the semicolon to the next
line will always silence the warning.

Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a73cdcbc1dc1ed98c54556c6adcd2b12301759cc 10-Feb-2012 David Blaikie <dblaikie@gmail.com> Support all null pointer literals in format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e3d8e737e18f0ce95d87be03f74b35413443173c 10-Feb-2012 Ted Kremenek <kremenek@apple.com> Enhance checking for null format string literal to take into account __null. Fixes <rdar://problem/8269537>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
54042f1bd78f1f1ea86be7d4af541462e127d2ed 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement return type deduction for lambdas per C++11
[expr.prim.lambda]p4, including the current suggested resolution of
core isue 975, which allows multiple return statements so long as the
types match. ExtWarn when user code is actually making use of this
extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
503384f731b5abcbf870b0a5224eb920e631db0a 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Various interrelated cleanups for lambdas:
- Complete the lambda class when we finish the lambda expression
(previously, it was left in the "being completed" state)
- Actually return the LambdaExpr object and bind to the resulting
temporary when needed.
- Detect when cleanups are needed while capturing a variable into a
lambda (e.g., due to default arguments in the copy constructor), and
make sure those cleanups apply for the whole of the lambda
expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2837a2f02195e624b14b419b2d3e6682a6bc5a0f 08-Feb-2012 Jean-Daniel Dupas <devlists@shadowlab.org> non-literal strftime format string is not unsafe.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
52aabafeee9e8634eceb46b1a3fdbd3cd22b1cf7 07-Feb-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Implements support of format_arg attribute on C++ member.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f7ccbad5d9949e7ddd1cbef43d482553b811e026 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import SmallString<> into clang namespace

(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8fe83e1df954d72c0f4ffc15d20a5222ec151c21 04-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Move a method from IdentifierTable.h out of line and remove the SmallString include.

Fix all the transitive include users.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
afdb041308bca3e875b23e7a22d879e9039bff03 03-Feb-2012 Anna Zaks <ganna@apple.com> Do not show macro expansion in strncat warnings, which can be defined as
a builtin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
34ff062936ac78142a2c0dc8d1ae6a40df456819 02-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Change the check for constant-conversion with width-1 bitfields so it doesn't suppress quite as many cases. Based off a testcase in the gcc testsuite.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c36bedc90c687caa71748480c60707ea4608b092 01-Feb-2012 Anna Zaks <ganna@apple.com> Add a new compiler warning, which flags anti-patterns used as the size
argument in strncat.

The warning is ignored by default since it needs more qualification.

TODO: The warning message and the note are messy when
strncat is a builtin due to the macro expansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
289e31f386fe8b5e489588533e34c4e21df764bd 31-Jan-2012 Ted Kremenek <kremenek@apple.com> Revert r149359. This was a hack to a problem with an easy workaround, and it doesn't feel like general solution.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149404 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
220947bd5a66b0f25f5e74d6029769dfb34f07b4 31-Jan-2012 Jean-Daniel Dupas <devlists@shadowlab.org> FormatCheckers should emit all diagnostics using EmitFormatDiagnostic().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fdba18263ffd624846701ad115d35edb3e2ee0a7 31-Jan-2012 Ted Kremenek <kremenek@apple.com> Don't warn about -Wshorten-64-to-32 in unreachable code. Fixes <rdar://problem/10759934>. Apparently this is a common idiom in Linux (among other places).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0692a1991bdb8b3112887fce90d75f2103a0080b 31-Jan-2012 Ted Kremenek <kremenek@apple.com> Make a bunch of local functions 'static'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
339b9072e26a2a0fe796dc69c4d28d964d0ec86d 31-Jan-2012 Nico Weber <nicolasweber@gmx.de> Let %S, %ls, %C match 16bit types in NSStrings.

As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ce3aa395240207fd1cfa11342fd4b9fd46d6b025 30-Jan-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Disable "non literal format string" for NSString that result from a macro expansion.
This is to prevent diagnostic when using NSLocalizedString or CFCopyLocalizedString
macros which are usually used in place of NS and CF strings literals.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
34269df5db40b7c4b4f52aed579d9b3108ff79e4 30-Jan-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Update on format attribute handling.
- Remove the printf0 special handling as we treat it as printf anyway.
- Perform basic checks (non-literal, empty) for all formats and not only printf/scanf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149236 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e4b92761b43ced611c417ae478568610f1ad7b1e 27-Jan-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added source location for the template keyword in AST template-id expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0fa063816818ac53a0015a5d2b0328812005b40e 27-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Turn off implicit truncation warning for compound assignment to bitfields; it might be reasonable in some cases, but it clearly doesn't make sense in some cases, like the included testcase.

<rdar://problem/10238797>, part 2.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3a643afa402d51b5fc4faccb4329e9c4392d4551 27-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make the bitfield implicit truncation warning slightly more aggressive, and make the printed warning a bit more accurate. The new behavior matches gcc's -Wconversion. <rdar://problem/10238797>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e98e5b54543f8a9e35626fb44dc0c649e71917d9 25-Jan-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Add support for const pointer to literal-objc string as format attribute.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
43d1251a471d19ce83aa8ce91c0104addada5add 25-Jan-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Add "multiple format attributes" support on block.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8c382060c9e6668a94f1485dd16f012cda526c5f 23-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make sure the AST correctly represents lvalue-to-rvalue conversions where appropriate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
87eaf726528124a1ad49f38402e9b619685fe30b 17-Jan-2012 Fariborz Jahanian <fjahanian@apple.com> objc-arc: when 'assign' attribute is unspecified,
rely on property's type for its life-time to avoid
bogus warning with -Warc-unsafe-retained-assign.
// rdar://10694932


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
29c3f814b64808c6dac4597b61a50ceecdf141fc 17-Jan-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Fix a couples of issues in format strings checking.
PR 10274: format function attribute with the NSString archetype yields no compiler warnings
PR 10275: format function attribute isn't checked in Objective-C methods



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7530c034c0c71a64c5a9173206d9742ae847af8b 17-Jan-2012 David Blaikie <dblaikie@gmail.com> Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148292 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0a151a137a68bb656acbcce7ff2407613bb80cfc 17-Jan-2012 Anna Zaks <ganna@apple.com> Use Builtin ID as the return value
for FunctionDecl::getMemoryFunctionKind().

This is a follow up on the Chris's review for r148142: We don't want to
pollute FunctionDecl with an extra enum. (To make this work, added
memcmp and family to the library builtins.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7a7ee3033e44b45630981355460ef89efa0bdcc4 16-Jan-2012 David Chisnall <csdavec@swan.ac.uk> Some improvements to the handling of C11 atomic types:

- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d9b859a74ecaede23a78d37f364498102ef418c9 13-Jan-2012 Anna Zaks <ganna@apple.com> Move identification of memory setting and copying functions (memset,
memcmp, strncmp,..) out of Sema and into FunctionDecl so that the logic
could be reused in the analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6e6f93a1f16d9804db79390382e9d1f6322cdbfd 10-Jan-2012 Fariborz Jahanian <fjahanian@apple.com> objc-arc: fixes a crash when trying to find out retaining cycle
ownership of property sent to 'super'. // rdar://10640891


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d87a0cd2b3e1c9e9f01212875f4cbe5b7bb7ab57 06-Jan-2012 Matt Beaumont-Gay <matthewbg@google.com> Suppress -Wunused-value within macros from system headers.

Along the way, move a helper function from SemaChecking.cpp to a more
accessible home in SourceManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
65639284118d54ddf2e51a05d2ffccda567fe246 05-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Add an APValue representation for the difference between two address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer.

With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary.

Fixes PR11705.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
80d4b55db94db2172a04617d1a80feca6bbcea5c 28-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
25b009a9d2a79929112d3c28c7dd1730bf5246c8 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11594: Don't blindly build a UnaryOperator UO_Minus on an expression which
might not be an rvalue when checking array accesses. Instead, pass through a
flag indicating the array index is negated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d02deebce5f1b283101e035a7f5d5bab0d2068ec 15-Dec-2011 Hans Wennborg <hans@hanshq.net> 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b17ee5bff0d7986c14cdddb279e0131bd7f9678d 15-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Enhance the -Wsign-compare handling to suppress the -Wsign-compare warning in the case of a shifted bitfield. PR11572.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
80fb7dd8e0c56632dc68f5864f70abb2fde0e1df 14-Dec-2011 Matt Beaumont-Gay <matthewbg@google.com> r146430 lost some compile-time performance on MultiSource/Benchmarks/MiBench/security-rijndael; this gets most of it back.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8ef8f431aaeed3d7418959c81dfaa677b44f05ed 12-Dec-2011 Matt Beaumont-Gay <matthewbg@google.com> Suppress -Warray-bounds in certain cases involving macros from system headers.

The motivation here is a "clever" implementation of strncmp(), which peels the first few comparisons via chained conditional expressions which ensure that the input arrays are known at compile time to be sufficiently large.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6fcd932dfd6835f70cc00d6f7c6789793f6d7b66 10-Dec-2011 Hans Wennborg <hans@hanshq.net> Check that arguments to a scanf call match the format specifier,
and offer fixits when there is a mismatch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2def77399ab3088106a2d61372344f5b7104e1a2 09-Dec-2011 David Blaikie <dblaikie@gmail.com> Add notes for suppressing and (if it's a zero-arg function returning bool) fixing the function-to-bool conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146280 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f4f0c6095d1f481b94c6821c65e3bf1c9df42af7 09-Dec-2011 Hans Wennborg <hans@hanshq.net> Make printf warnings refer to wint_t and wchar_t by name
in addition to underlying type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a792aff1c7de253b89c473fdb7eef4a5bba83aec 07-Dec-2011 Hans Wennborg <hans@hanshq.net> Make printf warnings refer to intmax_t et al. by name
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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
26b45d86085a125af036dbcf85dad3087b664ab2 06-Dec-2011 Richard Trieu <rtrieu@google.com> Switch a cast to a dyn_cast and check the pointer before using. Fixes a crash
in the following code:

void test4(bool (&x)(void)) {
while (x);
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145918 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e14ca9f509dc22d8fcc5d21d70d28a5848983b42 05-Dec-2011 Lang Hames <lhames@gmail.com> Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.

void foo() {}
if (f) { ... // <- Warns here.
}

Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
687b5df89d4ba91219df578d02087c68c09a0332 03-Dec-2011 Nick Lewycky <nicholas@mxc.ca> Revert r145697 and dependent patch r145702. It added a dependency from
lib/Analysis to lib/Sema which is cyclical.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5fdc1b993dcb01e8a994fdacfc4eb089832c82e3 02-Dec-2011 Hans Wennborg <hans@hanshq.net> Make conversion specifier warning refer to typedef if possible.

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')"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
968a0ee9d98549308e3e70e787e4fd669d2a829d 01-Dec-2011 Ted Kremenek <kremenek@apple.com> Specially whitelist the selector 'addOperationWithBlock:' for the retain-cycle checking in -Warc-retain-cycles. This commonly
is hit by users using NSOperationQueue. Fixes <rdar://problem/10465721>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145548 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
381711c6e7911d762f81a65e9ef4339a6a3d6524 29-Nov-2011 Matt Beaumont-Gay <matthewbg@google.com> Suppress -Warray-bounds for classes (not just structs) where the last field is
a 1-length character array.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145445 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cfbc5b5660f49fae63acc1f5ef05df87070a2a3c 29-Nov-2011 Matt Beaumont-Gay <matthewbg@google.com> Merge branch 'yo-dawg-i-herd-u-like-arrays'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a9766411aaaa1446a5da96dc5042de8da05d89bd 28-Nov-2011 Douglas Gregor <dgregor@apple.com> When checking a call to a builtin atomic operation, be sure to
consider the _<width> variants as well, which we'll see if we're
performing the type checking in a template instantiation where the
call expression itself was originally not type-dependent. Fixes
PR11411.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4648255cebd2fc7c18293c1f93afd6e9add9cccc 16-Nov-2011 Bob Wilson <bob.wilson@apple.com> Fix Neon builtin pointer argument checking for "sret" builtins.

The code for checking Neon builtin pointer argument types was assuming that
there would only be one pointer argument. But, for vld2-4 builtins, the first
argument is a special sret pointer where the result will be stored. So,
instead of scanning all the arguments to find a pointer, have TableGen figure
out the index of the pointer argument that needs checking. That's better than
scanning all the arguments regardless. <rdar://problem/10448804>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
180f47959a066795cc0f409433023af448bb0328 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for evaluation of structs and unions of
literal types, as well as derived-to-base casts for lvalues and
derived-to-virtual-base casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
80ee6e878a169e6255d4686a91bb696151ff229f 10-Nov-2011 John McCall <rjmccall@apple.com> There's no good reason to track temporaries in ExprWithCleanups,
but it is sometimes useful to track blocks. Do so. Also
optimize the storage of these expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5b0c5199a7037d0435d75f37e3ba69a24f757931 08-Nov-2011 Douglas Gregor <dgregor@apple.com> Mark the overloaded atomic builtins as having custom type checking,
which they do. This avoids all of the default argument promotions that
we (1) don't want, and (2) undo during that custom type checking, and
makes sure that we don't run into trouble during template
instantiation. Fixes PR11320.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6f9f03ef370ad48ece0c5d10edda28f39ccadb5d 08-Nov-2011 Bob Wilson <bob.wilson@apple.com> Check pointer types for arguments of Neon load/store macros. rdar://9958031

The Neon load/store intrinsics need to be implemented as macros to avoid
hiding alignment attributes on the pointer arguments, and the macros can
only evaluate those pointer arguments once (in case they have side effects),
so it has been hard to get the right type checking for those pointers.
I tried various alternatives in the arm_neon.h header, but it's much more
straightforward to just check directly in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
da95f73b59f9af964e33725c515139d34c90c863 08-Nov-2011 Bob Wilson <bob.wilson@apple.com> Clean up type flags for overloaded Neon builtins. No functional change.

This patch just adds a simple NeonTypeFlags class to replace the various
hardcoded constants that had been used until now. Unfortunately I couldn't
figure out a good way to avoid duplicating that class between clang and
TableGen, but since it's small and rarely changes, that's not so bad.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144054 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7864435ef2bce200224120bd1df3aed98ea5b99a 07-Nov-2011 John McCall <rjmccall@apple.com> Rip out CK_GetObjCProperty.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4b9c2d235fb9449e249d74f48ecfec601650de93 06-Nov-2011 John McCall <rjmccall@apple.com> Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions. It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed
properties.

Most of the effort here is in dealing with the various
clients of the AST. I've gone ahead and simplified the
ObjC rewriter's use of properties; other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily. Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
51f4708c00110940ca3f337961915f2ca1668375 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
55733de16f492dadbf5f4d2809d6c610ba6d86ae 28-Oct-2011 Richard Trieu <rtrieu@google.com> 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3c3b7f90a863af43fa63043d396553ecf205351c 25-Oct-2011 John McCall <rjmccall@apple.com> Restore r142914 and r142915, now with missing file and apparent
GCC compiler workaround.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
327a50f46449c946c42d50d97689bcb30e2af7d9 25-Oct-2011 NAKAMURA Takumi <geek4civic@gmail.com> Revert r142914 and r142915, due to possibly missing file.

r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a1b852f8e1bee5ed3604ee483803cef39ce57a20 25-Oct-2011 John McCall <rjmccall@apple.com> Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5e745da03df27ac620b0a5cc280d0d1757cfbac1 22-Oct-2011 Ted Kremenek <kremenek@apple.com> Only emit implicit constant conversion truncation warnings in reachable code. Apparently this is what GCC does, and some code depends on this. Fixes <rdar://problem/10321089>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
013e5ce167d72b3617951002f8aea5ff79a37d72 19-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Move static array parameter checks to SemaExpr, per Doug's request

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a7da2155167676a6a5d9fca4de947a9cab2a4908 18-Oct-2011 Hans Wennborg <hans@hanshq.net> Suggest %zu for size_t args to printf.

For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc.
rather than looking at the underlying type and suggesting "%llu" or other
platform-specific length modifiers. Applies to C99 and C++11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
20cdbeb8f36576f469db195b4140c293c7281718 16-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Add sema checks for calls to functions taking static array parameters

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dfa64ba45922e1c28e36341bdf34785fea74659b 15-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Add template instantiation support for AtomicExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142012 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9ce6377714a8eb8f577c87028300421e72b00dc9 14-Oct-2011 Matt Beaumont-Gay <matthewbg@google.com> Only warn in -Wliteral-conversion if the conversion loses information

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cda57822327499aeb6fe606f9cf5903cffca3444 14-Oct-2011 Nico Weber <nicolasweber@gmx.de> Extend -Wno-sizeof-array-argument to strncpy and friends.

This finds 2 bugs in chromium and 1 in hunspell, with 0 false positives.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
276b061970939293f1abaf694bd3ef05b2cbda79 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Initial implementation of __atomic_* (everything except __atomic_is_lock_free).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a6b8b2c09610b8bc4330e948ece8b940c2386406 10-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
behaviour.
- Factor out evaluation of bitfield bit widths.
- Fix a few places which would evaluate an expression twice: once to determine
whether it is a constant expression, then again to get the value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f8b6e1591b5c5085cf4dec8df657e32a68053b12 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't analyze comparisons in type- or value-dependent
subexpressions. Fixes PR10291.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141552 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5e1cdac63c3d9c9b32fa41fa0b2d242a58a20d49 07-Oct-2011 John McCall <rjmccall@apple.com> Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b45ae256cfd5ef3ab22b4d715159f978d8120d45 05-Oct-2011 John McCall <rjmccall@apple.com> Refactor the analysis of C++ cast expressions so that even
C-style and functional casts are built in SemaCXXCast.cpp.
Introduce a helper class to encapsulate most of the random
state being passed around, at least one level down.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4cd5791f4aa6deb572979bb38c1deedbc155efe0 29-Sep-2011 Ted Kremenek <kremenek@apple.com> Do not warn about empty format strings when there are no data arguments. Fixes <rdar://problem/9473155>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e37cdc42bf7298a974dfdfa9c03ef11398e7c889 29-Sep-2011 David Blaikie <dblaikie@gmail.com> Unnecessary else


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8987b2385d9ba63ada66e1344ace79b04d5cb5c3 28-Sep-2011 Douglas Gregor <dgregor@apple.com> Only print _Bool as 'bool' when 'bool' is defined as an object-like
macro whose only replacement token is '_Bool'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
30c42404202d2e2512e51efc6066bd614cfdb5a4 28-Sep-2011 Douglas Gregor <dgregor@apple.com> When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140650 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d6471f7c1921c7802804ce3ff6fe9768310f72b9 26-Sep-2011 David Blaikie <dblaikie@gmail.com> Rename Diagnostic to DiagnosticsEngine as per issue 5397


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f1f8b1a404d9ce6f0eb78e97b598a220d8ca9090 23-Sep-2011 Richard Trieu <rtrieu@google.com> Add a new warning to -Wliteral-conversion to catch cases where a string literal
is cast to a boolean. An exception has been made for string literals in
logical expressions to allow the common case of use in assert statements.

bool x;
x = "hi"; // Warn here
void foo(bool x);
foo("hi"); // Warn here
assert(0 && "error");
assert("error); // Warn here



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a64ccefdf0ea4e03ec88805d71b0af74950c7472 19-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.

It already works (and is useful with) macro locs as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
de5998f1d7dcecb777257ec932142d65de636eb8 18-Sep-2011 Nico Weber <nicolasweber@gmx.de> Let -Warray-bounds handle casted array types without false positives.

Fixes PR10771.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dd22509c82eb7681a0f46b41d61cb2e25a4d8fa1 15-Sep-2011 Richard Trieu <rtrieu@google.com> Finish the lex->LHS and rex->RHS cleanup in Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
265941bc308d65cc270d5c4de5806f37ce405606 13-Sep-2011 John McCall <rjmccall@apple.com> Refactoring, mostly to give ObjCPropertyDecls stronger invariants for
their semantic attributes and then to take advantage of that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
33e56f3273457bfa22c7c50bc46cf5a18216863d 10-Sep-2011 John McCall <rjmccall@apple.com> Rename the ARC cast kinds to start with "ARC".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
77f68bb90af93b95045fb994e7cd68137adcc132 10-Sep-2011 Julien Lerouge <jlerouge@apple.com> Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bbcb7ea8a062a8f1d5cb504e4518a5d4fbab873a 09-Sep-2011 Douglas Gregor <dgregor@apple.com> When type-checking a call to an overloaded, builtin atomic operation,
construct a new DeclRefExpr rather than re-using the existing
DeclRefExpr. Patch by Likai Liu, fixes PR8345.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139373 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
69ff26bd1e7a2faffec0c3b9740cfb0c6bb354c5 09-Sep-2011 Douglas Gregor <dgregor@apple.com> The integer type of an enumeration type isn't always canonical

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
634c8af0805ba33b1530470e03aa314141036aa2 09-Sep-2011 Matt Beaumont-Gay <matthewbg@google.com> Extend -Wliteral-conversion to catch "int i = -1.234"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bcfd1f55bfbb3e5944cd5e03d07b343e280838c4 02-Sep-2011 Douglas Gregor <dgregor@apple.com> Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5f8d604246976a93a73549b07bbc8ee0b2061b50 27-Aug-2011 John McCall <rjmccall@apple.com> The lvalue-to-rvalue on structs in C++ is actually part
of default argument promotion and needs to happen unconditionally.
This is particularly semantically important in C++0x.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138691 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5c5218e188b39b2e93b541156a69ef061e11aab8 19-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Improve the correctness and accuracy of the message for -Wdynamic-class-memaccess

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8f7462237ff542a4556775f98709ed300aa1731a 19-Aug-2011 Ted Kremenek <kremenek@apple.com> Enhance -Wstrl-incorrect-size to not report a FIXIT for destinations that are flexible arrays or have size 1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bd5da9d1a711e90b3bc265b4798954085c0b48d9 18-Aug-2011 Ted Kremenek <kremenek@apple.com> Reapply r137903, but fix the definition of size_t in the test case to use __SIZE_TYPE__ (and hence be portable).

Also, change the warning to -Wstrl-incorrect-size.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1cb4f664fd4f72a65a145e9ff8a7e2540ab09156 18-Aug-2011 Ted Kremenek <kremenek@apple.com> Revert r137903, "Add experimental -Wstrlcpy-size warning that looks to see if the size argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*. This warning is off by default (for now)."

This currently doesn't work on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4b53117c9942db2e08f18be25d9ccf7daf6af0b2 18-Aug-2011 Ted Kremenek <kremenek@apple.com> Add experimental -Wstrlcpy-size warning that looks to see if the size argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*. This warning is off by default (for now).

Warning logic provided by Geoff Keating.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d10f4bc5a05ce0cdc1646dbb0f706bb9d3dfc0c5 10-Aug-2011 Kaelyn Uhrain <rikka@google.com> Add a test case for the divide-by-zero fix in r137234


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
18f169770d9d3f826bad8f1359c8c5770c5ab16f 10-Aug-2011 Kaelyn Uhrain <rikka@google.com> Make sure ptrarith_typesize is at least 1 to avoid division by zero


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
22d4fed17df02f5fa07165a69228b0b0f1a73a28 06-Aug-2011 Benjamin Kramer <benny.kra@googlemail.com> Only look at decls after the current one when checking if it's the last field in a record.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d6c8865e6f306556b7eef972ceec2cc8ba026a0d 06-Aug-2011 Kaelyn Uhrain <rikka@google.com> Perform array bounds checking in more situations and properly handle special
case situations with the unary operators & and *. Also extend the array bounds
checking to work with pointer arithmetic; the pointer arithemtic checking can
be turned on using -Warray-bounds-pointer-arithmetic.

The changes to where CheckArrayAccess gets called is based on some trial &
error and a bunch of digging through source code and gdb backtraces in order
to have the check performed under as many situations as possible (such as for
variable initializers, arguments to function calls, and within conditional in
addition to the simpler cases of the operands to binary and unary operator)
while not being called--and triggering warnings--more than once for a given
ArraySubscriptExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c268434b332bbe57950d977633369bf5822d9554 05-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Flesh out the -Warray-bounds detection of C89 tail-padded one-element
arrays. This now suppresses the warning only in the case of
a one-element array as the last field in a struct where the array size
is a literal '1' rather than any macro expansion or template parameter.

This doesn't distinguish between the language standard in use to allow
code which dates from C89 era to compile without the warning even in C99
and C++ builds. We could add a separate warning (under a different flag)
with fixit hints to switch to a flexible array, but its not clear that
this would be desirable. Much of the code using this idiom is striving
for maximum portability.

Tests were also fleshed out a bit, and the diagnostic itself tweaked to
be more pretty w.r.t. single elment arrays. This is more ugly than
I would like due to APInt's not being supported by the diagnostic
rendering engine.

A pseudo-patch for this was proposed by Nicola Gigante, but I reworked
it both for several correctness issues and for code style.

Sorry this was so long in coming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ba44712b0e578a851751e199bb75dbbff5836fed 05-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Finally getting around to re-working this to more accurately white-list
1-element character arrays which are serving as flexible arrays. This is
the initial step, which is to restrict the 1-element array whitelist to
arrays that are member declarations. I'll refine it from here based on
the proposed patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cc2f30c4ed7770b6005bd55b529a55c1fcc250fc 05-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Extend memset/memcpy/memmove checking to include memcmp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9e6a1caf18565849cc7bec265bcb0b8af4e1d93a 02-Aug-2011 Chris Lattner <sabre@nondot.org> disable array bounds overflow warning for cases where an array
has a single element. This disables the warning in cases where
there is a clear bug, but this is really rare (who uses arrays
with one element?) and it also silences a large class of false
positive issues with C89 code that is using tail padding in structs.

A better version of this patch would detect when an array is in
a tail position in a struct, but at least patch fixes the huge
false positives that are hitting postgres and other code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5cee1195584fa8672253139c86e922daeda69b9e 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Add support for C++0x unicode string and character literals, from Craig Topper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2760455396abd72f0842122170dfab6126c46891 26-Jul-2011 Kaelyn Uhrain <rikka@google.com> Revert r136046 while fixing handling of e.g. &foo[index_one_past_size]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
108f756bebd991eaa980cfb9994353612a2e5ff6 26-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Cleanup the stray comments and variables I could dig out of Sema to
refer to 'expansion' instead of 'instantiation'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b48f7c059e74cd5395ca542c1a96be16e42f3d80 26-Jul-2011 Kaelyn Uhrain <rikka@google.com> Expand array bounds checking to work in the presence of unary & and *,
and to work with pointer arithmetic in addition to array indexing.

The new pointer arithmetic porition of the array bounds checking can be
turned on by -Warray-bounds-pointer-arithmetic (and is off by default).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5254161b269829b74e7a9379b1bdfa27de72d7cc 21-Jul-2011 Richard Trieu <rtrieu@google.com> Remove warning for conditional operands of differend signedness from -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3e1ef7849845a9e7bf79156bbb8a2c26d77a1d2e 15-Jul-2011 Jeffrey Yasskin <jyasskin@google.com> Use the new APFloat::convertToInt(APSInt) function to simplify uses of
convertToInt(integerParts*) and make them more reliable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
00fe761849278180b0d73f276e468cf4c54ff2ad 15-Jul-2011 John McCall <rjmccall@apple.com> Teach -Wconversion, -Wsign-compare etc. about division and remainder.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
862ff87c0d306af8dfdbe7ac59f181a5815546e5 13-Jul-2011 John McCall <rjmccall@apple.com> Make the integer-range analysis recognize ^= correctly,
and (while I'm at it) teach it to grok the results of simple
assignments.

The first is PR10336.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7e5e5f4cc36fe50f46ad76dca7a266434c94f475 07-Jul-2011 John McCall <rjmccall@apple.com> In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value.

As an exception, don't do this when the call is made as the immediate
operand of a __bridge retain. This is more in the way of a workaround
than an actual guarantee, so it's acceptable to be brittle here.

rdar://problem/9504800



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
921c14322977253a60dcb171f45e468c95fe41f8 24-Jun-2011 Fariborz Jahanian <fjahanian@apple.com> objc-arc: Check on a variety of unsafe assignment of retained
objects. // rdar://9495837


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133806 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b8b0313e84700b5c6d597b3be4de41c97b7550f1 24-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about 'ownership', not 'lifetime'.

rdar://9477613.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a72a12f3baed07f2663e48c5fc3b670c68dffe0c 22-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Fix some grammar nits in the comments from Nick.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133571 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
03e80030515c800d1ab44125b9052dfffd1bd04c 21-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce a new AST node describing reference binding to temporaries.

MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value.

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
707a23e8b87410332b55bb4534fa1c799edef38a 16-Jun-2011 Douglas Gregor <dgregor@apple.com> Teach the warning about non-POD memset/memcpy/memmove to deal with the
__builtin_ versions of these functions as well as the normal function
versions, so that it works on platforms where memset/memcpy/memmove
are macros that map down to the builtins (e.g., Darwin). Fixes
<rdar://problem/9372688>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133173 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
000d428347f352979e0f6dffcf0a64e73af0a2b5 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Rework the warning for 'memset(p, 0, sizeof(p))' where 'p' is a pointer
and the programmer intended to write 'sizeof(*p)'. There are several
elements to the new version:

1) The actual expressions are compared in order to more accurately flag
the case where the pattern that works for an array has been used, or
a '*' has been omitted.
2) Only do a loose type-based check for record types. This prevents us
from warning when we happen to be copying around chunks of data the
size of a pointer and the pointer types for the sizeof and
source/dest match.
3) Move all the diagnostics behind the runtime diagnostic filter. Not
sure this is really important for this particular diagnostic, but
almost everything else in SemaChecking.cpp does so.
4) Make the wording of the diagnostic more precise and informative. At
least to my eyes.
5) Provide highlighting for the two expressions which had the unexpected
similarity.
6) Place this diagnostic under a flag: -Wsizeof-pointer-memaccess

This uses the Stmt::Profile system for computing #1. Because of the
potential cost, this is guarded by the warning flag. I'd be interested
in feedback on how bad this is in practice; I would expect it to be
quite cheap in practice. Ideas for a cheaper / better way to do this are
also welcome.

The diagnostic wording could likely use some further wordsmithing.
Suggestions welcome here. The goals I had were to: clarify that its the
interaction of 'memset' and 'sizeof' and give more reasonable
suggestions for a resolution.

An open question is whether these diagnostics should have the note
attached for silencing by casting the dest/source pointer to void*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133155 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5546e69729b9f195afd0410948e013206618b717 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Skip both character pointers and void pointers when diagnosing bad
argument types for mem{set,cpy,move}. Character pointers, much like void
pointers, often point to generic "memory", so trying to check whether
they match the type of the argument to 'sizeof' (or other checks) is
unproductive and often results in false positives.

Nico, please review; does this miss any of the bugs you were trying to
find with this warning? The array test case you had should be caught by
the array-specific sizeof warning I think.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f85e193739c953358c865005855253af4f68a497 16-Jun-2011 John McCall <rjmccall@apple.com> Automatic Reference Counting.

Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e4a1c64700304459ac436fe29cb498f2da3b6194 14-Jun-2011 Nico Weber <nicolasweber@gmx.de> Warn on memset(ptr, 0, sizeof(ptr)). Diagnostic wording by Jordy Rose.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b792b30ce3d31e3eb3cfee3321238cf3cc2165b0 14-Jun-2011 Chris Lattner <sabre@nondot.org> fix rdar://9546171 - -Wshorten-64-to-32 shouldn't warn on vector bitcasts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5fc99f3cb7a18f5306b4ed6f58f1a397e7fb7696 13-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Fix a broken index left over from before this function was converted to
handle memcpy and memmove. Spotted by Nico.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
929f0135ab60166202f52e0dd19835c0490d792a 03-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Clean up the "non-POD memaccess" stuff some. This adds a properly named
diagnostic group to cover the cases where we have definitively bad
behavior: dynamic classes.

It also rips out the existing support for POD-based checking. This
didn't work well, and triggered too many false positives. I'm looking
into a possibly more principled way to warn on the fundamental buggy
construct here. POD-ness isn't the critical aspect anyways, so a clean
slate is better. This also removes some silliness from the code until
the new checks arrive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1838ca5618bc6c84ca3d13d84717bf32d9862bb3 29-May-2011 Richard Trieu <rtrieu@google.com> Add a new warning on NULL pointer constant to integer conversion.

This path was reviewed by Chandler Carruth at http://codereview.appspot.com/4538074/



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5e9ebb3c0fb554d9285aa99c470abdf283272bd9 21-May-2011 Douglas Gregor <dgregor@apple.com> A few more is(Un)signedIntegerType/is(Un)signedOrEnumerationType cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
06bc9eb9908e42696775b395b290827bde468c8b 03-May-2011 Douglas Gregor <dgregor@apple.com> Extend -Wnon-pod-memset to also encompass memcpy() and memmove(),
checking both the source and the destination operands, renaming the
warning group to -Wnon-pod-memaccess and tweaking the diagnostic text
in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130786 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2a053a33707eba9e642adedb557b1a6aace103b5 03-May-2011 Douglas Gregor <dgregor@apple.com> Separate the -Wnon-pod-memset warnings into two separate warnings:
- a default-on warning for pointers to dynamic classes (= classes with vtables)
- a default-off warning for other non-POD types



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e452c78072156c14cd9998733e3b4b28b6fc7fd7 03-May-2011 Douglas Gregor <dgregor@apple.com> Only check the use of memset() if we're refering to a C function named
'memset' with external linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
43fa33b4bedc28d2faa17d678ad1f40eb42817a1 29-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Relax the non-POD memset warning to use the less restrictive C++11
definition of POD. Specifically, this allows certain non-aggregate
types due to their data members being private.

The representation of C++11 POD testing is pretty gross. Any suggestions
for improvements there are welcome. Especially the name
'isCXX11PODType()' seems truly unfortunate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1d59f7f8fb39fa44ddbb6e2abd321af863b1f55b 28-Apr-2011 Ted Kremenek <kremenek@apple.com> Convert assertion in memset checking to a runtime check (because real code may provide a deviant definition of memset).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
134cb4442d6205e0226944ead4c7ede425fba206 27-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Heh, funny thing, 'void' isn't a POD type. Nice of us to suggest it to
silence this warning. ;]

Fixed that obvious bug and added a bit more testing as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7ccc95bceebb2d1c8fbe277c9e33bde7dc1ccbb1 27-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Add a warning (-Wnon-pod-memset) for calls to memset() with
a destination pointer that points to a non-POD type. This can flag such
horrible bugs as overwriting vptrs when a previously POD structure is
suddenly given a virtual method, or creating objects that crash on
practically any use by zero-ing out a member when its changed from
a const char* to a std::string, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
162e1c1b487352434552147967c3dd296ebee2f7 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Support for C++11 (non-template) alias declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f111d935722ed488144600cea5ed03a6b5069e8f 15-Apr-2011 Peter Collingbourne <peter@pcc.me.uk> C1X: implement generic selections

As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f65076ebf5e8bc5ae7b77fe3c3a65dc5db8d763f 10-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the diagnostic for literal float -> int conversions to suggest
rewriting the literal when the value is integral. It is not uncommon to
see code written as:

const int kBigNumber = 42e5;

Without any real awareness that this is no longer an ICE. The note helps
automate and ease the process of fixing code that violates the warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
23aa9c8ca0bc441aab2a38a4c9fc7a1c9e9ac16a 09-Apr-2011 Chris Lattner <sabre@nondot.org> add a __sync_swap builtin to fill out the rest of the __sync builtins.
Patch by Dave Zarzycki!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
429bb276991ff2dbc7c5b438828b9b7737cb15eb 08-Apr-2011 John Wiegley <johnw@boostpro.com> Use ExprResult& instead of Expr *& in Sema

This patch authored by Eric Niebler.

Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr
pointers as in/out parameters (Expr *&). This is especially true for the
routines that apply implicit conversions to nodes in-place. This design is
workable only as long as those conversions cannot fail. If they are allowed
to fail, they need a way to report their failures. The typical way of doing
this in clang is to use an ExprResult, which has an extra bit to signal a
valid/invalid state. Returning ExprResult is de riguour elsewhere in the Sema
interface. We suggest changing the Expr *& parameters in the Sema interface
to ExprResult &. This increases interface consistency and maintainability.

This interface change is important for work supporting MS-style C++
properties. For reasons explained here
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013180.html>,
seemingly trivial operations like rvalue/lvalue conversions that formerly
could not fail now can. (The reason is that given the semantics of the
feature, getter/setter method lookup cannot happen until the point of use, at
which point it may be found that the method does not exist, or it may have the
wrong type, or overload resolution may fail, or it may be inaccessible.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e1b02e00d851389415a5b7a1398de26c382887c6 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Refactor one helper function to merely forward to another so that there
is a single implementation. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128877 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
909a70d8a185f701c20bacc3c76f8f5979cbbc7c 25-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Apply the nonnull attribute to constructor expressions too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
db9e9e61f8311d8852bd15730f78e56f3ffa0508 15-Mar-2011 Ted Kremenek <kremenek@apple.com> Remove warning for null characters in CFString literals. Clang handles them just fine, and GCC 4.2 doesn't warn here either.

We added this warning back in 2007 when we were comparing against GCC 4.0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0c06944f5ef31cc6356e30da2971fa5439c4c8ef 15-Mar-2011 Ted Kremenek <kremenek@apple.com> Don't warn about null characters in Objective-C format string literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5a5b38f4afaf4f203b96a11ba79890c7cd4cc4b8 12-Mar-2011 Douglas Gregor <dgregor@apple.com> When we're determining whether to complain about a conversion from one
enumeration type to another in C, classify enumeration constants as if
they had the type of their enclosing enumeration. Fixes
<rdar://problem/9116337>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f4e3cfbe8abd124be6341ef5d714819b4fbd9082 11-Mar-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof. Original
patch by Guy Benyei.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ef9ff88f54ff26ac9782d98a34b74aa424149be1 10-Mar-2011 Ted Kremenek <kremenek@apple.com> Profiling showed that 'CheckImplicitConversions' was very slow because of the call to getSpellingLoc(). On 'aes.c'
in the LLVM test suite, this function was consuming 7.4% of -fsyntax-only time. This change fixes this issue
by delaying the check that the warning would be issued within a system macro by as long as possible. The
main negative of this change is now the logic for this check is done in multiple places in this function instead
of just in one place up front.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3aea4dac830cb03d883a13ab30c28a3a53beca58 01-Mar-2011 Ted Kremenek <kremenek@apple.com> For C++, enhance -Warray-bounds to recursively analyze array subscript accesses in ?: expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126766 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8e10f3b9cc1db43645bbc2999eb163af8997d468 26-Feb-2011 John McCall <rjmccall@apple.com> Provide a bit saying that a builtin undergoes custom type-checking, then
don't let calls to such functions go down the normal type-checking path.
Test this out with __builtin_classify_type and __builtin_constant_p.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b43e8ad893706a2499c4901b8f5cb289553d66b1 25-Feb-2011 Ted Kremenek <kremenek@apple.com> Don't warn about using PredefinedExprs as format string literals. These never can be a real security issue.

Fixes PR 9314.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9e060ca641a1f845cecb3371b3a3018d306a5198 24-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126341 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
762696fff298627b72b63dbb0becf57f689801ca 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Update Sema::DiagRuntimeBehavior() to take an optional Stmt* to indicate the code the diagnostic is associated with.

This Stmt* is unused, but we will use it shortly for pruning diagnostics associated
with unreachable code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b70369cae98590c03cad0cd0d6c8f94c4e0e55c4 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Change -Warray-bounds logic to use DiagRuntimeBehavior in preparation for using basic dataflow to suppress warnings on unreachable array bounds checks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
284cc8d8a90ae6558e0a4b60b7dc1ddcfd220758 22-Feb-2011 Douglas Gregor <dgregor@apple.com> Warn about implicit conversions between values of different, named
enumeration types. Fixes <rdar://problem/8559831>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3e026e323f1bd820fb9c880b1db951c87df94bb4 19-Feb-2011 Douglas Gregor <dgregor@apple.com> Don't produce "comparison is always (true|false)" warnings when the
comparison itself is a constant expression. Fixes PR7536.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
25b3b849e3ad340b04442707038c86980035765b 18-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix assertion failure on -Warray-bounds for 32-bit builds of Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
35001ca261f895817916b468379b696d6d45959d 17-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the array bounds checking to work for several other constructs,
especially C++ code, and generally expand the test coverage.

Logic adapted from a patch by Kaelyn Uhrain <rikka@google.com> and
another Googler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3406458512c3cdfe2076c46b9aedb4621297efd5 17-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Clean up the style of this function to match the conventions in the rest
of Clang, and reflows the code a bit to make it easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a5b9332418f25338f118358e27303cd510d54107 17-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Implement a sub-group of -Wconversion: -Wliteral-conversion. This
specifically targets literals which are implicitly converted, a those
are more often unintended and trivial to fix. This can be especially
helpful for diagnosing what makes 'const int x = 1e6' not an ICE.

Original patch authored by Jim Meehan with contributions from other
Googlers and a few cleanups from myself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
56ca35d396d8692c384c785f9aeebcf22563fe1e 17-Feb-2011 John McCall <rjmccall@apple.com> Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr. This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait; or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here. In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c71a2c0ce03ec74391ff2b43b0a966860f23786e 17-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix assertion failure in -Warray-bounds on template parameters used as arrays.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8fd0a5dfb025a51f48b7931b95efbf35d3c5dfc3 16-Feb-2011 Ted Kremenek <kremenek@apple.com> Tweak -Warray-bounds diagnostics based on feedback from Chandler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a0125d8520f65aca581378c235384e7affefa1fc 16-Feb-2011 Ted Kremenek <kremenek@apple.com> Add trivial buffer overflow checking in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7502c1d3ce8bb97bcc4f7bebef507040bd93b26f 13-Feb-2011 John McCall <rjmccall@apple.com> Give some convenient idiomatic accessors to Stmt::child_range and
Stmt::const_child_range, then make a bunch of places use them instead
of the individual iterator accessors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
46ff3034d14aaa92b530e96480741f3d5d458cb8 04-Feb-2011 Douglas Gregor <dgregor@apple.com> Before checking bitfield initialization, make sure that neither the
bit-field width nor the initializer value are type- or
value-dependent. Fixes PR8712.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
469a1eb996e1cb0be54f9b210f836afbddcbb2cc 02-Feb-2011 John McCall <rjmccall@apple.com> An insomniac stab at making block declarations list the variables they close
on, as well as more reliably limiting invalid references to locals from
nested scopes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
65197b4b0c55bb74af0450230d61ee9461223721 08-Jan-2011 Ted Kremenek <kremenek@apple.com> Add semantic checking that the "thousands grouping"
prefix in a printf format string is matched
with the appropriate conversion specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
14af91a38c8cf89f0a5e1835d7d8e0fa220e17a9 21-Dec-2010 Douglas Gregor <dgregor@apple.com> Don't try to compute the value of a value-dependent expression when
checking trivial comparisons. Fixes PR8795.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0827408865e32789e0ec4b8113a302ccdc531423 15-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix diagnostic pragmas.

Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
42499f94069c73d7a9c82da98a4245ea9fe2c526 10-Dec-2010 Bob Wilson <bob.wilson@apple.com> Do not assert on shifts of Neon polynomial types.
Most Neon shift intrinsics do not have variants for polynomial types, but
vsri_n and vsli_n do support them, and we need to properly range-check the
shift immediates for them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121509 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9f71a8f4c7a182a5236da9e747d57cc1d1bd24c2 07-Dec-2010 Jay Foad <jay.foad@gmail.com> PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f6a1648197562e0b133440d612d9af297d0a86cc 04-Dec-2010 John McCall <rjmccall@apple.com> Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ. So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
26e10bea3d2e9d2979194890e51b98ecea165a96 30-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Follow through references to catch returned stack addresses, local blocks, label addresses or references to temporaries, e.g:

const int& g2() {
int s1;
int &s2 = s1; // expected-note {{binding reference variable 's2' here}}
return s2; // expected-warning {{reference to stack memory associated with local variable 's1' returned}}
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d976ca4fcacdd965446bcfbe8cb03b4ee67cd827 30-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert r120331 since it causes spurious warnings and a possible assertion hit when self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8b2f01b56209f4bb7331292225c5300753880044 29-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Emit warnings if we are returning a reference to a local temporary.
The issue was brought to our attention by Matthieu Monrocq.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f89e55ab1bfb3ea997f8b02997c611a02254eb2d 18-Nov-2010 John McCall <rjmccall@apple.com> Calculate the value kind of an expression when it's created and
store it on the expression node. Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
08f92e3a5dead1f1ee656678a7f06e43279d6e50 17-Nov-2010 Chris Lattner <sabre@nondot.org> a metric ton of refactoring later, Sema::getLocationOfStringLiteralByte
no longer depends on Preprocessor, so we can move it out of Sema into
a nice new StringLiteral::getLocationOfByte method that can be used by
any AST client.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0833dd0675c25cbb35671c7a2006d511d5c77ce3 17-Nov-2010 Chris Lattner <sabre@nondot.org> propagate preprocessor out of StringLiteralParser. It is now
possible to create one without a preprocessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6c66f07854c1334a1ce9eae1428d61d54182a6e1 17-Nov-2010 Chris Lattner <sabre@nondot.org> push use of Preprocessor out farther.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ca1475ea0e76da6b852796610139ed9b49c8d4a6 17-Nov-2010 Chris Lattner <sabre@nondot.org> push use of Preprocessor out of getOffsetOfStringByte


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
91f54ce93bec136fb9e18740b895cf1c1339524b 17-Nov-2010 Chris Lattner <sabre@nondot.org> refactor the interface to StringLiteralParser::getOffsetOfStringByte,
pushing the dependency on the preprocessor out a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9263a3060087eb7b5954ec4ee1ff2c22227b422e 16-Nov-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR8625 and correctly interpret member-calls to static members when
producing warnings.

This feels really fragile, and I've not audited all other argument index-based
warnings. I suspect we'll grow this bug on another warning eventually. It might
be nice to adjust the argument indices when building up the attribute AST node,
as we already have to remember about the 'this' argument within that code to
produce correct errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e2b768877b77fa4e00171ee6e6443722e0f3d111 16-Nov-2010 John McCall <rjmccall@apple.com> Kill CK_Unknown and flesh out the documentation for the existing CastKinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
daa8e4e888758d55a7a759dd4a91b83921cef222 15-Nov-2010 John McCall <rjmccall@apple.com> Assorted work leading towards the elimination of CK_Unknown.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
91b6014876e9186f968f74a8975ab8fc08ef1b68 11-Nov-2010 John McCall <rjmccall@apple.com> Undo a refactor-o and base the bitfield-truncation warning on the
uncoerced value. Also, whitelist bool bitfields, which aren't
really a truncation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
15d7d12226f83de24f96f4bf4e27ebba30fef51e 11-Nov-2010 John McCall <rjmccall@apple.com> Extend the bitfield-truncation warning to initializations.
rdar://problem/8652606



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1844a6e1074a5c1fd8eadac7fc7317c3e29d4653 11-Nov-2010 John McCall <rjmccall@apple.com> When -Wconversion computes the range of a type, it uses the (bit-)range
of the enumerators rather than the actual expressible range. This is
great when dealing with opaque *values* of that type, but when computing
the range of the type for purposes of converting *into* it, it produces
warnings in cases we don't care about (e.g. enum_t x = 500;). Divide
the logic into these two cases and use the more conservative range for
targets.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e86d78cf4754a6aef2cf9a33d847aa15338e276f 10-Nov-2010 Bob Wilson <bob.wilson@apple.com> Add a variant of GCC-style vector types for ARM NEON.
NEON vector types need to be mangled in a special way to comply with ARM's ABI,
similar to some of the AltiVec-specific vector types. This patch is mostly
just renaming a bunch of "AltiVecSpecific" things, since they will no longer
be specific to AltiVec. Besides that, it just adds the new "NeonVector" enum.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
935cd6e8529edbb3b0eba660bd934b508766de37 10-Nov-2010 John McCall <rjmccall@apple.com> Tweak to bitfield-overflow warning: don't warn about storing
a positive value into a signed bitfield of the exact width of
the value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
beb22aaa22e255241d6a81e8b0a9239f5fa584f3 10-Nov-2010 John McCall <rjmccall@apple.com> Add a warning for implicit truncation of constant values due to
bitfield assignment.

Implements rdar://problem/7809123



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
091f23f1d6d4bcffd6641cda72a6831e08c02ea7 09-Nov-2010 John McCall <rjmccall@apple.com> Split out -Wconversion warnings about constant precision into their
own subcategory, -Wconstant-conversion, which is on by default.

Tweak the constant folder to give better results in the invalid
case of a negative shift amount.

Implements rdar://problem/6792488



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
82aa713bcda99f388836c2a30bb868d9c9974817 01-Nov-2010 Douglas Gregor <dgregor@apple.com> Require that the types of the parameters of a block literal are complete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9ee5ee84f0ad8246bff105786a128c7a909fdf12 21-Oct-2010 Douglas Gregor <dgregor@apple.com> When checking whether a return statement returns a stack-local
variable, handle conditional operators involving a
throw-expression. Fixes GCC DejaGNU's g++.dg/template/cond4.C.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4d8ae4d57ed18d60da4d3786fb740607aa7c3688 21-Oct-2010 Ted Kremenek <kremenek@apple.com> Previously, the printf warnings would say your arguments type was 'int' when 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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
75c29a012793292ff4578015a9113bf086156d7f 12-Oct-2010 Chris Lattner <sabre@nondot.org> fix PR7885, rejecting invalid uses of __builtin_constant_p.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b4eb64d8426c0eaa58d398961e0e74ff85063d7c 08-Oct-2010 John McCall <rjmccall@apple.com> Track the location of the context requiring an implicit conversion and use it
to white-list conversions required by system headers. rdar://problem/8232669



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
63b57aeeebb5bb758ecebf9b41b5131781f32bf3 07-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix an infinite loop, caused by unintended syntax bug (the 'break;' after 'default:' was intended to break out of the while loop).
Fixes rdar://8518859&8520617.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
372e103dab4239ec52b65b9eda69fd43c0b348d4 06-Oct-2010 John McCall <rjmccall@apple.com> Provide a slightly specialized diagnostic for tautological comparisons
of an enum value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
57a4087b349702062cd7c93735106270964be0d5 02-Oct-2010 Chris Lattner <sabre@nondot.org> kill off CheckX86BuiltinFunctionCall


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b803c66ae4deedfdc62ad63c1d2ed9e2616529b5 02-Oct-2010 Chris Lattner <sabre@nondot.org> move imperative code to declarative definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
946928f48c96bddf3cfa126862f5ab69c2d904a0 02-Oct-2010 Chris Lattner <sabre@nondot.org> diagnose errors when a builtin that require constant arguments don't have them.
For example, on:

#include <emmintrin.h>
int foo(int N) {
__m128i white2;
white2 = _mm_slli_si128(white2, N);
return 0;
}

we used to get:
fatal error: error in backend: Cannot yet select: intrinsic %llvm.x86.sse2.psll.dq

now we get:
/Users/sabre/t.c:4:11: error: argument to '__builtin_ia32_pslldqi128' must be a
constant integer
white2 = _mm_slli_si128(white2, N);
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/sabre/t.c:1:
/Volumes/Projects/cvs/llvm/Debug+Asserts/lib/clang/2.9/include/emmintrin.h:781:13: note: instantiated from:
((__m128i)__builtin_ia32_pslldqi128((__m128i)(VEC), (IMM)*8))
^ ~~~~~~~
1 error generated.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e3b159c0d4a93db8586861ff011b5a10de4ae6ef 23-Sep-2010 Ted Kremenek <kremenek@apple.com> When warning about comparing an unsigned int to being >= 0, don't issue a warning if the zero value was an
enum or was expanded from a macro.

Fixes: <rdar://problem/8414119>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dd5fa7a21ca9db9d620001ca977681a1b724e3fe 17-Sep-2010 Chris Lattner <sabre@nondot.org> fix rdar://8445858 - __sync_* intrinsics erroneously reject ObjC pointers



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114209 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c82faca0be59b072b38bed375e21bd24f1f72647 09-Sep-2010 Ted Kremenek <kremenek@apple.com> Check format strings when a called function has more than one FormatAttr (one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
95355bb53ef3145e463b98c6fd26f8f95e26e26c 09-Sep-2010 Ted Kremenek <kremenek@apple.com> It appears that technically a null format string is not warned under -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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4fe6441a558e471f2ad3c6bddf07c77332539f6b 09-Sep-2010 Ted Kremenek <kremenek@apple.com> Avoid redundant recursive calls in SemaCheckStringLiteral by just updating the expression
and trying again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7da71020b97c69b95831bd03d35e8e8404bfdea0 07-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Have Sema check for validity of CGString literal
instead of asserting in IRGen. Fixes radar 8390459.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a423e81a4d04b7c1882d2787d1189cbc14540c16 02-Sep-2010 Ted Kremenek <kremenek@apple.com> Enhance return-stack-address check (in Sema) to handle fields that themselves are references. (Fixes PR 7999; fix by Chandler Carruth).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2d88708cbe4e4ec5e04e4acb6bd7f5be68557379 26-Aug-2010 John McCall <rjmccall@apple.com> Split out a header to hold APIs meant for the Sema implementation from Sema.h.
Clients of Sema don't need to know (for example) the list of diagnostics we
support.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2de56d1d0c3a504ad1529de2677628bdfbb95cd4 25-Aug-2010 John McCall <rjmccall@apple.com> GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5baba9d98364a3525d6afa15a04cdad82fd6dd30 25-Aug-2010 John McCall <rjmccall@apple.com> More incremental progress towards not including Expr.h in Sema.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112044 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
781472fe99a120098c631b0cbe33c89f8cef5e70 25-Aug-2010 John McCall <rjmccall@apple.com> Split FunctionScopeInfo and BlockScopeInfo into their own header.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
384aff8b94bb0d1ad6c5667b90621e5699815bb2 25-Aug-2010 John McCall <rjmccall@apple.com> Remove Sema.h's dependency on DeclCXX.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9325eaf08fcccbc0d038e703f570c64daacdaa31 25-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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
60d7b3a319d84d688752be3870615ac0f111fb16 24-Aug-2010 John McCall <rjmccall@apple.com> OwningExprResult -> ExprResult. This patch brought to you by
M-x query-replace-regexp
\(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cf807c4dfdb23e8fa3f400e0b24ef5b79db7a530 19-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Generate Attr subclasses with TableGen.

Now all classes derived from Attr are generated from TableGen.
Additionally, Attr* is no longer its own linked list; SmallVectors or
Attr* are used. The accompanying LLVM commit contains the updates to
TableGen necessary for this.

Some other notes about newly-generated attribute classes:

- The constructor arguments are a SourceLocation and a Context&,
followed by the attributes arguments in the order that they were
defined in Attr.td

- Every argument in Attr.td has an appropriate accessor named getFoo,
and there are sometimes a few extra ones (such as to get the length
of a variadic argument).

Additionally, specific_attr_iterator has been introduced, which will
iterate over an AttrVec, but only over attributes of a certain type. It
can be accessed through either Decl::specific_attr_begin/end or
the global functions of the same name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2f4eaef37476ae6891ede8ba215d0f6fd093629b 17-Aug-2010 Benjamin Kramer <benny.kra@googlemail.com> Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()
and remove getStrData(). Patch by Peter Davies (with some tweaks).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ba6f816d633e3b88c38c6896c2d78d19489650f2 15-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove dead code, caught by unused function warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111091 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
de7e66256b1bdfcf6526994825a8c8fced52a31c 13-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Zap unused UnaryOperator::OffsetOf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b7f4ffe073fa419613946461a2583ba2fcb72280 12-Aug-2010 John McCall <rjmccall@apple.com> Implement -Wcast-align. The initial design of this diagnostic diverges
from GCC's in that we warn on *any* increase in alignment requirements, not
just those that are enforced by hardware. Please let us know if this causes
major problems for you (which it shouldn't, since it's an optional warning).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e737f5041a36d0befb39ffeed8d50ba15916d3da 12-Aug-2010 Douglas Gregor <dgregor@apple.com> Move Sema's headers into include/clang/Sema, renaming a few along the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
476d8b863cb65b2b5833235d97315cdb46e6f5aa 11-Aug-2010 Benjamin Kramer <benny.kra@googlemail.com> Random temporary string cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f871d0cc377a1367b519a6cce26be74607566eba 07-Aug-2010 John McCall <rjmccall@apple.com> Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths. Avoids a separate allocation and
another word of overhead in cases needing inheritance paths. Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
68957a919084ab8bbd1f01d534db1d6f31d0f459 04-Aug-2010 Ted Kremenek <kremenek@apple.com> Teach SemaChecking::CheckReturnStackAddr about ImplicitCastExprs that convert values to an lvalue. This allows us to warn (again) about returning references to stack variables. (fixes PR 7812).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
99c40bb13b523d58d7aeb6446e4f486d6918ca58 03-Aug-2010 Nate Begeman <natebegeman@mac.com> Add support for VFP status & control operations for ARM.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bb37f50c2d0d72e1fa5b349d5f6a11fdc5acb86e 30-Jul-2010 Nate Begeman <natebegeman@mac.com> Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109814 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
96827eb52405a71c65c200949f3e644368e86454 27-Jul-2010 Michael J. Spencer <bigcheesegs@gmail.com> Revert r109428 "Hoist argument type checking into CheckFormatHandler. This is prep for scanf format"

Got errors about ASTContext being undefined with Visual Studio 2010.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f762905bdefad77f91c7c6782a9c17e6b274d393 26-Jul-2010 Ted Kremenek <kremenek@apple.com> Hoist argument type checking into CheckFormatHandler. This is prep for scanf format
string argument type checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
666a197deb75d95c78ddd39274af1a54240828d8 26-Jul-2010 Ted Kremenek <kremenek@apple.com> Consolidate #args checking for scanf/printf format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ff331c15729f7d4439d253c97f4d60f2a7ffd0c6 25-Jul-2010 Douglas Gregor <dgregor@apple.com> Remove the vast majority of the Destroy methods from the AST library,
since we aren't going to be calling them ever.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109377 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f60946222721d9ba3c059563935c17b84703187a 23-Jul-2010 Douglas Gregor <dgregor@apple.com> Vectors are not integer types, so the type system should not classify
them as such. Type::is(Signed|Unsigned|)IntegerType() now return false
for vector types, and new functions
has(Signed|Unsigned|)IntegerRepresentation() cover integer types and
vector-of-integer types. This fixes a bunch of latent bugs.

Patch from Anton Yartsev!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1e51c200b17cb6b0238c10a8760ae04765688f16 20-Jul-2010 Ted Kremenek <kremenek@apple.com> Hookup checking for invalid length modifiers in scanf format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6ecb950c65329f8d6ce9ad0514632df35a5ab61f 20-Jul-2010 Ted Kremenek <kremenek@apple.com> Add 'ConversionSpecifier' root class in 'analyze_format_string' namespace and
derived 'PrintfConversionSpecifier' from this class. We will do the same for
'ScanfConversionSpecifier'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
35d353b47bce29200b910371dd9b8ba7f3058ab8 20-Jul-2010 Ted Kremenek <kremenek@apple.com> Rename 'ConsumedSoFarArg' -> 'nArg' and 'OutIntPtrArg' to 'nArg' (scanf and printf checking).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
649aecf55670682efb2a04a85810eef4d038c527 20-Jul-2010 Ted Kremenek <kremenek@apple.com> Rename diagnostic so that it can be reused with scanf checking. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
baa400654bd6f8396f9a07188445ae7955b060a3 20-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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c09b6a59e02ae265fce51b8c11e2a045bcdaa888 19-Jul-2010 Ted Kremenek <kremenek@apple.com> Hook up 'invalid conversion' warning for scanf format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8d13d221cf7c1657404c611efaadf3ac19d899b3 18-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Fix a goof in my previous patch -- not all of the builtins return a value, some
fixed return types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
db4325b098eff5e9e660db19f0148423fb21f27f 18-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Improve the representation of the atomic builtins in a few ways. First, we make
their call expressions synthetically have the "deduced" types based on their
first argument. We only insert conversions in the AST for arguments whose
values require conversion to match the value type expected. This keeps PR7600
closed by maintaining the return type, but avoids assertions due to unexpected
implicit casts making the type unsigned (test case added from Daniel).

The magic is moved into the codegen for the atomic builtin which inserts the
casts as needed at the IR level to raise the type to an integer suitable for
the LLVM intrinsic. This shouldn't cause any real change in functionality, but
now we can make the builtin be more truly polymorphic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b7c21018ec1049580cf6df88db09e606550a7baa 16-Jul-2010 Ted Kremenek <kremenek@apple.com> Hook up warning for an incomplete scanlist in scanf format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
826a3457f737f1fc45a22954fd1bfde38160c165 16-Jul-2010 Ted Kremenek <kremenek@apple.com> Add most of the boilerplate support for scanf format string checking. This includes
handling the parsing of scanf format strings and hooking the checking into Sema.
Most of this checking logic piggybacks on what was already there for checking printf format
strings, but the checking logic has been refactored to support both.

What is left to be done is to support argument type checking in format strings and of course
fix the usual tail of bugs that will follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5291c3cec0dbe8ad1d8e7e67e93af2b1586d5400 13-Jul-2010 Douglas Gregor <dgregor@apple.com> When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types.

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7479ef6b5dd4903a7d832b4a4207045d7005a812 09-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Rip out the floating point return type handling from the atomic builtin. It's
wrong, and we don't handle floating point value type arguments yet anyways.
Will add correct logic for both when I finish the patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d201457cc781f1b13d0f4b1268ff934e6004cbff 09-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR7600, and correctly convert the result of an atomic builtin to the
expected value type. This is necessary as the builtin is internally represented
as only operating on integral types.

Also, add a FIXME to add support for floating point value types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
788b0fd67e1992f23555454efcdb16a19dfefac3 23-Jun-2010 Chris Lattner <sabre@nondot.org> improve altivec vector bool/pixel support, patch by Anton Yartsev
with several tweaks by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
45f9b7e8f23072d662ee1cc758f4ecb0da5e3322 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 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e4ee9663168dfb2b4122c768091e30217328c9fa 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 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a23326b5c244a03bf61ebb86db60a777ea26f926 17-Jun-2010 Nate Begeman <natebegeman@mac.com> Generate arm_neon.inc in include/clang/Basic, which provides:
1. builtins definitions for BuiltinsARM.def
2. intrinsic validation code for SemaChecking

Unsure as to whether this is the best way to handle the make dependencies or not.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106208 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d69ec16b1b03b4a97c571ff14f15769fe13c1e5a 17-Jun-2010 Nate Begeman <natebegeman@mac.com> Remove last of the bool shifts for MS VC++, patch by dimitry andric


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
61eecf5aea018ea65c9ab0bccacd2996b15c632d 14-Jun-2010 Nate Begeman <natebegeman@mac.com> Add some missing shifts
Fix multiplies by scalar
Add SemaChecking code for all immediates
Add SemaChecking-gen support to arm_neon.td


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0d15c5321a11a5fee53b17ca8e9e0d72d6192b23 13-Jun-2010 Nate Begeman <natebegeman@mac.com> Most of NEON sema checking & fix to polynomial type detection


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3bfc5f49e0e37e235bb0d33bcbcb36af9d1f84ab 09-Jun-2010 Tom Care <tcare@apple.com> Added FixIt support to printf format string checking.
- Refactored LengthModifier to be a class.
- Added toString methods in all member classes of FormatSpecifier.
- FixIt suggestions keep user specified flags unless incorrect.

Limitations:
- The suggestions are not conversion specifier sensitive. For example, if we have a 'pad with zeroes' flag, and the correction is a string conversion specifier, we do not remove the flag. Clang will warn us on the next compilation.

A test/Sema/format-strings-fixit.c
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
M lib/Sema/SemaChecking.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1c2a88cfaeb11227d3a6bf7204207e0c8cf6de6f 09-Jun-2010 Nate Begeman <natebegeman@mac.com> Implement transpose/zip/unzip & table lookup.
Test out some basic constant-checking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
26a31428f130b66f61834d1b4d1cf72f590f70b9 08-Jun-2010 Nate Begeman <natebegeman@mac.com> Since the enum values for each arch's builtins overlap, it is not appropriate to check them when compiling or other archs. Fixes a problem where compiling for NEON would use x86 sema rules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105593 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
37b6a5731a47f811d754f0d48aa93edf30e30513 08-Jun-2010 Nate Begeman <natebegeman@mac.com> Extend __builtin_shufflevector to expose the full power of the llvm shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c71a4915ca216847599d03cab4ed1c5086b0eb43 04-Jun-2010 John McCall <rjmccall@apple.com> Preserve more information from a block's original function declarator, if one
was given. Remove some unnecessary accounting from BlockScopeInfo. Handle
typedef'ed function types until such time as we decide not.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b90f4b3fb94056609da9cca5eef7358d95a363b2 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://problem/8026030>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104684 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
323ed74658bc8375278eabf074b4777458376540 06-May-2010 John McCall <rjmccall@apple.com> Rearchitect -Wconversion and -Wsign-compare. Instead of computing them
"bottom-up" when implicit casts and comparisons are inserted, compute them
"top-down" when the full expression is finished. Makes it easier to
coordinate warnings and thus implement -Wconversion for signedness
conversions without double-warning with -Wsign-compare. Also makes it possible
to realize that a signedness conversion is okay because the context is
performing the inverse conversion. Also simplifies some logic that was
trying to calculate the ultimate comparison/result type and getting it wrong.
Also fixes a problem with the C++ explicit casts which are often "implemented"
in the AST with a series of implicit cast expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103174 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
81368fbfd6d57150f66c993dc9041d62a7a32c4f 06-May-2010 Chris Lattner <sabre@nondot.org> optimize builtin_isnan/isinf to not do an extraneous extension from
float -> double (which happens because they are modelled as int(...)
functions), and add a testcase for isinf.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9498d388810d284d3970aef0d69fa4d069fd6caf 29-Apr-2010 Ted Kremenek <kremenek@apple.com> Add FunctionDecl::isVariadic() to match BlockDecl::isVariadic() and ObjCMethodDecl::isVariadic().
Do some minor refactoring along the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8ecdb65716cd7914ffb2eeee993fa9039fcd31e8 29-Apr-2010 Douglas Gregor <dgregor@apple.com> Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.

This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.

OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.

There are two major caveats to this patch:

1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.

2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.

Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5cf86ba6b5a724bf91cb52feade1158f1fbeb605 24-Apr-2010 Anders Carlsson <andersca@mac.com> Actually produce base paths for CastExprs of kind CK_DerivedToBase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
80971bdba20b5b280a00b7b9829026b33d3206f9 24-Apr-2010 Anders Carlsson <andersca@mac.com> isValue is set to false by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
88465d3e996e627bbaa11099b039ddab66d5af2c 24-Apr-2010 Anders Carlsson <andersca@mac.com> Add an InheritancePath parameter to the ImplicitCastExpr constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5e8965525282a48fd34af05183b8c3705a5b00d5 19-Apr-2010 Eric Christopher <echristo@apple.com> Remove the argument number from the constant integer diagnostic.
Update all of the testcases accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101795 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
691ebc3f3225542e5abd85e107ebdbec907cf510 17-Apr-2010 Eric Christopher <echristo@apple.com> Consolidate most of the integer constant expression builtin requirement
checking into a single function and use that throughout. Remove some
now unnecessary diagnostics and update tests with now more accurate
diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d6e44a3c4193bd422bfa78c8086fb16bb2168e34 17-Apr-2010 Douglas Gregor <dgregor@apple.com> Collapse the three separate initialization paths in
TryStaticImplicitCast (for references, class types, and everything
else, respectively) into a single invocation of
InitializationSequence.

One of the paths (for class types) was the only client of
Sema::TryInitializationByConstructor, which I have eliminated. This
also simplified the interface for much of the cast-checking logic,
eliminating yet more code.

I've kept the representation of C++ functional casts with <> 1
arguments the same, despite the fact that I hate it. That fix will
come soon. To satisfy my paranoia, I've bootstrapped + tested Clang
with these changes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ccfa9639f8d09733bcf1c2572c5bd3daba5bd632 16-Apr-2010 Eric Christopher <echristo@apple.com> Expand the argument diagnostics for too many arguments and give
both number seen and number expected.

Finishes fixing PR6501.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101442 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d77b9a29651d748f0e30a8dad8969635fc04f725 16-Apr-2010 Eric Christopher <echristo@apple.com> Expand argument diagnostic for too few arguments to give the number
of arguments both seen and expected.

Fixes PR6501.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3aae6093dd8f3aecb66d7ff1f4b44e6a86765db4 07-Apr-2010 John McCall <rjmccall@apple.com> Teach -Wsign-compare to treat 1 << blah as "idiomatically non-negative".
Fixes a spurious warning in LLVM.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9c127392efe91dadacbe28ca16b8a9a5fa7990b3 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Do not mark the destructor of a function parameter's type. Fixes PR6709.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7eff7c4153faf45b19b5919ef409ee5f6794eb25 25-Mar-2010 Daniel Dunbar <daniel@zuster.org> Remove support for nand atomic builtins. They are inconsistently implemented in
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6ee765348b2855c702fa593fb030ef6abe0d01f6 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 function

Fixes PR 6697.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dbdbaaf34f798fa5cabec273c4b9397b3fd6a98c 20-Mar-2010 Ted Kremenek <kremenek@apple.com> Refactor CFG-based warnings in Sema to be run by a worked object called AnalysisBasedWarnings.
This object controls when the warnings are executed, allowing the client code
in Sema to selectively disable warnings as needed.

Centralizing the logic for analysis-based warnings allows us to optimize
when and how they are run.

Along the way, remove the redundant logic for the 'check fall-through' warning
for blocks; now the same logic is used for both blocks and functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a2936be04fb800d93a0a8d3358f35c7b3b2ded16 19-Mar-2010 John McCall <rjmccall@apple.com> Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f6ac97b101c8840efa92bf29166077ce4049e293 16-Mar-2010 Benjamin Kramer <benny.kra@googlemail.com> Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f715ca12bfc9fddfde75f98a197424434428b821 16-Mar-2010 Douglas Gregor <dgregor@apple.com> Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
aea67dbd653a2dd6dd5cc2159279e81e855b2482 15-Mar-2010 Douglas Gregor <dgregor@apple.com> Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.

Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,
SourceManager::getSpelling()).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d1b47bf17fde73fac67d8664bd65273742c00ecd 11-Mar-2010 John McCall <rjmccall@apple.com> Warn about comparing an unsigned expression with 0 in tautological ways.
Patch by mikem!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9ea9bdbc14374f7bacdb50d3e52c664ff12150ff 02-Mar-2010 Douglas Gregor <dgregor@apple.com> Keep an explicit stack of function and block scopes, each element of
which has the label map, switch statement stack, etc. Previously, we
had a single set of maps in Sema (for the function) along with a stack
of block scopes. However, this lead to funky behavior with nested
functions, e.g., in the member functions of local classes.

The explicit-stack approach is far cleaner, and we retain a 1-element
cache so that we're not malloc/free'ing every time we enter a
function. Fixes PR6382.

Also, tweaked the unused-variable warning suppression logic to look at
errors within a given Scope rather than within a given function. The
prior code wasn't looking at the right number-of-errors count when
dealing with blocks, since the block's count would be deallocated
before we got to ActOnPopScope. This approach works with nested
blocks/functions, and gives tighter error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97518 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e3fc54790250076e33ad25b14e5be293514fe5ea 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
efaff195ba1fa55b6fe0b0b2435b81451387d241 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7f70dc85d5055c19c8003f43a59135de211ad1b9 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 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c0cd21d2a3301a7a88e0052aebdd09c2441f826d 23-Feb-2010 John McCall <rjmccall@apple.com> Don't assert on compound assignment operators that operate in FP types when
the result is integral. Fixes <rdar://problem/7676608>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
72919a334752bc87001a7e3a0b6e5892768fac20 23-Feb-2010 Ted Kremenek <kremenek@apple.com> Move the rest of the unreachable code analysis from libSema
to libAnalysis (with only the error reporting in libSema).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8de3cc6827afb70f4a6ce278d30549ff92a2fe49 23-Feb-2010 Ted Kremenek <kremenek@apple.com> Simplify check for basic block with a CXXTryStmt terminator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3d2eed823d534ee370cfd7742c1e96ab3ee9a80b 23-Feb-2010 Ted Kremenek <kremenek@apple.com> Start moving some of the logic for the unreachable code analysis out of libSema
and into libAnalysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f067d8eecfd56a56b4192882bf86d0857c92dcc5 23-Feb-2010 Ted Kremenek <kremenek@apple.com> Convert use of std::queue to llvm::SmallVector and fix buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
133a6aab12ae3706e83da7c1f2fb15316efc12c2 23-Feb-2010 Ted Kremenek <kremenek@apple.com> Use SmallVectorImpl::iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1e025f2e559a884a3be5db2c784cdd865352e17b 23-Feb-2010 Ted Kremenek <kremenek@apple.com> Simplify logic for determining values of 'ReturnsVoid' and 'HasNoReturn' flags.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3b1e26b708e8d00d4ba10ff857201bae2aff6bae 16-Feb-2010 Benjamin Kramer <benny.kra@googlemail.com> Rename argument so the name reflects what it's doing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4e4b30ec62d78b24e6556fea2624855c193d0e3e 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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e771a7ac11fb27f0e734e5de4d858f2c268895e5 15-Feb-2010 Benjamin Kramer <benny.kra@googlemail.com> Add Sema support for __builtin_fpclassify by extending the existing check for __builtin_isinf and friends. Part of PR6083.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1497bffe829d082dd1d1927dc80ea08dcf1fcb49 11-Feb-2010 Ted Kremenek <kremenek@apple.com> Uncomment lines I never meant to have left commented in a commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5c41ee8c49995fb4fd76d686b239c15cbab261ea 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). This is similar to GCC's
checking.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0e5675de2b67eeca754754ae8d3dacba425a38e8 10-Feb-2010 Ted Kremenek <kremenek@apple.com> Convert tabs to spaces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4855a52d2a4598883deafefea9029f454a4343ee 06-Feb-2010 Anders Carlsson <andersca@mac.com> Don't diagnose missing noreturns for uninstantiated templates. Fixes PR6247.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
04a67a6aa3dfdc92d57f7f8d93ba397348c868a4 05-Feb-2010 John McCall <rjmccall@apple.com> Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
74d56a168966ff015824279a24aaf566180ed97d 04-Feb-2010 Ted Kremenek <kremenek@apple.com> Move ParseFormatString() and FormatStringHandler back into the analyze_printf namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
68c6c9a21e2d9d587477e07522fe55769d3aa26a 02-Feb-2010 John McCall <rjmccall@apple.com> Mark dtors for parameter variables and eliminate some redundant type munging.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4f9506a27cb6b865bf38beea48eadfa9dc93f510 02-Feb-2010 John McCall <rjmccall@apple.com> Access control for implicit destructor calls. Diagnostic could be orders of
magnitude clearer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
31310a21fb2a9f13950f864f681c86080b05d5b2 01-Feb-2010 Sebastian Redl <sebastian.redl@getdesigned.at> In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
105d41c0a4bf4dc4b210647ac704e245749a981d 01-Feb-2010 Ted Kremenek <kremenek@apple.com> Use early return as suggested by Cristian Draghici.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
180f2840d1d8bcb2139bfb53e2d88eda280e939e 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' or
'short'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d17e340e2d516139931768697bf080f60920ba9d 01-Feb-2010 Sam Weinig <sam.weinig@gmail.com> Fix for PR5185. C99 [*] VLA notation should be disallowed in function definitions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94972 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d635c5fcc45c952b75743dd2f4c86d6950e4954e 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!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
31f8e32788adb299acad455363eb7fd244642c82 30-Jan-2010 Ted Kremenek <kremenek@apple.com> Be a little more permissive than C99: allow 'unsigned' to be used for
the field width and precision of a format specifier instead of just
'int'. This matches GCC, and fixes <rdar://problem/6079850>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f88c8e02da48afea6a04091f675af5c4facd99f1 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Switch Sema over to using the new implementation of format string
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
808015a18bd97781ce437831a95a92fdfc8d5136 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Alternate format string checking: issue warnings for incomplete format specifiers.

In addition, move ParseFormatString() and FormatStringHandler() from
the clang::analyze_printf to the clang namespace. Hopefully this will
resolve some link errors on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
26ac2e07b46bfb4d4f00752c96481c0a98c79c69 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Alternate format string checking: issue a warning for invalid conversion specifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
07d161f38e708a91486bf1c031d525faebbb249d 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Alternate format string checking: check for excess data arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
da51f0d136df131a0137c0ec1069fb586d8a296a 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Alternate format string checking: check if the number of format specifiers exceeds the number of arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e82d804ee761006250543d6fe6e98ee7896cd756 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Alternate format string checking: warn of '%n' as being potentially insecure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0d27735c51f5bd392e673cf39a675e14e9442387 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Add precision/field width checking to AlternateCheckPrintfString().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e0e5313c25f3870d0d18fc67e1b3a3a0e1ef8e07 29-Jan-2010 Ted Kremenek <kremenek@apple.com> Start fleshing out Sema::AlternateCheckPrintfString():
- Add an anonymous class 'CheckPrintfHandler' which will do the
checking of specific format specifiers
- Add checking for using the '@' conversion specifier outside
an ObjC string literal
- Add checking for null characters within the string


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ce7024e8a3793b05861a4904ecdb1272924ada14 28-Jan-2010 Ted Kremenek <kremenek@apple.com> Add placeholder function in Sema for new format string checking logic.
This function will use the format string parsing logic in libAnalysis,
and once it is shown to be better than the current implementation it
will replace AlternateCheckPrintfString() entirely.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8acc9f6370865e200f1bf63dee5c48d8c28e2b06 28-Jan-2010 Ted Kremenek <kremenek@apple.com> Fix 80 col violation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f291976ecf537dc4f2d5537b1664d47ff4b94865 28-Jan-2010 Ted Kremenek <kremenek@apple.com> Remove invalid conversion specifiers from format string checking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1309f9a3b225ea846e5822691c39a77423125505 25-Jan-2010 Ted Kremenek <kremenek@apple.com> Split libAnalysis into two libraries: libAnalysis and libChecker.

(1) libAnalysis is a generic analysis library that can be used by
Sema. It defines the CFG, basic dataflow analysis primitives, and
inexpensive flow-sensitive analyses (e.g. LiveVariables).

(2) libChecker contains the guts of the static analyzer, incuding the
path-sensitive analysis engine and domain-specific checks.

Now any clients that want to use the frontend to build their own tools
don't need to link in the entire static analyzer.

This change exposes various obvious cleanups that can be made to the
layout of files and headers in libChecker. More changes pending. :)

This change also exposed a layering violation between AnalysisContext
and MemRegion. BlockInvocationContext shouldn't explicitly know about
BlockDataRegions. For now I've removed the BlockDataRegion* from
BlockInvocationContext (removing context-sensitivity; although this
wasn't used yet). We need to have a better way to extend
BlockInvocationContext (and any LocationContext) to add
context-sensitivty.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94406 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4a415670481424a210df419a9f96e29db9939106 22-Jan-2010 Mike Stump <mrs@apple.com> Wire up the new range reporting for unreachable code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b5c775575b496c03d862ea03587a9f1d74193c9f 22-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings with respect to dead member and
dead array references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94115 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2d6ceab0ad062989ecb7b8666c85e58a2fcd95ce 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings for with respect to dead functional casts in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
44582300b63ac128989643adcd12b6349b67abe4 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings for with respect to c-style casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e5fba7058ce34cc3d75e16e777ec6fc8096183f8 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings for with respect to ? :.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
45db90de59f6effb7bd9a55660ca97aa3feadc6c 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings for with respect to compound
assignments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
55f988efeb08b84c2dd9e4c05990b88c81fe2b58 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings with respect to dead binary and
unary operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4c45aa1b00b91847acfb082acfaced3ffa294d1d 21-Jan-2010 Mike Stump <mrs@apple.com> Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls. Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges. All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f8c4921c73d73123e2b79221ad4f1775ce984cfd 21-Jan-2010 Mike Stump <mrs@apple.com> Move some recent checking code into SemaChecking instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
199c3d6cd16aebbb9c7f0d42af9d922c9628bf70 11-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0acc311bf73c85fd34ce6f89a4e786b7ecd214aa 06-Jan-2010 John McCall <rjmccall@apple.com> Don't assert when dealing with unsigned casts of lvalues. Fixes PR5961.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
60fad45739b764886f707bd204eae9ecce6db1f2 06-Jan-2010 John McCall <rjmccall@apple.com> Derive tighter ranges for & and >> in the conversion-checking code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f2370c9b4aade940e2253b5b33262ba507d1d71f 06-Jan-2010 John McCall <rjmccall@apple.com> Significantly rework the calculation of effective integer-expression ranges
for -Wsign-compare and -Wconversion, and use that coordinated logic to drive
both diagnostics. The new logic works more transparently with implicit
conversions, conditional operators, etc., as well as bringing -Wconversion's
ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to
-Wsign-compare.

Fixes PRs 5887, 5937, 5938, and 5939.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
724d7fc12c34944e43388ab2b35a076132e3e76e 05-Jan-2010 Ted Kremenek <kremenek@apple.com> Remove stale comment. We already do format string checking for functions with the format attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
51313c39c84407dd6a323be99a8c322bf8d052a9 05-Jan-2010 John McCall <rjmccall@apple.com> Move the -Wconversion logic into SemaChecking.cpp. There's a fair amount of
overlap between this and -Wsign-compare, which is why I want them in the same
place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ba26e58c64b4f6233dfc4bcd3ef6ce83aab47ffc 05-Jan-2010 John McCall <rjmccall@apple.com> Move the -Wsign-compare logic into SemaChecking.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fee667f35e64751baa7fefe70b4e7bab06c8cd86 23-Dec-2009 Eric Christopher <echristo@apple.com> Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
813b70d6db54dbf149cfaa14ec7502142121d86f 22-Dec-2009 Chris Lattner <sabre@nondot.org> fix a bug handling the gnu ?: extension. Patch by Storlek on IRC,
who prefers to be stealthy and mysterious.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9aef7263d84d9224575e113878cfbb06b8343cbf 04-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR5679: make __builtin_prefetch a bit more flexible in what it accepts
as a constant integer. Also, some minor cleanup and improvements to the
diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4a2614e94672c47395abcde60518776fbebec589 17-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Adjust format attribute index for implicit object arguments. Fixes PR5521.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a4923eb7c4b04d360cb2747641a5e92818edf804 16-Nov-2009 Douglas Gregor <dgregor@apple.com> First part of changes to eliminate problems with cv-qualifiers and
sugared types. The basic problem is that our qualifier accessors
(getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at
the current QualType and not at any qualifiers that come from sugared
types, meaning that we won't see these qualifiers through, e.g.,
typedefs:

typedef const int CInt;
typedef CInt Self;

Self.isConstQualified() currently returns false!

Various bugs (e.g., PR5383) have cropped up all over the front end due
to such problems. I'm addressing this problem by splitting each
qualifier accessor into two versions:

- the "local" version only returns qualifiers on this particular
QualType instance
- the "normal" version that will eventually combine qualifiers from this
QualType instance with the qualifiers on the canonical type to
produce the full set of qualifiers.

This commit adds the local versions and switches a few callers from
the "normal" version (e.g., isConstQualified) over to the "local"
version (e.g., isLocalConstQualified) when that is the right thing to
do, e.g., because we're printing or serializing the qualifiers. Also,
switch a bunch of

Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType()

expressions over to

Context.hasSameUnqualifiedType(T1, T2)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9e6b37a9f1d499e7ca0950edacd0b6569e491d7f 30-Oct-2009 Chris Lattner <sabre@nondot.org> warn about returning the address of a label.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85576 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a2813cec2605ce7878d1b13471d685f689b251af 23-Oct-2009 Douglas Gregor <dgregor@apple.com> Eliminate QualifiedDeclRefExpr, which captured the notion of a
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g.,

namespace N { int i; }
int j = N::i;

Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.

Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
73c39abdbb79927605d740c93dd9629e3e4f9bfe 20-Oct-2009 Eli Friedman <eli.friedman@gmail.com> Remove default argument for ImpCastExprToType. Add appropriate argument
to all callers. Switch a few other users of CK_Unknown to proper cast
kinds.

Note that there are still some situations where we end up with
CK_Unknown; they're pretty easy to find with grep. There
are still a few missing conversion kinds, specifically
pointer/int/float->bool and the various combinations of real/complex
float/int->real/complex float/int.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84623 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ce94049b69f75b44c18584fe79cd238978b6b0d5 25-Sep-2009 Douglas Gregor <dgregor@apple.com> Fix checking for a null pointer constant when the expression itself is
value-dependent. Audit (and fixed) all calls to
Expr::isNullPointerConstant() to provide the correct behavior with
value-dependent expressions. Fixes PR5041 and a crash in libstdc++
<locale>.

In the same vein, properly compute value- and type-dependence for
ChooseExpr. Fixes PR4996.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
21fb98ee003e992b0c4e204d98a19e0ef544cae3 23-Sep-2009 Chris Lattner <sabre@nondot.org> implement support for __builtin_eh_return_data_regno on x86-32 and x86-64.
This implements PR5034 and rdar://6836445.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
f015b034159d40e7033309e50036804eb1971787 22-Sep-2009 Daniel Dunbar <daniel@zuster.org> Revert "Switch a few clients over to StringLiteral::getString.", this is breaking some projects, but I don't have a test case yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
df4eee9b035cc4b95b1ea72635e7429d06b0ecc8 22-Sep-2009 Daniel Dunbar <daniel@zuster.org> Switch a few clients over to StringLiteral::getString.
- Switching all of them out-of-my-current-scope-of-interest, sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
183700f494ec9b6701b6efe82bcb25f4c79ba561 22-Sep-2009 John McCall <rjmccall@apple.com> Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7814e6d6645d587891293d59ecf6576defcfac92 12-Sep-2009 Douglas Gregor <dgregor@apple.com> Remove unnecessary ASTContext parameter from FunctionDecl::isBuiltinID

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4ca606e898293ae58f1793f988500e2218c7a9be 08-Sep-2009 Chris Lattner <sabre@nondot.org> reject returning a block expr even when it has parens and casts in the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
83f6faf37d9bf58986bedc9bc0ea897a56b4dbad 01-Sep-2009 Douglas Gregor <dgregor@apple.com> Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocate
space within the MemberExpr for the nested-name-specifier and its
source range. We'll do the same thing with explicitly-specified
template arguments, assuming I don't flip-flop again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0979c805475d1ba49b5d6ef93c4d2ce6d2eab6ed 31-Aug-2009 Douglas Gregor <dgregor@apple.com> Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we will
also be adding explicit template arguments as an additional
"adornment". No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9ac6f62a77be5b281a7ddc24a16669b457ac47c2 31-Aug-2009 Eli Friedman <eli.friedman@gmail.com> PR4836, part 1: add Sema support for __builtin_isnan and friends; they
are apparently used by Solaris libc despite the fact that clang claims
to be compatible with gcc 4.2, which doesn't support them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bd4c4aebe6035e7a7125470cc9f0f92511230ee3 27-Aug-2009 Douglas Gregor <dgregor@apple.com> When a member reference expression includes a qualifier on the member
name, e.g.,

x->Base::f()

retain the qualifier (and its source range information) in a new
subclass of MemberExpr called CXXQualifiedMemberExpr. Provide
construction, transformation, profiling, printing, etc., for this new
expression type.

When a virtual function is called via a qualified name, don't emit a
virtual call. Instead, call that function directly. Mike, could you
add a CodeGen test for this, too?



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e9f42087aabfdb6b2afc35c7e38ac65da063b409 26-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> update to CXXFunctionalCastExpr to support ir-gen for
type convesions of class objects [class.conv]. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0f436560640a1cff5b6d96f80f540770f139453f 17-Aug-2009 David Chisnall <csdavec@swan.ac.uk> Initial patch to support definitions of id and Class from headers in Objective-C code.

This currently breaks test/SemaObjC/id-isa-ref.m and issues some spurious warnings when you attempt to assign a struct objc_class* value to a Class variable. The test case probably should fail as it's written, because without the definition of Class the compiler should not assume struct objc_class* is a valid receiver type, but it's left broken because it would be nice if we could get that passing too for the special case of isa.

Approved by snaroff.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d406bf0e8c17012110a8476d03c6f9a97b56ecf7 16-Aug-2009 Anders Carlsson <andersca@mac.com> Move builtin call checking out into a separate function, make CheckFunctionCall and CheckBlockCall return bool instead. No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a88dc3079bedf70a5cfc39791727e43a10383006 12-Aug-2009 Nate Begeman <natebegeman@mac.com> Fix a fixme by allocating ShuffleVectorExprs in the Context


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cdb61979755c1c0699c1ee25eede9a50bf94d29b 08-Aug-2009 Anders Carlsson <andersca@mac.com> More CastKind work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4403a5e1f956fa86d515492dbe7c7a2817d8780d 06-Aug-2009 Ryan Flynn <pizza@parseerror.com> add support for FreeBSD's format(printf0,x,y) attribute; allows null format string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ac5fc7c6bcb494b60fee7ce615ac931c5db6135e 04-Aug-2009 Mike Stump <mrs@apple.com> Canonicalize else.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3503d041ca8a3535a1c1a30005a6b18ae7aed5db 31-Jul-2009 Anders Carlsson <andersca@mac.com> Add CK_DerivedToBase and use it PerformObjectMemberConversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6217b80b7a1379b74cced1c076338262c3c980b3 29-Jul-2009 Ted Kremenek <kremenek@apple.com> Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsRecordType() -> Type::getAs<RecordType>()
Type::getAsPointerType() -> Type::getAs<PointerType>()
Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsTagType() -> Type::getAs<TagType>()

And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
35366a67baa970c287c714c957cf78a4131cf60d 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1a1a6e2bd4c5aefd7fd643cf25915f9623a02e59 16-Jul-2009 Ted Kremenek <kremenek@apple.com> Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
40b598eea1310ec9ed554d56ce3e25b34c585458 30-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove the ASTContext parameter from the attribute-related methods of Decl.
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.

This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d966a55bccae13f34d18958877c5e71dd643a125 28-Jun-2009 Anders Carlsson <andersca@mac.com> Move the check for vprintf* functions inside of SemaCheckStringLiteral. Fixes PR4470.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8f031b3b14e726b093fb8693c2be4ab6d779e331 27-Jun-2009 Anders Carlsson <andersca@mac.com> Implement support for the format_arg attribute. Fixes PR4442.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
68584ed35ad819a1668e3f527ba7f5dd4ae6a333 18-Jun-2009 Douglas Gregor <dgregor@apple.com> Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b92abb460be254fe577ccb95355ff7debf6a7719 02-Jun-2009 Eli Friedman <eli.friedman@gmail.com> PR4142: Add %m format string specifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
12b97ff9ce1412e388444f03049bfa6ad1bb5eb9 25-May-2009 Chris Lattner <sabre@nondot.org> tweak non-null check to put the caret on the function, but underline the
argument. This avoids the argument from being silenced when the argument is
the NULL macro, which is defined in a system header. This also makes the output
a bit nicer, e.g.:

t.c:8:3: warning: null passed to a callee which requires a non-null argument
func1(NULL, cp2, i1);
^ ~~~~

vs something like:

t.c:8:10: warning: argument is null where non-null is required
func1(NULL, cp2, i1);
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e898f8a94947c6074d76ff83943b47d5bbdf210d 21-May-2009 Fariborz Jahanian <fjahanian@apple.com> Check on null arguments in the presense of nonnull attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a1f3dba77b7418575c1ff539ffa74ebaa068280c 20-May-2009 Zhongxing Xu <xuzhongxing@gmail.com> add header to be built by gcc 4.3 on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cde01739dffe574c53a6ba1def1a57a2cc7b4a8b 20-May-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for __builtin_shufflevector.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
725165f2846bd37d3aaf863747fa30126992085e 18-May-2009 Fariborz Jahanian <fjahanian@apple.com> more printf attribute on block declaration and
checking when block is envoked. In progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
42ae3e81a811362c0bf78deb71b72455aadff772 13-May-2009 Ted Kremenek <kremenek@apple.com> Fix <rdar://problem/6880975> [format string] Assertion failed: (Arg < NumArgs && "Arg access out of range!").

For format string checking, only check the type of the format
specifier for non-vararg functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
eebd9d2165a705ce6a8a6b6a7327864189d02785 13-May-2009 Chris Lattner <sabre@nondot.org> add support for __sync_nand_and_fetch and __sync_fetch_and_nand,
rdar://6880573


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e7ac0a94f1dee3fae9292eb8372962b6d70b3e0d 08-May-2009 Chris Lattner <sabre@nondot.org> Fix the atomics sema code to convert operands to the argument types
of the underlying _N builtin, not the the type of the pointee of the
actual type. This ensures that atomics involving pointers end up
using the correct integer type when they are resolved, avoiding
aborts in codegen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
5caa370ea6f70bd3e7e4a9cc3b69ac1a849c8534 08-May-2009 Chris Lattner <sabre@nondot.org> reimplement __sync_* builtins to be variadic and to follow the same
semantic rules that gcc and icc use. This implements the variadic
and concrete versions as builtins and has sema do the
disambiguation. There are probably a bunch of details to finish up
but this seems like a large monotonic step forward :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71212 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
586d6a81428da2d1ce70bcb98df29d749361cbf3 03-May-2009 Eli Friedman <eli.friedman@gmail.com> Fix silly mistake that was breaking tests. Sorry for any inconvenience.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d875fed28578835de89cd407e9db4be788596d7c 03-May-2009 Eli Friedman <eli.friedman@gmail.com> Add Sema support for __builtin_setjmp/__builtin_longjmp. The primary
reason for adding these is to error out in CodeGen when trying to generate
them instead of silently emitting a call to a non-existent function.

(Note that it is not valid to lower these to setjmp/longjmp; in addition
to that lowering being different from the intent, setjmp and longjmp
require a larger buffer.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
655f141f4d4c92eeebcc880211313e84c0a8b2f2 29-Apr-2009 Chris Lattner <sabre@nondot.org> implement -Wformat-security properly, which is enabled by default.
This enables one specific class of non-literal format warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1cd3e1f72c3a1c256fb6a5c3d4512bca1f1b751d 29-Apr-2009 Chris Lattner <sabre@nondot.org> code simplification, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b9fc856696defc78750fdb4977c4dce34307a7f1 29-Apr-2009 Chris Lattner <sabre@nondot.org> minor code cleanup


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
397195bf3077fb42789b326f69f7d417227a0588 17-Apr-2009 Mike Stump <mrs@apple.com> Fixup semantic analysis for nested blocks, and allow block literal
expressions that can be of static duration to be returned.
Radar 6786551


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
cd9c51433c06705645d1ee5a13da3c9a72d7d025 15-Apr-2009 Steve Naroff <snaroff@apple.com> Fix <rdar://problem/6786597> varargs not supported for Blocks under clang.

Teach Sema::SemaBuiltinVAStart() about blocks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69201 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fd942628abfe30e30427875db953222ae99b4325 13-Apr-2009 Steve Naroff <snaroff@apple.com> Move/update recent FIXME (wrt UTF-8 checking for ObjC @-strings).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b59212a6e494d2c364b54462f545833902c29158 01-Apr-2009 Steve Naroff <snaroff@apple.com> CodeGenModule::GetAddrOfConstantCFString():
- Finish up support for converting UTF8->UTF16 to support ObjC @"string" constants.

Remove warning from CheckObjCString.

As the FIXME in the test case indicates, I still have a bug to work out (apparently with \u handling).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
082d936a5b8323ac2c04558d8bca277a647831a3 20-Mar-2009 Ted Kremenek <kremenek@apple.com> Fix <rdar://problem/6704086> by allowing the format string checking in Sema to
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67404 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3d692df4b9c58895f9843b03543ec57447c93679 27-Feb-2009 Ted Kremenek <kremenek@apple.com> When checking printf-arguments for functions with '__attribute__ ((format (printf, X, Y)))'
set HasVAListArg to true when 'Y' is 0 (i.e., ignore the data arguments).

This fixes <rdar://problem/6623513>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
72564e73277e29f6db3305d1f27ba408abb7ed88 27-Feb-2009 Douglas Gregor <dgregor@apple.com> Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types.

Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.

As part of this, some types have been renamed:

TypeOfExpr -> TypeOfExprType
FunctionTypeProto -> FunctionProtoType
FunctionTypeNoProto -> FunctionNoProtoType

There shouldn't be any functionality change...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
403bc2bd9edffe51d73776643fa87696c9417678 19-Feb-2009 Daniel Dunbar <daniel@zuster.org> Arguments to unordered comparison builtins may need implicit casts.
- <rdar://problem/6094103> sema fails to promote type arguments to __builtin_isgreater (and friends)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
443e53c7845f01c8ed693ccd137abb0bd76564f6 18-Feb-2009 Chris Lattner <sabre@nondot.org> final string diagnostic issue (that I know about):
we used to not account for escapes in strings with
string concat. Before:

t.m:5:20: warning: field width should have type 'int', but argument has type 'unsigned int'
printf("\n\n" "\n\n%*d", (unsigned) 1, 1);
^ ~~~~~~~~~~~~

after:

t.m:5:23: warning: field width should have type 'int', but argument has type 'unsigned int'
printf("\n\n" "\n\n%*d", (unsigned) 1, 1);
^ ~~~~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
719e61573f27c11057ecfe0dd8f141621602c571 18-Feb-2009 Chris Lattner <sabre@nondot.org> Next step toward making string diagnostics correct: handle
escapes in the string for subtoken positioning. This gives
us working examples like:

t.m:5:16: warning: field width should have type 'int', but argument has type 'unsigned int'
printf("\n\n%*d", (unsigned) 1, 1);
^ ~~~~~~~~~~~~

where before the caret pointed two spaces to the left.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2197c963543397777919cec22b65feb31a9ddf79 18-Feb-2009 Chris Lattner <sabre@nondot.org> Fix some issues handling sub-token locations that come from macro expansions.
We now emit:

t.m:6:15: warning: field width should have type 'int', but argument has type 'unsigned int'
printf(STR, (unsigned) 1, 1);
^ ~~~~~~~~~~~~
t.m:3:18: note: instantiated from:
#define STR "abc%*ddef"
^

which has the correct location in the string literal in the note line.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64936 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0150cdfe9486686e899cf038f1c6a6083e7f8094 18-Feb-2009 Chris Lattner <sabre@nondot.org> only get the spelling of a token to get its length if
it needs cleaning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d0d082f2eba4e3ed4eb467d76fd227c6dcd6cce7 18-Feb-2009 Chris Lattner <sabre@nondot.org> use the full spelling of a string literal token so that trigraphs
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);
^ ~~~~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
60800081361b0ffc114877b8abbc81cb57b4edf6 18-Feb-2009 Chris Lattner <sabre@nondot.org> Start improving diagnostics that relate to subcharacters of string literals.
First step, handle diagnostics in StringLiteral's that are due to token pasting.

For example, we now handle:
id str2 = @"foo"
"bar"
@"baz"
" b\0larg"; // expected-warning {{literal contains NUL character}}

Correctly:

test/SemaObjC/exprs.m:17:15: warning: CFString literal contains NUL character
" b\0larg"; // expected-warning {{literal contains NUL character}}
~~~^~~~~~~

There are several other related issues still to be done.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
690398188ea5b428f06aa13c7d4ce6eb741ad4f9 18-Feb-2009 Chris Lattner <sabre@nondot.org> rename CheckBuiltinCFStringArgument -> CheckObjCString


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3c385e5f8d9008fff18597ca302be19fa86e51f6 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Add hook to add attributes to function declarations that we know
about, whether they are builtins or not. Use this to add the
appropriate "format" attribute to NSLog, NSLogv, asprintf, and
vasprintf, and to translate builtin attributes (from Builtins.def)
into actual attributes on the function declaration.

Use the "printf" format attribute on function declarations to
determine whether we should do format string checking, rather than
looking at an ad hoc list of builtins and "known" function names.

Be a bit more careful about when we consider a function a "builtin" in
C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
370ab3f1373841d70582feac9e35c3c6b3489f63 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Make it possible for builtins to expression FILE* arguments, so that
we can define builtins such as fprintf, vfprintf, and
__builtin___fprintf_chk. Give a nice error message when we need to
implicitly declare a function like fprintf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64526 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
a316e7b735b12ce6b34961a9dcfaae34f4b08d29 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Extend builtin "attribute" syntax to include a notation for
printf-like functions, both builtin functions and those in the
C library. The function-call checker now queries this attribute do
determine if we have a printf-like function, rather than scanning
through the list of "known functions IDs". However, there are 5
functions they are not yet "builtins", so the function-call checker
handles them specifically still:

- fprintf and vfprintf: the builtins mechanism cannot (yet)
express FILE* arguments, so these can't be encoded.
- NSLog: the builtins mechanism cannot (yet) express NSString*
arguments, so this (and NSLogv) can't be encoded.
- asprintf and vasprintf: these aren't part of the C99 standard
library, so we really shouldn't be defining them as builtins in
the general case (and we don't seem to have the machinery to make
them builtins only on certain targets and depending on whether
extensions are enabled).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3e41d60eb627dc227c770f1c1c87d06909cf05fd 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Implicitly declare certain C library functions (malloc, strcpy, memmove,
etc.) when we perform name lookup on them. This ensures that we
produce the correct signature for these functions, which has two
practical impacts:

1) When we're supporting the "implicit function declaration" feature
of C99, these functions will be implicitly declared with the right
signature rather than as a function returning "int" with no
prototype. See PR3541 for the reason why this is important (hint:
GCC always predeclares these functions).

2) If users attempt to redeclare one of these library functions with
an incompatible signature, we produce a hard error.

This patch does a little bit of work to give reasonable error
messages. For example, when we hit case #1 we complain that we're
implicitly declaring this function with a specific signature, and then
we give a note that asks the user to include the appropriate header
(e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
case #2, we show the type of the implicit builtin that was incorrectly
declared, so the user can see the problem. We could do better here:
for example, when displaying this latter error message we say
something like:

'strcpy' was implicitly declared here with type 'char *(char *, char
const *)'

but we should really print out a fake code line showing the
declaration, like this:

'strcpy' was implicitly declared here as:

char *strcpy(char *, char const *)

This would also be good for printing built-in candidates with C++
operator overloading.

The set of C library functions supported by this patch includes all
functions from the C99 specification's <stdlib.h> and <string.h> that
(a) are predefined by GCC and (b) have signatures that could cause
codegen issues if they are treated as functions with no prototype
returning and int. Future work could extend this set of functions to
other C library functions that we know about.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
8189cde56b4f6f938cd65f53c932fe1860d0204c 07-Feb-2009 Ted Kremenek <kremenek@apple.com> Overhaul of Stmt allocation:
- Made allocation of Stmt objects using vanilla new/delete a *compiler
error* by making this new/delete "protected" within class Stmt.
- Now the only way to allocate Stmt objects is by using the new
operator that takes ASTContext& as an argument. This ensures that
all Stmt nodes are allocated from the same (pool) allocator.
- Naturally, these two changes required that *all* creation sites for
AST nodes use new (ASTContext&). This is a large patch, but the
majority of the changes are just this mechanical adjustment.
- The above changes also mean that AST nodes can no longer be
deallocated using 'delete'. Instead, one most do
StmtObject->Destroy(ASTContext&) or do
ASTContextObject.Deallocate(StmtObject) (the latter not running the
'Destroy' method).

Along the way I also...
- Made CompoundStmt allocate its array of Stmt* using the allocator in
ASTContext (previously it used std::vector). There are a whole
bunch of other Stmt classes that need to be similarly changed to
ensure that all memory allocated for ASTs comes from the allocator
in ASTContext.
- Added a new smart pointer ExprOwningPtr to Sema.h. This replaces
the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used
'delete' to free memory instead of a Stmt's 'Destroy' method.

Big thanks to Doug Gregor for helping with the acrobatics of making
'new/delete' private and the new smart pointer ExprOwningPtr!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
500d3297d2a21edeac4d46cbcbe21bc2352c2a28 29-Jan-2009 Chris Lattner <sabre@nondot.org> move library-specific diagnostic headers into library private dirs. Reduce
redundant #includes. Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
20c6b3b85e186cd52d5d99489132d71d498159eb 27-Jan-2009 Chris Lattner <sabre@nondot.org> Split the single monolithic DiagnosticKinds.def file into one
.def file for each library. This means that adding a diagnostic
to sema doesn't require all the other libraries to be rebuilt.

Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0eb23307222bda7ad95d968eac4e1ab30864b213 19-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Convert more expression actions to smart pointers.
Fix type of logical negation for C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d30ef87f34015d18bde20b9632032d0063d761aa 13-Jan-2009 Ted Kremenek <kremenek@apple.com> Patch by Roman Divacky:

Extend string-literal checking for printf() format string to handle conditional
ternary operators where both sides are literals.

This fixes PR 3319: http://llvm.org/bugs/show_bug.cgi?id=3319


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
1a49af9681c350fef58e677f85ccb9a77e8e9d0a 06-Jan-2009 Douglas Gregor <dgregor@apple.com> Add QualifiedDeclRefExpr, which retains additional source-location
information for declarations that were referenced via a qualified-id,
e.g., N::C::value. We keep track of the location of the start of the
nested-name-specifier. Note that the difference between
QualifiedDeclRefExpr and DeclRefExpr does have an effect on the
semantics of function calls in two ways:
1) The use of a qualified-id instead of an unqualified-id suppresses
argument-dependent lookup
2) If the name refers to a virtual function, the qualified-id
version will call the function determined statically while the
unqualified-id version will call the function determined dynamically
(by looking up the appropriate function in the vtable).

Neither of these features is implemented yet, but we do print out
qualified names for QualifiedDeclRefExprs as part of the AST printing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
56f20ae1010aa71defd7572f660b41288c56cdd1 15-Dec-2008 Eli Friedman <eli.friedman@gmail.com> Make error handling for va_start a bit more robust. Fixes PR3213.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
371f258e61e1365b951b17931a3c5ac1530fd1a0 05-Dec-2008 Chris Lattner <sabre@nondot.org> change getCurFunctionDecl to skip through Block contexts to find
the containing block. Introduce a new getCurFunctionOrMethodDecl
method to check to see if we're in a function or objc method.
Minor cleanups to other related places. This fixes rdar://6405429.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60564 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d162584991885ab004a02573a73ce06422b921fc 24-Nov-2008 Chris Lattner <sabre@nondot.org> Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first. This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
08631c5fa053867146b5ee8be658c229f6bf127c 23-Nov-2008 Chris Lattner <sabre@nondot.org> Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them. This has a bunch of follow-on
effects and requires tweaking to a whole lot of code. This causes
a regression in two tests (xfailed) by causing it to emit things like:

Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency. This is good, but I was planning to do this
as an independent patch. There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2c21a073525cdfa68e4439b7af551385dc2796ab 21-Nov-2008 Chris Lattner <sabre@nondot.org> merge some simple call diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d3a94e24ddf3fb90de76b17bd176d9ed61e66f2c 20-Nov-2008 Chris Lattner <sabre@nondot.org> remove another old-school Diag method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3c73c41cefcfe76f36b7bed72c9f1ec195490951 19-Nov-2008 Chris Lattner <sabre@nondot.org> stop calling II::getName() unnecesarily in sema


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59609 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dcd5ef12488e4c7ea844327835896ca86b609a97 19-Nov-2008 Chris Lattner <sabre@nondot.org> remove one more old-style Diag method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
fa25bbb351f4fdd977f51254119cdfc2b525ce90 19-Nov-2008 Chris Lattner <sabre@nondot.org> Switch several more Sema Diag methods over. This simplifies the
__builtin_prefetch code to only emit one diagnostic per builtin_prefetch.
While this has nothing to do with the rest of the patch, the code seemed
like overkill when I was updating it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
2def48394f6d48bde0dec2b514193c2b533265b5 17-Nov-2008 Douglas Gregor <dgregor@apple.com> Updated IdentifierResolver to deal with DeclarationNames. The names of
C++ constructors, destructors, and conversion functions now have a
FETokenInfo field that IdentifierResolver can access, so that these
special names are handled just like ordinary identifiers. A few other
Sema routines now use DeclarationNames instead of IdentifierInfo*'s.

To validate this design, this code also implements parsing and
semantic analysis for id-expressions that name conversion functions,
e.g.,

return operator bool();

The new parser action ActOnConversionFunctionExpr takes the result of
parsing "operator type-id" and turning it into an expression, using
the IdentifierResolver with the DeclarationName of the conversion
function. ActOnDeclarator pushes those conversion function names into
scope so that the IdentifierResolver can find them, of course.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
27c8dc06f65d7abcf6a7e7f64a7960c9a150ca01 29-Oct-2008 Douglas Gregor <dgregor@apple.com> Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:

- Try/Perform-ImplicitConversion now handles implicit conversions
that don't involve references.
- Try/Perform-CopyInitialization uses
CheckSingleAssignmentConstraints for C. PerformCopyInitialization
is now used for all argument passing and returning values from a
function.
- Diagnose errors with declaring references and const values without
an initializer. (Uses a new Action callback, ActOnUninitializedDecl).

We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6eec8e883de118b431e3ead5b1e604a6ac68ff6b 28-Oct-2008 Douglas Gregor <dgregor@apple.com> Rename ExplicitCCastExpr to CStyleCastExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
49badde06e066d058d6c7fcf4e628a72999b65a9 27-Oct-2008 Douglas Gregor <dgregor@apple.com> Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
- ImplicitCastExpr is (still) used for all explicit casts
- ExplicitCastExpr is now the root of all *explicit* casts
- ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
- CXXFunctionalCastExpr inherits from ExplicitCastExpr
- CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
- Added classes CXXStaticCastExpr, CXXDynamicCastExpr,
CXXReinterpretCastExpr, and CXXConstCastExpr to

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
de45428f923b38d80407dbb9ede0df504256f9f6 02-Oct-2008 Daniel Dunbar <daniel@zuster.org> Add support for format string checking of object-size checking
versions of sprintf and friends.
- Added FIXME that this mechanism should be generalized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c50a4a5f2eac14ac4c631d50b0a55cadc87700ce 17-Sep-2008 Steve Naroff <snaroff@apple.com> Sema::ActOnBlockReturnStmt(): Need to perform the UsualUnaryConversions on the return type.
Sema::CheckReturnStackAddr(): Make sure we skip over implicit casts.
Added some more test cases...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
61f40a2b67fc2046768e14f66b617e564cbcc3d8 10-Sep-2008 Steve Naroff <snaroff@apple.com> More semantic analysis for blocks...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
dd972f20dc2bd3609d833893e5c6544ac09b59a9 06-Sep-2008 Steve Naroff <snaroff@apple.com> More type checking for blocks. Still incomplete (will hopefully finish up this weekend).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d5f8a4fd4d6dfb0415b93bb7ab721bba5cab1332 03-Sep-2008 Daniel Dunbar <daniel@zuster.org> Add __builtin_object_size support.
- Currently CodeGen always returns a conservative value for this (-1
or 0 depending on the context).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
0835a3cdeefe714b4959d31127ea155e56393125 19-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add ExplicitCastExpr to replace the current CastExpr, and have ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr):

Expr
-> CastExpr
-> ExplicitCastExpr
-> ImplicitCastExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
acc5f3e42334525bf28c86471551f83dfce222d5 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
sweep so some things removed are actually used, but happen to be
included by a previous header. I tried to get rid of the obvious
examples and this was the easiest way to trim the #includes in one
fell swoop.
- We now return to regularly scheduled development.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
c4a1dea2dc56bd1357ec91b829a0b9e68229a13e 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
- Moved Sema::getCurMethodDecl() out of line (dependent on
ObjCMethodDecl via dyn_cast).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d1a0b6d3dfb208f638d3d750b588d9c0daa49289 10-Aug-2008 Chris Lattner <sabre@nondot.org> tighten up some code and some wording on diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
54b5274f2c190331438375ad114dad12ae098b57 07-Aug-2008 Ted Kremenek <kremenek@apple.com> Fix <rdar://problem/6125909>.
Unify logic in return-of-stack-check (Sema) for casts and implicit casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b77792eabf5882cf9af8cc810599b20432fda6c2 27-Jul-2008 Chris Lattner <sabre@nondot.org> change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
9801c8b47a689c0633f7cb4df984aa8c1a52a658 26-Jul-2008 Ted Kremenek <kremenek@apple.com> Format string errors should underling the format string, not the function name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
4493f79fce48cd9cbd9f55fa9d452cde736747a0 22-Jul-2008 Daniel Dunbar <daniel@zuster.org> Implement nans, prefetch, and trap builtins.

This closes <rdar://problem/6080720>, support for __builtin_constant_p
has been filed separately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
49ff7a1c8c67d56e62d3b4627463b705c0d5008c 09-Jul-2008 Ted Kremenek <kremenek@apple.com> Extend va_start checking to include __builtin_stdarg_start.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
b7cfe88e88cb4f46308de89cf3f0c81bfe624128 30-Jun-2008 Chris Lattner <sabre@nondot.org> Make a few related changes:

1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their
fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
53d0ea5f5bfa647ec23418bf3a3b7c183b51e4bd 28-Jun-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
7ff22b259d4d4729f701679e3a7f0e242365e07f 16-Jun-2008 Ted Kremenek <kremenek@apple.com> Introduce preliminary support for NSString format-string checking.
Patch by Nikita Zhuk!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52336 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
6cfda23b3768f93a6eb0b2a9135c8334a20125bb 20-May-2008 Eli Friedman <eli.friedman@gmail.com> Add __builtin_frame_address and __builtin_return_address gcc builtins to
Sema. No codegen yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
ba2561a0ab11afa64014828c759c491378ccc539 16-May-2008 Eli Friedman <eli.friedman@gmail.com> Review nit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
e801870b638e47a5734a3ea63ddfb45f1711e078 16-May-2008 Eli Friedman <eli.friedman@gmail.com> Clean up ownership per review comment.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51195 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
3e9d2530c4118e0e8207de24f9059cb3a8eb8cf4 16-May-2008 Ted Kremenek <kremenek@apple.com> Fixed another regression introduced by r51113 caused by some refactoring
in Sema::CheckFunctionCall:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html

The bug was that the logic from the helper methods used by CheckFunctionCall
were being inverted (a subtle bug). This would cause the parser to discard
any valid AST nodes involving several builtins (see patch).

This removes the last regression failure I'm seeing in the test suite: Analysis-Apple/NoReturn.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
d38617c8a50f9729c254ab76cd359af797c6739b 14-May-2008 Eli Friedman <eli.friedman@gmail.com> Implementation of __builtin_shufflevector, a portable builtin capable of
expressing the full flexibility of the LLVM shufflevector instruction.
The expected immediate usage is in *mmintrin.h, so that they don't
depend on the mess of gcc-inherited (and not completely implemented)
shuffle builtins.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp
bda0b626e74513950405c27525af87e214e605e2 16-Mar-2008 Chris Lattner <sabre@nondot.org> Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it. This follows the main
llvm tree, and allows the libraries to be built in parallel. The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in. This speeds
up parallel builds, particularly incremental ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaChecking.cpp