[cfe-dev] Exporting Clang AST

Bhargava Shastry via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 28 06:10:28 PDT 2015

Hi Manuel,

Thanks for the hint. I was just looking at the getParents() method :-)
Quick question: is getParents(childNode)[0] *always* the parent (i.e.,
immediate parent, not ancestor) of childNode?

> So far the consensus has been that this would be a very hard project;
> there has been an XML output once, but the problem is that it was never
> up-to-date / complete enough to do anything useful with it.
> Generally, if you want to have a full XML/JSON/whatever output, somebody
> would need to implement it, and then make sure it doesn't get out of
> date when the implementation changes.

I gather this was the reason something like -dump-xml was dropped as a
CFE action. At the moment, I am working on a toy tool. It is nowhere
close to being production ready.
If someone in the community could mentor me for e.g., GSoC, I could give
this a more serious shot. Ultimately, like you say, this is a continuous
(and not one-time) effort that requires keeping track of upstream
changes in Clang AST. Nonetheless, I offer help for an initial prototype
at the very least.

> So far we have build mostly clang-based tools that work directly on the
> C++ AST.

Is anyone else in the list considering using clang -ast-dump towards a
non-clang tool e.g., IDE integration or some such?


Bhargava Shastry <bshastry at sec.t-labs.tu-berlin.de>
Security in Telecommunications
TU Berlin / Telekom Innovation Laboratories
Ernst-Reuter-Platz 7, Sekr TEL 17 / D - 10587 Berlin, Germany
phone: +49 30 8353 58235

More information about the cfe-dev mailing list