Matching all the overloaded operators

Hi all,

I was looking for a matcher all overloaded operators.

cxxMethodDecl(hasOverloadedOperatorName("+")) matches overloaded “+”. How do I modify this to match all operator overloads?

Any help would be appreciated.

Thanks and regards
Shraiysh

Hi all,

I was looking for a matcher all overloaded operators.

`cxxMethodDecl(hasOverloadedOperatorName("+"))` matches overloaded "+". How do I modify this to match all operator overloads?

Any help would be appreciated.

We don't currently have a matcher that makes this trivial (I was
thinking cxxMethodDecl(hasOverloadedOperatorName(anything())) might
work, but there's a type mismatch between anything() and a string).

You could add a matcher for this pretty easily if you are in C++ with:

AST_MATCHER(CXXMethodDecl, isOverloadedOperator) {
  return Node.isOverloadedOperator();
}

~Aaron

Hi Aaron,

Thanks for the answer.

Regards
Shraiysh