[cfe-dev] ASTMatchers and empty string literals

Manuel Klimek klimek at google.com
Sun Sep 9 23:05:29 PDT 2012

On Mon, Sep 10, 2012 at 2:59 AM, Andrew McGregor <andrewmcgr at gmail.com> wrote:
> I want to do a matcher that would naively be spelt stringLiteral(equals("")), but that won't compile, complaining that (I think) "" is not a valid array initialiser.
> So, is there a more correct way to spell that?  Or have I found another bug?

equals is currently not usable for string literals, as clang's
StringLiteral class doesn't have a getValue() method (the doxygen says
it's usable for character-, bool-, floating- and integer-literals).

The quick workaround is to bind the string literal, and do the check
in the callback. For feature requests in the matchers, please always
feel free to file a bug in clang and cc' it to me.


> Andrew
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list