Use the IR information to modify the AST

Hi,guys:

I am try to get some information from the IR, such as Function type, Function arguments,
I want to save then to the data structure which defined by myself, and I want use the data structure to modify the
AST.
But I know ,the IR was produced by the AST, I am not sure my thought is wright or not.
If so, with API or function in the LLVM I will used? or some linkage or demo that I can learn form?

Thanks,
Yao.

Hi Yao,

I am try to get some information from the IR, such as Function type,
Function arguments,
I want to save then to the data structure which defined by myself, and I
want use the data structure to modify the
AST.
But I know ,the IR was produced by the AST, I am not sure my thought is
wright or not.
If so, with API or function in the LLVM I will used? or some linkage or demo
that I can learn form?

  The frontend (clang) should be the right place to modify the AST.
The information
you want could be get from the frontend, too. You might refer [1] to
see the basic idea.

[1] http://eli.thegreenplace.net/2012/06/08/basic-source-to-source-transformation-with-clang

HTH,
chenwj

Thanks a lot :slight_smile: