https://github.com/5chmidti commented:
You can move even more into the matchers. Here is a mock-up of what I mean (untested): ``` m cxxMemberCallExpr( anyOf( cxxMemberCallExpr( argumentCountIs(1) # is substr, and bind arg 1 ), cxxMemberCallExpr( argumentCountIs(2), hasArgument(0, expr(anyOf(integerLiteral(equals(0)), # evaluatesTo(0) # custom matcher )).bind("zero")), hasArgument(1, expr(anyOf( lengthMatcher, binaryOperator(hasOperatorName("-"), hasLHS(lengthMatcher), hasRHS(expr().bind("n"))) )) ) ) ) ) ``` Then you can discern which case you have by checking what is bound. ```c++ // gettiung bound nodes if (!Zero) { if (N) /*case 1*/; return; } if (N) { /*case 2*/ return; } if (/*LHS and RHS of assign are equal*/) {// could technically be in the matcher, but this looks a bit better actually, IMO /*case 3*/; return; } /*case 4*/ ``` https://github.com/llvm/llvm-project/pull/120055 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits