[cfe-dev] Thoughts on subexpression matching

Manuel Klimek klimek at google.com
Mon Mar 4 10:59:05 PST 2013


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 :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130304/51f088da/attachment.html>

More information about the cfe-dev mailing list