================ @@ -194,15 +199,21 @@ void UseDefaultMemberInitCheck::storeOptions( } void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) { - auto InitBase = - anyOf(stringLiteral(), characterLiteral(), integerLiteral(), - unaryOperator(hasAnyOperatorName("+", "-"), - hasUnaryOperand(integerLiteral())), - floatLiteral(), - unaryOperator(hasAnyOperatorName("+", "-"), - hasUnaryOperand(floatLiteral())), - cxxBoolLiteral(), cxxNullPtrLiteralExpr(), implicitValueInitExpr(), - declRefExpr(to(enumConstantDecl()))); + + auto ExplicitCastExpr = castExpr(hasSourceExpression(anyOf( + unaryOperator(hasAnyOperatorName("+", "-"), + hasUnaryOperand(anyOf(integerLiteral(), floatLiteral()))), + integerLiteral(), floatLiteral(), characterLiteral()))); ---------------- PiotrZSL wrote:
on other hand, instead typing here all those literals and unary operators, you could simply use thing like this: ``` anyOf(InitBase, castExpr(hasSourceExpression(InitBase))) ``` should do a trick... https://github.com/llvm/llvm-project/pull/129408 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits