[cfe-dev] Rewriting function calls

qiuyin at gmail.com qiuyin at gmail.com
Thu Dec 6 21:34:45 PST 2012


Hi there,

I am thinking about reverse the order of arguments in a call expression with clang. I'm leveraging the refactoring tool and the AST matcher framework. I use a matcher to find those calls i'm interested in, rewrite the expr, and  insert one replacement. Things go tricky for nested calls. Because the refactoring tool applies replacements one by one, and order adjustment does not change the total text length, one replacement could overwrite prior changes. Do i have to implement my own replacement applying algo (i'm thinking about adding source range references to a replacement object, and applying them recursively), or is there a simple and better way to do this?

Thanks!




More information about the cfe-dev mailing list