[cfe-dev] AST transformations in a plugin

JohnH jan.hoogerbrugge at gmail.com
Thu Jan 24 11:22:09 PST 2013


Hi,

For my instrumentation I would like to stay close to the source code so that
I can report with accurate line / column numbers and refer to source level
language constructs. So is this feasible to do in a clang plugin or is
rewriting AST a very complex thing to do? 

Examples of what I would like to do is to add a function call before every
loop and adding function calls for every array access.

   for(...)
     ;

becomes:

   here_comes_a_for_loop(...)
   for(...)
      ;

and

  a[b[i]]

becomes:

  a[array_index(..., b[array_index(..., i)]]

Regards,
John



--
View this message in context: http://clang-developers.42468.n3.nabble.com/AST-transformations-in-a-plugin-tp4029993p4030022.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list