[cfe-dev] Auto-generation of ASTMatchers predicates from source code, proof-of-concept

Manuel Klimek klimek at google.com
Sun Jun 17 08:53:46 PDT 2012

On Sun, Jun 17, 2012 at 5:28 PM, Evgeny Panasyuk
<evgeny.panasyuk at gmail.com>wrote:

> Hello,
> I have played today with ASTMatchers/Refactoring - it is great tool,
> thank you guys!
> I am thinking about tool which would automatically generate strictest
> possible (or at least very strict) matcher predicate for given piece of
> code. That would help to "dive into" predicate syntax for new users of
> ASTMatchers.
> Also it would be helpful for getting right qualified names, etc.
> One of possible usage pattern is:
> 1. Prepare several pieces of code of interest, place into real code in
> order to get right context. Highlight these codes somehow, maybe with
> some special macro.
> 2. Run tool over these units, and get strict predicates as the result.
> 3. Adjust predicates, combine them, relax conditions, etc, and finally
> use them
> Small proof-of-concept:
> tool: http://ideone.com/XetAL (based on remove-cstr-calls, same build
> options)
> test_case: http://ideone.com/GXEcw
> tool output: http://ideone.com/xEgFJ
> What do you think about such concept?

Hi Evgeny,

I love the idea! In general, I think it's a really hard problem (which is
the main reason we haven't tackled this yet ourselves). I guess it's a
little more researchy, but I'd be super interested in seeing more work
going into making C++ tooling easier and more powerful ...

I don't know whether you're aware, but in the tooling branch there's also a
proof-of-concept implementation for dynamic matcher generation, and it
might make sense to base your stuff on that.


> Best Regards,
> Evgeny
> _______________________________________________
> 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/20120617/fa7a3529/attachment.html>

More information about the cfe-dev mailing list