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

Evgeny Panasyuk evgeny.panasyuk at gmail.com
Sun Jun 17 08:28:36 PDT 2012


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?

Best Regards,
Evgeny



More information about the cfe-dev mailing list