Reputation: 81
I would like to do transformations on AST of a c program but I need to have access to all ASTs created for the program to do right changes. LLVM processes one translation unit at a time and because of it, I do not have access to AST of all the translation units at the same time. Do you have any suggestion how I can access all the ASTs created for a program, do analysis on the ASTs and do modifications on the ASTs?
As a summary:
Upvotes: 2
Views: 346
Reputation: 156
You can try using llvm-link on all of your generated .ll files (from clang with -S -emit-llvm) to create one large llvm source.
You have access to everything at that point.
Upvotes: 1