[cfe-dev] Clang: get list of defined macro

GabrieleCocco cocco at di.unipi.it
Tue Oct 30 06:47:04 PDT 2012


Thank you for your answer.
Unfortunately I haven-t been able to solve it yet. I'm find difficulties to
find the source location of macro definitions to remove them.
Moreover, I would like to ask you a question regarding macro expansion and
AST. In the doxygen I read that "Locations from macros, etc are not
rewritable.". 
Now, suppose I define a macro like the following:

#define this_opencl_device(p, d) call_this_opencl_device(p, d);

where call_this_opencl_device is a stub function only used to mark the code
for analysis. After the analysis I would like to remove this call and
produce a "cleaned" source.
Unfortunately, the rewriter buffer doesn't contain the expanded macro (i.e.
the call) but the macro name itself. Therefore I'm not able to remove it
from the rewriter buffer (I tried).

Any suggestion to walk around this problem? 



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Clang-get-list-of-defined-macro-tp4027815p4027838.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list