[cfe-dev] Thoughts on subexpression matching

Manuel Klimek klimek at google.com
Mon Mar 4 11:14:54 PST 2013


On Mon, Mar 4, 2013 at 8:09 PM, Vane, Edwin <edwin.vane at intel.com> wrote:

>  Could you point at an example for #2?
>

Those are unfortunately in internal tools - we will open source some of it,
but we'll need to find more general abstractions first (stuff we have
internally is pretty special cased and thus not really interesting).

The best example I can think of are the unittests for the AST matchers:
http://llvm-reviews.chandlerc.com/diffusion/L/browse/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp;176444$3712

Cheers,
/Manuel


> ****
>
> ** **
>
> *From:* Manuel Klimek [mailto:klimek at google.com]
> *Sent:* Monday, March 04, 2013 1:59 PM
> *To:* Vane, Edwin; clang-dev Developers
>
> *Subject:* Re: Thoughts on subexpression matching****
>
> ** **
>
> +cfe-dev****
>
> ** **
>
> On Mon, Mar 4, 2013 at 6:09 PM, Vane, Edwin <edwin.vane at intel.com> wrote:*
> ***
>
> Hi Manuel,
>
> I've seen a need for subexpression matching arise several times in working
> with matchers. Often it comes in the form of: match this expression of this
> "thing over here" is the same as "that thing over there". In the use-auto
> transform for example, the only thing that's not in a matcher is the test
> that the vardecl type is the same as the initializer. Have you had any
> thoughts about this feature before?****
>
> ** **
>
> There are two ways to do this:****
>
> 1. be able to express references in the matcher language; this is hard,
> but if somebody wanted to give it a go, I'd be excited ;)****
>
> 2. just do a submatch in the callback - that's what match() on the
> ASTMatchFinder and the freestanding match() functions around the
> ASTMatchFinder are for; this is what we're currently using - thanks to the
> caching of the parent map in the ASTContext this is now also
> computationally acceptable :)****
>
> ** **
>
> Cheers,****
>
> /Manuel****
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130304/e559e26b/attachment.html>


More information about the cfe-dev mailing list