Our group is developing a tool that analyzes C code, and we would like to leverage the robustness of the clang frontend. I would appreciate any feedback of our proposed approach:
Assume our tool is capable of dumping it’s internal AST to an XML file, and importing from an XML file. Our plan is to write an ASTConsumer that will output an XML representation of clang’s AST that conforms to our XML schema. Our goal is to produce output similar to the (deprecated?) -ast-print-xml option, though augmented with more detail such as preprocessor information.
I think that this could be written as a plugin, much like the PrintFunctionNames example. This is the question I am most interested in: is writing a plugin the proper approach for the use case described?