summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/warn-float-conversion.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Fix-up a -Wfloat-conversion diagnosticErik Pilkington2019-02-141-6/+6
| | | | | | | | | | | | We were warning on valid ObjC property reference exprs, and passing in the wrong arguments to DiagnoseFloatingImpCast (leading to a badly worded diagnostic). rdar://47644670 Differential revision: https://reviews.llvm.org/D58145 llvm-svn: 354074
* [SEMA] add more -Wfloat-conversion to compound assigment analysisNick Desaulniers2018-08-131-0/+26
| | | | | | | | | | | | | | Summary: Fixes Bug: https://bugs.llvm.org/show_bug.cgi?id=27061 Reviewers: aaron.ballman, acoomans Reviewed By: aaron.ballman, acoomans Subscribers: acoomans, cfe-commits, srhines, pirama Differential Revision: https://reviews.llvm.org/D50467 llvm-svn: 339581
* Enable control flow pruning of float overflow warnings.Richard Trieu2018-05-141-0/+34
| | | | | | | | | Like other conversion warnings, allow float overflow warnings to be disabled in known dead paths of template instantiation. This often occurs when a template template type is a numeric type and the template will check the range of the numeric type before performing the conversion. llvm-svn: 332310
* Fix float->int conversion warnings when near barriers.Erich Keane2018-05-081-0/+3
| | | | | | | | | | | | As Eli brought up here: https://reviews.llvm.org/D46535 I'd previously messed up this fix by missing conversions that are just slightly outside the range. This patch fixes this by no longer ignoring the return value of convertToInteger. Additionally, one of the error messages wasn't very sensical (mentioning out of range value, when it really was not), so it was cleaned up as well. llvm-svn: 331812
* Correct warning on Float->Integer conversions.Erich Keane2018-05-071-3/+3
| | | | | | | | | | | | | | | | | | As identified and briefly discussed here: https://bugs.llvm.org/show_bug.cgi?id=37305 Converting a floating point number to an integer type when the integral part is out of the range of the integer type is undefined behavior in C. Additionally, CodeGen emits an undef in this situation. HOWEVER, we've been giving a warning that says that the value is changed. This patch corrects the warning to list that it is actually undefined behavior. Differential Revision: https://reviews.llvm.org/D46535 llvm-svn: 331673
* Revert the bool portion of r267054Richard Trieu2016-04-221-33/+0
| | | | | | | Remove the floating point to bool conversion warnings. Some of these conversions will be caught by -Wliteral-conversion and -Wfloat-conversion llvm-svn: 267234
* Split interesting warnings off from -Wfloat-conversionRichard Trieu2016-04-211-1/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restructure the implict floating point to integer conversions so that interesting sub-groups are under different flags. Breakdown of warnings: No warning: Exact conversions from floating point to integer: int x = 10.0; int x = 1e10; -Wliteral-conversion - Floating point literal to integer with rounding: int x = 5.5; int x = -3.4; -Wfloat-conversion - All conversions not covered by the above two: int x = GetFloat(); int x = 5.5 + 3.5; -Wfloat-zero-conversion - The expression converted has a non-zero floating point value that gets converted to a zero integer value, excluded the cases falling under -Wliteral-conversion. Subset of -Wfloat-conversion. int x = 1.0 / 2.0; -Wfloat-overflow-conversion - The floating point value is outside the range of the integer type, exluding cases from -Wliteral conversion. Subset of -Wfloat-conversion. char x = 500; char x = -1000; -Wfloat-bool-conversion - Any conversion of a floating point type to bool. Subset of -Wfloat-conversion. if (GetFloat()) {} bool x = 5.0; -Wfloat-bool-constant-conversion - Conversion of a compile time evaluatable floating point value to bool. Subset of -Wfloat-bool-conversion. bool x = 1.0; bool x = 4.0 / 20.0; Also add EvaluateAsFloat to Sema, which is similar to EvaluateAsInt, but for floating point values. llvm-svn: 267054
* Change -Wfloating-point-conversion to -Wfloat-conversion.Richard Trieu2014-04-231-0/+38
llvm-svn: 207037
OpenPOWER on IntegriCloud