I used clang rewriter framework to implement a source code translation tool. The main goal of this tool is modify variable reference and CallExpr inside each function body. But I found that rewriter could not modify macros for example:
msg = (MyMessage*)ic->activeEvent();
my tool translate above source code to
pframe->msg_0 = (MyMessage*)ic->activeEvent(); //change msg to pframe->msg_0
assert(msg); //variable msg inside macro did not change
The variables inside macro never going to be changed. Is there a way to rewrite macros? Any suggestion is appreciated. Thank you.