I'm doing inter-procedural data-flow analysis with clang. Currently I'm using libtooling to parse source files and call AST visitor. The question is how do I create a single AST for several .c files?
I've tried to use ASTImport class, but it does not support import of some AST nodes. Moreover, I'm doing something wrong when I create and manipulate CompilerIstance and it crashes in destructor.
A very similar option was ASTImportAction but it's not quite clear to me which command-line parameters should be passed to the ClangTool in this case.
The third option was to create ASTUnits for every .c file and to look for definitions in each of them it's not clear how to find correspondence between user-define types, e.g. records. In ASTImport they use IsStructurallyEquivalent() function but it's declared in anonymous namespace so I can only copy all this code into my program. And again it supports not all AST nodes.
From the internet this link http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-August/023865.html seems to be most appropriate but for me the technical details of the solution are not clear.
Any suggestions are welcome. Many thanks.