[cfe-dev] [patch] improved ast-print-xml for C++

Douglas Gregor dgregor at apple.com
Mon May 10 11:08:02 PDT 2010


On May 10, 2010, at 10:59 AM, Sebastien Binet wrote:
> please find in attachment a few (I hope) improvements I applied to
> various files related to the ast-print-xml plugin.
> 
> 2 changes are worth noticing:
> - I renamed the CXXMethodDecl node as CXXMethod (for consistency)
> - I added a default node implementation for all Decl and Types to
> prevent new crashes (for new types and decls) as per bug #5006

Okay, committed as r103412.

> [my secret agenda is to make ast-print-xml as useful as gccxml wrt API
> wrapping.]


I have a secret agenda w.r.t. XML output as well, but it's very different: I want it to either become a clean representation of C++ ASTs in XML, or I want it removed from Clang. That's a strong statement, but here's what I think Clang's XML output should be:

	- Complete, covering all of C/C++/Objective-C: We can achieve this incrementally.

	- Documented with Schema: we need to describe what the XML format is, and be able to validate it

	- Tested: we should verify that the generated XML matches the Schema

	- C++, not Clang: The XML format should describe C++, not Clang's ASTs. Clang's ASTs are not stable and aren't necessarily the best way to describe a C++ program. XML formats are supposed to be for interchange, so they have to be stable, and ideally could be generated by another front end as well.

My concern with the current XML dump is that it claims more than it does: it isn't complete enough to be generally useful, and it doesn't deliver any of the benefits that XML should. 

	- Doug



More information about the cfe-dev mailing list