summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment'sRichard Smith2013-06-261-5/+15
| | | | | | | | 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. llvm-svn: 185035
* [Sema] Call CheckParmForFunctionDef on ObjC method parametersReid Kleckner2013-06-241-1/+2
| | | | | | | CheckParmForFunctionDef performs standard checks for type completeness and other things like a destructor check for the MSVC++ ABI. llvm-svn: 184740
* Extend -Wnon-pod-varargs to more cases, such as function pointers as returnRichard Trieu2013-06-221-15/+37
| | | | | | types and function pointer arrays. llvm-svn: 184616
* Provide suggested no-arg calls for overloaded member functions missing callsDavid Blaikie2013-06-211-1/+1
| | | | | | Reviewed by Richard Smith. llvm-svn: 184612
* [ms-cxxabi] Destroy temporary record arguments in the calleeReid Kleckner2013-06-211-0/+9
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 184543
* Add back a condition accidentially removed in r184470.Richard Trieu2013-06-201-1/+1
| | | | llvm-svn: 184496
* Avoid repeatedly evaluating subexpressions when checking for unsequencedRichard Smith2013-06-201-7/+37
| | | | | | | 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. llvm-svn: 184489
* Extend -Wnon-pod-varargs to check calls made from function pointers.Richard Trieu2013-06-201-5/+11
| | | | llvm-svn: 184470
* Correctly compute the index of the first string format argument when decidingEli Friedman2013-06-181-1/+1
| | | | | | whether to emit a -Wformat-security warning. <rdar://problem/14178260>. llvm-svn: 184214
* Revert "Properly consider the range of enum for range comparisons in C mode"David Majnemer2013-06-071-14/+11
| | | | | | The approach r183084 took was wrong, back it out. llvm-svn: 183575
* Properly consider the range of enum for range comparisons in C modeDavid Majnemer2013-06-021-11/+14
| | | | | | | | | 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. llvm-svn: 183084
* Patch to issue error when target of MacOS and iOS Fariborz Jahanian2013-05-281-3/+11
| | | | | | | does not support large load/store of atomic objects. // rdar://13973577 llvm-svn: 182781
* Warn on va_start() when called with a reference parameter.Nico Weber2013-05-241-0/+14
| | | | | | | | | 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. llvm-svn: 182694
* Objective-C: More cases of -Wsign-conversion notFariborz Jahanian2013-05-151-3/+5
| | | | | | | working on new Objective-C array subscripting syntax. // rdar://13855682 llvm-svn: 181940
* Objective-C: patch to issue the conversionFariborz Jahanian2013-05-151-1/+7
| | | | | | | warning when property-dot syntax is used with -Wsign-conversion. // rdar://13855394 llvm-svn: 181914
* Grab-bag of bit-field fixes:John McCall2013-05-061-2/+2
| | | | | | | | | | | | | | - 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. llvm-svn: 181252
* ArrayRef'ize Sema::CheckObjCMethodCallDmitri Gribenko2013-05-051-3/+2
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181164
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-2/+2
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* c language: diagnose use of "[*]" on any array dimensionFariborz Jahanian2013-04-291-1/+3
| | | | | | | | in the parameter of a function definition. Currently, it crashes in irgen if it is on other than the 1st dimension. // rdar://13705391 llvm-svn: 180732
* Handle "typeof" in Objective-C format string checking. This previously crashed.Ted Kremenek2013-04-101-0/+4
| | | | | | | | Yes, this came from actual code. Fixes <rdar://problem/13557053>. llvm-svn: 179155
* Revert r178273 as it broke the Linux bootstrap due to false positivesTimur Iskhodzhanov2013-03-291-119/+16
| | | | llvm-svn: 178320
* Implemented a warning when an input several bitwise operations areSam Panzer2013-03-281-16/+119
| | | | | | | | | | | 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. llvm-svn: 178273
* For printf checking, handle nested typedefs for darwin-specific checking.Ted Kremenek2013-03-251-1/+5
| | | | | | Fixes <rdar://problem/13491605>. llvm-svn: 177931
* Simplify print logic, per feedback from Jordan Rose.Ted Kremenek2013-03-151-1/+1
| | | | llvm-svn: 177193
* Enhance -Wtautological-constant-out-of-range-compare to include the name of ↵Ted Kremenek2013-03-151-2/+15
| | | | | | | | the enum constant. This is QoI. Fixes <rdar://problem/13076064>. llvm-svn: 177190
* c: perform integer overflow check on all binaryFariborz Jahanian2013-03-151-12/+1
| | | | | | operations. // rdar://13423975 llvm-svn: 177181
* c: Also chek for integer overflow for '%' operator.Fariborz Jahanian2013-03-151-2/+10
| | | | llvm-svn: 177163
* c: add the missing binary operatory when checkingFariborz Jahanian2013-03-151-1/+1
| | | | | | for integer overflow. // rdar://13423975 llvm-svn: 177162
* Add TagDecl::hasNameForLinkage(), which is true if the tagJohn McCall2013-03-091-4/+2
| | | | | | is non-anonymous or is defined in a typedef of itself. llvm-svn: 176742
* Fix typos: [Dd]iagnosic -> [Dd]iagnosticStefanus Du Toit2013-03-011-1/+1
| | | | | | These all appear in comments or (ironically) diagnostics output. llvm-svn: 176383
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-3/+3
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-5/+4
| | | | | | | | | | | | | | 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. llvm-svn: 175462
* Don't warn on conversion from NULL to nullptr_tDavid Blaikie2013-02-161-1/+1
| | | | llvm-svn: 175331
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-1/+2
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Use a dyn_cast to avoid a crash when the TypeLoc is not a ConstantArrayTypeLoc.Chad Rosier2013-02-061-4/+5
| | | | | | rdar://13153516 llvm-svn: 174477
* Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko2013-01-301-1/+1
| | | | | | This is required to use them in TableGen. llvm-svn: 173924
* c: When checking on validity of sizeof passed as size ofFariborz Jahanian2013-01-301-1/+2
| | | | | | | | argument to be memset, check for its type to be complete before calling Context.getTypeSize(PointeeTy) to prevent crash. // rdar://13081751. llvm-svn: 173872
* Patch to check for integer overflow. It has beenFariborz Jahanian2013-01-241-1/+16
| | | | | | commented on and approved by Richard Smith. llvm-svn: 173377
* Make __attribute__((nonnull)) use the general expression evaluator to search forNick Lewycky2013-01-231-2/+14
| | | | | | | nulls instead of limiting itself to the language-defined "null pointer constant". llvm-svn: 173227
* Defer checking for unsequenced operations on the RHS of && and || in order toRichard Smith2013-01-171-7/+17
| | | | | | reduce stack usage and hopefully bring back the linux x86_64 buildbot. llvm-svn: 172765
* -Wunsequenced: if the LHS of an &&, || or ?: is not constant, check forRichard Smith2013-01-171-6/+22
| | | | | | | | | 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)'. llvm-svn: 172760
* Attempt to work around bug in older GCCs to fix buildbot.Richard Smith2013-01-171-3/+3
| | | | llvm-svn: 172693
* Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn onRichard Smith2013-01-171-0/+418
| | | | | | | expressions which have undefined behavior due to multiple unsequenced modifications or an unsequenced modification and use of a variable. llvm-svn: 172690
* ArrayRef'ize Sema APIs related to format string checkingDmitri Gribenko2013-01-131-41/+44
| | | | llvm-svn: 172367
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-1/+1
| | | | llvm-svn: 171367
* Tweak Sema::CheckLiteralKind() to also include block literalsTed Kremenek2012-12-211-11/+6
| | | | | | | This simplifies some diagnostic logic in checkUnsafeAssignLiteral(), hopefully making it less error prone. llvm-svn: 170945
* Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().Ted Kremenek2012-12-211-24/+15
| | | | | | | | | | 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. llvm-svn: 170931
* Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().Ted Kremenek2012-12-211-7/+9
| | | | llvm-svn: 170920
* Sink call to checkUnsafeAssignLiteral() into checkUnsafeAssignObject().Ted Kremenek2012-12-211-23/+22
| | | | llvm-svn: 170919
* Remove duplicate includes.Roman Divacky2012-12-211-2/+0
| | | | llvm-svn: 170903
OpenPOWER on IntegriCloud