[cfe-dev] Clang -ast-dump-xml question
Matthias Grimmer
grimmer at ssw.jku.at
Wed Mar 6 07:44:30 PST 2013
No, the goal is definitely not to built a toy example.
We have to be able to process all real life C applications, and
therefore serialize all information that is necessary.
Can you recommend the ASTDumper.cpp / -ast-dump as a good reference
implementation? It seams that ASTDumper.cpp / -ast-dump does pretty much
what we want, except from the output format.
Thanks in advance
- Matthias
On 03/06/2013 04:24 PM, Manuel Klimek wrote:
> On Wed, Mar 6, 2013 at 7:14 AM, Douglas Gregor <dgregor at apple.com
> <mailto:dgregor at apple.com>> wrote:
>
>
> On Mar 5, 2013, at 2:41 AM, Matthias Grimmer <grimmer at ssw.jku.at
> <mailto:grimmer at ssw.jku.at>> wrote:
>
>> Hi
>>
>> we are using clang and its -ast-dump-xml feature. Our goal is to
>> convert the serialized clang-AST to a different code representation.
>> We think that the output, that -ast-dump-xml produces, is not
>> well suited for parsing. Statements are represented as ASCII
>> styled trees and also contain parts that
>> confuse XML parsers (e.g. <line:18:2, col:18>).
>
> The pseudo-XML dump is a debugging aid. It's not a stable, useful
> format on which to build tools. Tools should be built on top of
> the Clang AST, either through libclang (for a stable but
> not-very-rich AST representation) or the C++ AST.
>
>
> Wasn't there a plan to get rid of the XMLish dump?
>
> Cheers,
> /Manuel
>
>
>> Is there a better way to get a serialized version of the clang
>> AST (XML, or any other format that is easier to parse)?
>
> No, there isn't.
>
>> We would like to avoid writing a clang AST visitor for this purpose.
>
> Writing a Clang AST visitor or libclang client is really the best
> way to do this. There is no way to get sufficient information out
> of the debugging dumps to build a tool, unless your goal is to
> build a simple toy example that handles only a small part of C(++).
>
> - Doug
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130306/6bcf5619/attachment.html>
More information about the cfe-dev
mailing list