[cfe-dev] XML generation via plugin API

Alek Paunov alex at declera.com
Fri Jun 10 04:51:21 PDT 2011


Hi Tim,

I do not feel qualified to answer definitive to your question, but I 
have kept a link from one of previous discussion related to the subject, 
where Nico Weber showed an example of such sort of plugin [1].

Personally, my feeling is that the more general and powerful approach 
would be .ast <-> SAX tool (For files produced by 
lib/Serialization/ASTWriter.cpp with -emit-ast command line option [2]). 
Please drop me a line if your group like this approach too.

Kind Regards,
Alek

[1] https://github.com/nico/complete/blob/master/server/complete_plugin.cc
[2] http://clang.llvm.org/doxygen/group__ASTAST.html
 
https://llvm.org/svn/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp



On 09.06.2011 23:06, Timothy McClory wrote:
> 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?
>
> Thanks,
> Tim
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list