[cfe-dev] misleading mistake/type in ast matchers documentation

Manuel Klimek klimek at google.com
Sat Jan 3 07:19:58 PST 2015


On Thu Dec 25 2014 at 8:50:46 PM mobi phil <mobi at mobiphil.com> wrote:

> On the page,
>
>
>
> http://clang.llvm.org/docs/LibASTMatchers.html
>
> it is stated
>
> "By default, matchers that accept multiple inner matchers use an implicit
> allOf()
> <http://clang.llvm.org/docs/LibASTMatchersReference.html#allOf0Anchor>.
> This allows further narrowing down the match, for example to match all
> classes that are derived from “Bar”: recordDecl(hasName("Foo"),
> isDerivedFrom("Bar"))."
>

This works because isDerivedFrom has an overload that takes a StringRef.


> trying that with text based matchers, no result is returned. The correct
> would be
>
> recordDecl(hasName("Foo"), isDerivedFrom(recordDecl(hasName("Bar")))
>
> Or the text based matchers do not behave exactly as the equivalent C++
> matchers?
>
> do not care that much about this little mistake in the docu. (if it is a
> mistake). I care more to know if the string based matchers should behave
> exactly as the C++ matchers.
>
>
I'm not sure that this is possible (cc'ed Sam); generally, the text based
AST matchers will always be a simplified version, as they cannot rely on
all the template magic going on.


>
> rgrds,
> mobi phil
>
> being mobile, but including technology
> http://mobiphil.com
>  _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150103/0443260d/attachment.html>


More information about the cfe-dev mailing list