[cfe-dev] Matching all the overloaded operators
Shraiysh Vaishay via cfe-dev
cfe-dev at lists.llvm.org
Mon Dec 16 16:52:09 PST 2019
Hi Aaron,
Thanks for the answer.
Regards
Shraiysh
On Mon, Dec 16, 2019, 7:09 PM Aaron Ballman <aaron at aaronballman.com> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191217/61cc631c/attachment.html>
More information about the cfe-dev
mailing list