hi,
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
[my secret agenda is to make ast-print-xml as useful as gccxml wrt API
wrapping.]
hth,
sebastien.
improved.cxx.support.for.ast.print.xml.patch (10.2 KB)
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
Excerpts from Douglas Gregor's message of 2010-05-10 20:08:02 +0200:
> 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.
thanks.
> [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.
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 ?
cheers,
sebastien.
Excerpts from Douglas Gregor’s message of 2010-05-10 20:08:02 +0200:
[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.
Hi,
Douglas Gregor schrieb:
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.
Thats what I've thought a year ago. Apparently it isn't that easy, esp. since the C++ development has overrun me.
- Documented with Schema: we need to describe what the XML format is, and be able to validate it
That's what the *XML.def files are all about. You've (correctly) insisted that I introduced them and IIRC I did it in a way that they are easy convertible.
- 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.
Hmm, but this point is really just a new project. Which is the best way to describe a C++ program? Is it the plain source code? Or is it the AST? Or something completely different? And why is that "something " not used elsewhere? Well, I still think, that XML-dumping the AST is not the worst way, even if you have to adjust it constantly.
Best regards
Olaf Krzikalla