[clang-tools-extra] [clang-tidy] detect arithmetic operations within member list initialization in modernize-use-default-member-init check (PR #129370)
David Rivera via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 8 22:05:53 PST 2025
================
@@ -159,6 +159,12 @@ static bool sameValue(const Expr *E1, const Expr *E2) {
case Stmt::UnaryOperatorClass:
return sameValue(cast<UnaryOperator>(E1)->getSubExpr(),
cast<UnaryOperator>(E2)->getSubExpr());
+ case Stmt::BinaryOperatorClass: {
----------------
RiverDave wrote:
That's a good edge case I hadn't thought about. yeah we totally need to make sure `BinaryOp` is the same to prevent cases where both expressions are numerically identical with different operands. should be fixed now, let me know if test cases are needed for that.
https://github.com/llvm/llvm-project/pull/129370
More information about the cfe-commits
mailing list