summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-literal-conversion.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Improve some of the conversion warnings to fire on conversion to bool.David Blaikie2012-05-151-14/+14
| | | | | | | | | | | 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. llvm-svn: 156826
* Only warn in -Wliteral-conversion if the conversion loses informationMatt Beaumont-Gay2011-10-141-10/+5
| | | | llvm-svn: 141955
* Move string literal to bool conversion into its own warning flag ↵Richard Trieu2011-09-261-16/+0
| | | | | | -Wstring-conversion. llvm-svn: 140574
* Add a new warning to -Wliteral-conversion to catch cases where a string literalRichard Trieu2011-09-231-0/+16
| | | | | | | | | | | | | | 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 llvm-svn: 140405
* Extend -Wliteral-conversion to catch "int i = -1.234"Matt Beaumont-Gay2011-09-081-2/+1
| | | | llvm-svn: 139326
* Enhance the diagnostic for literal float -> int conversions to suggestChandler Carruth2011-04-101-5/+10
| | | | | | | | | | | | 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. llvm-svn: 129243
* Implement a sub-group of -Wconversion: -Wliteral-conversion. ThisChandler Carruth2011-02-171-0/+41
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. llvm-svn: 125745
OpenPOWER on IntegriCloud