vendredi 23 décembre 2016

creating a callExpr in Clang - source to source transformation

Hi I am fairly new to Clang-LLVM, let alone Compilers. I am now working on a source to source transformation using Clang. My task involves replacement of variable references with function call/ macro functions. For an example, I have the statement:

var1 = var2;

Which I want to change to:

var1 = Read_var2();

Read_var2() would be basically just returning the value of var2. Also, Read_var2() is either a C funtion or just a macro function. So in the Abstract Syntax Tree, I need to replace a variable reference with a call reference. Or to say replace it with a DeclRefExpr which is a CallExpr (or so I think).

I would really appreciate any help in this context. Thanks in advance.

To give you a small idea of what I know of the concept of compilers and clang, I am at a level which could probably considered as "Noob level" :-|

Aucun commentaire:

Enregistrer un commentaire