[clang] [clang][Sema] Warn consecutive builtin comparisons in an expression (PR #92200)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed May 15 10:13:52 PDT 2024
================
@@ -14878,6 +14878,11 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
case BO_GT:
ConvertHalfVec = true;
ResultTy = CheckCompareOperands(LHS, RHS, OpLoc, Opc);
+
+ if (const auto *BI = dyn_cast<BinaryOperator>(LHSExpr))
+ if (BI->isComparisonOp())
+ Diag(OpLoc, diag::warn_consecutive_comparison);
+
----------------
AaronBallman wrote:
```suggestion
if (const auto *BI = dyn_cast<BinaryOperator>(LHSExpr); BI && BI->isComparisonOp())
Diag(OpLoc, diag::warn_consecutive_comparison);
```
https://github.com/llvm/llvm-project/pull/92200
More information about the cfe-commits
mailing list