Added checking (during parsing) of comparison of floating point values using == or !=.
This is the same functionality gcc provides via --Wfloat-equal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41574 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 9208db2..b613cd9 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -1157,6 +1157,9 @@
if (lType->isRealType() && rType->isRealType())
return Context.IntTy;
} else {
+ if (lType->isRealType() && rType->isRealType())
+ Diag(loc, diag::warn_floatingpoint_eq);
+
if (lType->isArithmeticType() && rType->isArithmeticType())
return Context.IntTy;
}