<div dir="ltr">Hi,<div><br></div><div>I have decided to use libclang because I feel like it would suit my purpose more. I had run-time concerns with the python bindings but the C bindings are working fine. </div><div><br></div><div>I still have a few more questions/concerns. Please see the README on <a href="https://github.com/Saurav-K-Aryal/libclang-help">https://github.com/Saurav-K-Aryal/libclang-help</a> for details. </div><div><br></div><div>The questions are also listed on the top of the file as comments. </div><div><br></div><div>Any help would be appreciated.</div><div><br></div><div>Thanking you.</div><div><br></div><div>Sincerely,</div><div>Saurav</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 11, 2016 at 1:58 AM, Mikhail Ramalho <span dir="ltr"><<a href="mailto:mikhail.ramalho@gmail.com" target="_blank">mikhail.ramalho@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>If you're interested in libTooling, you can check ESBMC [0], more specifically our clang_c_converter [1]. </div><div><br></div><div>We use libTooling to generate the AST and we implement our own AST traverser code. Currently, it only works for C programs; in the future we'll release the C++ code.</div><div><br></div><div>Thanks,</div><div><br></div><div>[0] <a href="https://github.com/esbmc/esbmc" target="_blank">https://github.com/esbmc/esbmc</a></div><div>[1] <a href="https://github.com/esbmc/esbmc/blob/master/clang-c-frontend/clang_c_convert.cpp" target="_blank">https://github.com/esbmc/esbmc/blob/master/clang-c-frontend/clang_c_convert.cpp</a></div><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">2016-07-08 20:57 GMT+01:00 Jonas Devlieghere via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Fri, Jul 8, 2016 at 8:45 PM, Aryal, Saurav via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> Hi everyone,<br>
><br>
> I am just starting out with Clang and working for a project where I am<br>
> trying to generate and compare ASTs to measure code similarity.<br>
<br>
</span>Welcome, good luck with your project!<br>
<span><br>
> I figured around a way using Clang to get the AST, but it turns out I am<br>
> expected to use Libtooling.<br>
<br>
</span>There are actually different interfaces available to interact with<br>
Clang's AST. Which one is best depends on your use case. I'd recommend<br>
looking at [1] to make an informed decision.<br>
<span><br>
> Anyone have an example where I can parse C++<br>
> code to generate an AST using Libtooling.<br>
<br>
</span>Yes; clang's documentation [2] contains an excellent tutorial. There<br>
are also many blog post available that will get you started with<br>
concrete examples, including one I wrote myself when I started looking<br>
at the clang AST [3].<br>
<span><br>
> Also, would love design<br>
> suggestions regarding comparing tree similarity. any examples with<br>
> explanations would be really helpful.<br>
><br>
> Thanking you.<br>
><br>
> Sincerely,<br>
> Saurav<br>
><br>
</span>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
><br>
<br>
[1] <a href="http://clang.llvm.org/docs/Tooling.html" rel="noreferrer" target="_blank">http://clang.llvm.org/docs/Tooling.html</a><br>
[2] <a href="http://clang.llvm.org/docs/LibTooling.html" rel="noreferrer" target="_blank">http://clang.llvm.org/docs/LibTooling.html</a><br>
[3] <a href="https://jonasdevlieghere.com/understanding-the-clang-ast/" rel="noreferrer" target="_blank">https://jonasdevlieghere.com/understanding-the-clang-ast/</a>)<br>
<br>
-- Jonas<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</font></span></div>
</blockquote></div><br></div>