[clang-tools-extra] [clang-tidy] Address false positives in misc-redundant-expression checker (PR #121960)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 11:00:19 PST 2025
================
@@ -747,6 +747,28 @@ static bool areSidesBinaryConstExpressions(const BinaryOperator *&BinOp, const A
return false;
}
+static bool areSidesBinaryConstExpressionsOrDefinesOrIntegerConstant(
+ const BinaryOperator *&BinOp, const ASTContext *AstCtx) {
+ if (areSidesBinaryConstExpressions(BinOp, AstCtx))
+ return true;
+
+ const Expr *Lhs = BinOp->getLHS();
+ const Expr *Rhs = BinOp->getRHS();
+
+ if (!Lhs || !Rhs)
+ return false;
+
+ auto IsDefineExpr = [AstCtx](const Expr *E) {
+ SourceRange Lsr = E->getSourceRange();
----------------
earnol wrote:
Agreed.
https://github.com/llvm/llvm-project/pull/121960
More information about the cfe-commits
mailing list