[cfe-dev] Exporting Clang AST

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 28 06:23:50 PDT 2015

On Mon, Sep 28, 2015 at 3:10 PM Bhargava Shastry <
bshastry at sec.t-labs.tu-berlin.de> wrote:

> 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?

It is always *a* parent, yes :)

> > 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?

Our idea for IDE integration is to export everything that makes sense
through libclang (for example, we want to export clang-tidy through
libclang, and once we have refactorings, it might make sense to offer them
through libclang, too).

> Thanks,
> Bhargava
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150928/28650536/attachment.html>

More information about the cfe-dev mailing list