[cfe-dev] Thoughts on subexpression matching

Vane, Edwin edwin.vane at intel.com
Mon Mar 4 11:09:20 PST 2013


Could you point at an example for #2?

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<mailto: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/3c6c5570/attachment.html>


More information about the cfe-dev mailing list