<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Sep 28, 2015 at 3:37 PM Bhargava Shastry <<a href="mailto:bshastry@sec.t-labs.tu-berlin.de">bshastry@sec.t-labs.tu-berlin.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> It is always *a* parent, yes :)<br>
<br>
Hmm... okay. That's something I hadn't imagined in my head about an AST.<br>
That a node can have multiple parents :/<br>
<br>
Just to be clear, getParents(childNode) returns an array of parents<br>
only, right i.e., one indentation level up in -ast-dump output? E.g., an<br>
entry stmt in functiondecl scope has functiondecl as its parent and<br>
*not* translationunitdecl?<br></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> Our idea for IDE integration is to export everything that makes sense<br>
> through libclang (for example, we want to export clang-tidy through<br>
> libclang, and once we have refactorings, it might make sense to offer<br>
> them through libclang, too).<br>
<br>
Okay. I did try using libclang python bindings but the AST it exposes<br>
currently is inferior to what one could get with a libtooling based tool.<br>
<br>
Is AST provided by libclang *proper* (C binding) better than its python<br>
counterpart? I suppose I mean: Is this a rough ordering from rich to<br>
poor AST detail?<br>
<br>
Stand-alone tool > libclang > py libclang<br></blockquote><div><br></div><div>The question is what you want to do; if we're talking IDE support, we don't want every IDE to go and fiddle with the clang AST - it's complex and hard to get right.</div><div>Instead, we want to build tools in clang/clang-tools-extra, and export those via libclang (or something similar). That way, all IDEs will have a common set of well-tested tools.</div><div>If you want to build your own one-of code transformation, I'd recommend to write it in C++ against the clang AST directly.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
Bhargava<br>
</blockquote></div></div>