[cfe-dev] Matching all the overloaded operators
Aaron Ballman via cfe-dev
cfe-dev at lists.llvm.org
Mon Dec 16 05:39:19 PST 2019
On Mon, Dec 16, 2019 at 5:50 AM Shraiysh Vaishay via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> 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
>
> Thanks and regards
> Shraiysh
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list