https://github.com/nicovank commented:
This feels very intrusive, a lot should be able to be re-used from things
already used in the matcher. I expect something like this would be sufficient:
```cpp
Finder->addMatcher(
cxxOperatorCallExpr(
hasAnyOperatorName("==", "!="),
hasOperands(
expr().bind("needle"),
cxxMemberCallExpr(
argumentCountIs(2), hasArgument(0, ZeroLiteral),
hasArgument(1, lengthExprForStringNode("needle")),
callee(cxxMethodDecl(hasName("substr"),
ofClass(OnClassWithStartsWithFunction))
.bind("find_fun")))
.bind("find_expr")))
.bind("expr"),
this);
```
I expect that the only change in `check` would be related to the negation since
this will cause some segmentation fault from always getting it as a
`BinaryOperator`.
https://github.com/llvm/llvm-project/pull/116033
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits