[cfe-dev] How to rewrite macros

Hao Jiang hjian001 at fiu.edu
Tue Apr 12 07:11:13 PDT 2011


Hi @clang, 
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();
    assert(msg);
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.
Hao Jiang 

--
View this message in context: http://clang-developers.42468.n3.nabble.com/How-to-rewrite-macros-tp2811541p2811541.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list