summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2016-04-22 22:14:32 +0000
committerRichard Trieu <rtrieu@google.com>2016-04-22 22:14:32 +0000
commit891f0f176ced7ad579a8c2afca2059c22f49093f (patch)
treee2a33747eb9ba7705140ada9a1992b869308735e /clang/lib
parent0b9531c8e643d63fad0c2b4f3e6738678c421c59 (diff)
downloadbcm5719-llvm-891f0f176ced7ad579a8c2afca2059c22f49093f.tar.gz
bcm5719-llvm-891f0f176ced7ad579a8c2afca2059c22f49093f.zip
Revert the bool portion of r267054
Remove the floating point to bool conversion warnings. Some of these conversions will be caught by -Wliteral-conversion and -Wfloat-conversion llvm-svn: 267234
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 0592a830113..fb11adb4518 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7403,13 +7403,8 @@ void DiagnoseFloatingImpCast(Sema &S, Expr *E, QualType T,
bool IsConstant =
E->EvaluateAsFloat(Value, S.Context, Expr::SE_AllowSideEffects);
if (!IsConstant) {
- if (IsBool) {
- return DiagnoseImpCast(S, E, T, CContext, diag::warn_impcast_float_bool,
- PruneWarnings);
- } else {
- return DiagnoseImpCast(S, E, T, CContext,
- diag::warn_impcast_float_integer, PruneWarnings);
- }
+ return DiagnoseImpCast(S, E, T, CContext,
+ diag::warn_impcast_float_integer, PruneWarnings);
}
bool isExact = false;
@@ -7418,17 +7413,14 @@ void DiagnoseFloatingImpCast(Sema &S, Expr *E, QualType T,
T->hasUnsignedIntegerRepresentation());
if (Value.convertToInteger(IntegerValue, llvm::APFloat::rmTowardZero,
&isExact) == llvm::APFloat::opOK &&
- isExact && !IsBool) {
+ isExact) {
if (IsLiteral) return;
return DiagnoseImpCast(S, E, T, CContext, diag::warn_impcast_float_integer,
PruneWarnings);
}
unsigned DiagID = 0;
- if (IsBool) {
- // Warn on all floating point to bool conversions
- DiagID = diag::warn_impcast_float_to_bool;
- } else if (IsLiteral) {
+ if (IsLiteral) {
// Warn on floating point literal to integer.
DiagID = diag::warn_impcast_literal_float_to_integer;
} else if (IntegerValue == 0) {
OpenPOWER on IntegriCloud