[clang-tools-extra] [clang-tidy] detect arithmetic operations within member list initialization in modernize-use-default-member-init check (PR #129370)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 1 00:47:10 PST 2025


================
@@ -202,7 +208,13 @@ void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
             unaryOperator(hasAnyOperatorName("+", "-"),
                           hasUnaryOperand(floatLiteral())),
             cxxBoolLiteral(), cxxNullPtrLiteralExpr(), implicitValueInitExpr(),
-            declRefExpr(to(enumConstantDecl())));
+            declRefExpr(to(enumConstantDecl())),
+            binaryOperator(hasLHS(anyOf(integerLiteral(), floatLiteral(),
----------------
vbvictor wrote:

Consider moving duplicate code to helper-mather like `auto Init`

https://github.com/llvm/llvm-project/pull/129370


More information about the cfe-commits mailing list