summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR14284: crash on ext-valid returning NULL from a void functionDavid Blaikie2012-11-081-1/+2
| | | | llvm-svn: 167565
* Address review comments for r167358: explicitly check for CK_BitCast instead ofDmitri Gribenko2012-11-031-2/+1
| | | | | | checking against a blacklist. llvm-svn: 167362
* Handle CK_NullToPointer casts in -Wtype-safety properly. Fixes PR14249.Dmitri Gribenko2012-11-031-1/+3
| | | | llvm-svn: 167358
* Add null check for malformed code.Ted Kremenek2012-10-111-2/+5
| | | | llvm-svn: 165733
* Minor cleanup for r165678; no functional change.Eli Friedman2012-10-111-1/+1
| | | | llvm-svn: 165679
* Make sure we perform the variadic method check correctly for calls to a ↵Eli Friedman2012-10-111-2/+14
| | | | | | member operator(). PR14057. llvm-svn: 165678
* Check if an IdentifierInfo* is null when the FunctionDecl isn't a simple C ↵Ted Kremenek2012-10-021-2/+6
| | | | | | | | function. Fixes <rdar://problem/12355298> llvm-svn: 164988
* -Wformat: Don't check format strings in uninstantiated templates.Jordan Rose2012-10-021-3/+2
| | | | | | | | | | | | | 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> llvm-svn: 164984
* -Warc-repeated-use-of-weak: check ivars and variables as well.Jordan Rose2012-09-281-1/+11
| | | | | | | | | | 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>. llvm-svn: 164855
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-271-1/+1
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 llvm-svn: 164769
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-271-1/+1
| | | | llvm-svn: 164766
* Avoid multiple atomic builtin declaration.Abramo Bagnara2012-09-221-4/+13
| | | | llvm-svn: 164454
* Improvements to my patch in r164143 perFariborz Jahanian2012-09-201-18/+16
| | | | | | Richard's comments. // rdar://12202422 llvm-svn: 164316
* minor refactoring of my last check-in.Fariborz Jahanian2012-09-181-2/+2
| | | | llvm-svn: 164145
* c: warn when an integer value comparison with anFariborz Jahanian2012-09-181-6/+68
| | | | | | | | integral expression have the obvious result. Patch reviewed by John McCall off line. // rdar://12202422 llvm-svn: 164143
* -Warc-retain-cycles: look through [^{...} copy] and Block_copy(^{...})Jordan Rose2012-09-171-0/+18
| | | | | | | | | | | | | 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> llvm-svn: 164039
* const _Atomic(T) is not an atomic type, so do not allow it as the type 'A' inRichard Smith2012-09-151-1/+5
| | | | | | | C11 7.17's atomic operations. GNU's __atomic_* builtins do allow const-qualified atomics, though (!!) so don't restrict those. llvm-svn: 163964
* -Warc-retain-cycles: warn at variable initialization as well as assignment.Jordan Rose2012-09-151-1/+16
| | | | | | | | | | | | | | | | | | 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> llvm-svn: 163962
* Format strings: offer a fixit for Darwin's %D/%U/%O to ISO %d/%u/%o.Jordan Rose2012-09-131-5/+22
| | | | | | <rdar://problem/12061922> llvm-svn: 163772
* Format strings: %D, %U, and %O are valid on Darwin (same as %d, %u, %o).Jordan Rose2012-09-131-2/+4
| | | | | | | | | These will warn under -Wformat-non-iso, and will still be rejected outright on other platforms. <rdar://problem/12061922> llvm-svn: 163771
* Format strings: suggest %lld instead of %qd and %Ld with -Wformat-non-iso.Jordan Rose2012-09-081-40/+46
| | | | | | | As a corollary to the previous commit, even when an extension is available, we can still offer a fixit to the standard modifier. llvm-svn: 163453
* Format strings: %Ld isn't available on Darwin or Windows.Jordan Rose2012-09-081-27/+51
| | | | | | | | | This seems to be a GNU libc extension; we offer a fixit to %lld on these platforms. <rdar://problem/11518237> llvm-svn: 163452
* Dont cast away const needlessly. Found by gcc48 -Wcast-qual.Roman Divacky2012-09-061-1/+1
| | | | llvm-svn: 163325
* Format strings: suggest casts for NS(U)Integer and [SU]Int32 on Darwin.Jordan Rose2012-09-051-23/+126
| | | | | | | | | | | | | | | 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> llvm-svn: 163266
* Format string checking: change long if-statement to early returns.Jordan Rose2012-09-051-66/+69
| | | | | | No functionality change. llvm-svn: 163265
* objective-C ARC; detect and warn on retain cycle whenFariborz Jahanian2012-08-311-0/+6
| | | | | | | property-dot syntax is used on an object whose capture causes retain cycle. // rdar://11702054 llvm-svn: 163017
* Change the representation of builtin functions in the ASTEli Friedman2012-08-311-5/+5
| | | | | | | | | (__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. llvm-svn: 162962
* Warn about suspicious implicit conversions from floating point to boolHans Wennborg2012-08-281-0/+64
| | | | | | | | | | | | | | | | | | | | | 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! llvm-svn: 162763
* Support MIPS DSP Rev2 intrinsics.Simon Atanasyan2012-08-271-0/+5
| | | | | | The patch reviewed by Akira Hatanaka. llvm-svn: 162669
* Push ArrayRef through the Expr hierarchy.Benjamin Kramer2012-08-241-4/+2
| | | | | | No functionality change. llvm-svn: 162552
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-4/+4
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Fix a bunch of -Wdocumentation warnings.Dmitri Gribenko2012-08-231-2/+2
| | | | llvm-svn: 162452
* Add support for "type safety" attributes that allow checking that 'void *'Dmitri Gribenko2012-08-171-0/+414
| | | | | | | | | | | | | | 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(). llvm-svn: 162067
* Store SourceManager pointer on PrintingPolicy in the case where we're dumping,Richard Smith2012-08-161-3/+3
| | | | | | | | | 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. llvm-svn: 162011
* Fix undefined behavior (and wrong code, as far as I can tell) in NEON builtinRichard Smith2012-08-141-2/+2
| | | | | | | | | 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. llvm-svn: 161827
* Address code review comments for Wstrncat-size warning (r161440).Anna Zaks2012-08-081-24/+26
| | | | llvm-svn: 161527
* Remove ScanfArgType and bake that logic into ArgType.Hans Wennborg2012-08-071-4/+4
| | | | | | | | This is useful for example for %n in printf, which expects a pointer to int with the same logic for checking as %d would have in scanf. llvm-svn: 161407
* Rename analyze_format_string::ArgTypeResult to ArgTypeHans Wennborg2012-08-071-17/+17
| | | | | | Also remove redundant constructors and unused member functions. llvm-svn: 161403
* Refactor checks for unevaluated contexts into a common utility function.David Blaikie2012-08-061-1/+1
| | | | | | | | | 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. llvm-svn: 161355
* Do not warn on correct use of the '%n' format specifier.Matt Beaumont-Gay2012-07-301-9/+0
| | | | | | | | 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. llvm-svn: 160984
* Make -Wformat check the argument type for %n.Hans Wennborg2012-07-301-2/+0
| | | | | | | This makes Clang check that the corresponding argument for "%n" in a format string is a pointer to int. llvm-svn: 160966
* Change APInt to APSInt in one instance. Also change a call to operator==() toRichard Trieu2012-07-231-1/+1
| | | | | | APSInt::isSameValue() when comparing different sized APSInt's. llvm-svn: 160641
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160622
* For varargs, diagnose passing ObjC objects by value like other non-POD types.Jordan Rose2012-07-191-30/+40
| | | | | | | | | | | | | | 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> llvm-svn: 160517
* Don't crash checking a format string if one of the arguments is invalid.Jordan Rose2012-07-191-7/+20
| | | | | | | | | 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> llvm-svn: 160515
* Simplify float comparison checks by using early return.David Blaikie2012-07-161-24/+16
| | | | | | Found while investigating PR13330 llvm-svn: 160318
* MIPS: Range check __builtin_mips_wrdsp / __builtin_mips_rddsp arguments ↵Simon Atanasyan2012-07-081-0/+34
| | | | | | against the upper/lower values. llvm-svn: 159911
* objc-arc: warn when assigning retained object toFariborz Jahanian2012-07-061-1/+11
| | | | | | | a 'weak' property just as we do the same for 'weak' variables. // rdar://11814185 llvm-svn: 159859
* When a builtin that requires a constant is given a type- orDouglas Gregor2012-06-291-2/+16
| | | | | | | value-dependent expression, don't complain that it wasn't the constant we wanted. Fixes <rdar://problem/11688587> and PR11074. llvm-svn: 159404
* Unrevert r158887, reverted in r158949, along with a fix for the bug whichRichard Smith2012-06-251-120/+271
| | | | | | | | | | | | | | | | | | | | 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! llvm-svn: 159159
OpenPOWER on IntegriCloud