I’m doing inter-procedural data-flow analysis with clang. I need to parse ASTs of several .c files together (to compute a fixed point I need to switch between functions in different files).
I’ve tried three options as described below.
As far as I understand from the discussion in the mailing list http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-August/023865.html, there is no out-of-box solution for merging ASTs in clang. One option is to manually create a global symbol table for several units. My question is then (in the suggested solutions) how to find the correspondence between the definitions of the same user-define type in different ASTs.
I’ve also looked at ASTImport class, but it does not support import of some AST nodes and also gives ‘multiple definition’ errors (even though there is no multiple definition). Can it be used to merge ASTs of source files rather than precompiled headers?
Finally, I’ve tried ASTImportAction but I don’t understand which command-line parameters should be passed to the ClangTool for this action.
I would be grateful for any hint.
Thank you very much,