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

Douglas Gregor dgregor at apple.com
Mon May 10 19:35:55 PDT 2010


On May 10, 2010, at 1:58 PM, Sebastien Binet <binet at cern.ch> wrote:

> Excerpts from Douglas Gregor's message of 2010-05-10 20:08:02 +0200:
>> 
>> On May 10, 2010, at 10:59 AM, Sebastien Binet wrote:
>>> [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. 
> 
> I see.
> My agenda is a bit less ambitious.

I understand.

> but, in the off chance XML output were in the end removed from trunk,
> would relying on the new de/serialization work (the PCHReader/Writer)
> be a smart move?

API wrapping is probably best implemented as either a custom ASTConsumer (which has full, direct access to the AST after parsing) or a user of the C bindings (which would probably need more work to expose enough of the AST for wrapping). I actually think that these are better solutions even if XML dumping remains in the tree. 

  - Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100510/aead7213/attachment.html>


More information about the cfe-dev mailing list