<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 19, 2017, at 10:09 AM, Siddharth Shankar Swain <<a href="mailto:h2015096@pilani.bits-pilani.ac.in" class="">h2015096@pilani.bits-pilani.ac.in</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Chris,<div class="">Thanks for the suggestion i was trying to use the patch <a href="https://reviews.llvm.org/D30691" class="">https://reviews.llvm.org/D30691</a> and ASTimporter concept for cross file analysis. Can u explain in details the approach u suggested ?</div></div></div></blockquote><div><br class=""></div><div>There is a tutorial on ASTVisitors here:</div><div><a href="http://clang.llvm.org/docs/RAVFrontendAction.html" class="">http://clang.llvm.org/docs/RAVFrontendAction.html</a></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""> What is <span style="font-size:12.8px" class="">`nm` on the object files ?</span></div></div></div></blockquote><div><br class=""></div><div>nm is a standard unix tool:</div><div><a href="https://en.wikipedia.org/wiki/Nm_(Unix)" class="">https://en.wikipedia.org/wiki/Nm_%28Unix%29</a></div><div><br class=""></div><div>-Chris</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><span style="font-size:12.8px" class=""> Can u suggest some approach to start on this cross file analysis tool. </span></div><div class=""><span style="font-size:12.8px" class="">Thanks,</span></div><div class=""><span style="font-size:12.8px" class="">Siddharth</span></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Sep 19, 2017 at 9:42 PM, Chris Bieneman <span dir="ltr" class=""><<a href="mailto:beanz@apple.com" target="_blank" class="">beanz@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(Apologies for the re-send Siddharth, I failed to cc the list)<br class="">
<span class="im HOEnZb"><br class="">
There is no existing tool that I'm aware of which performs this analysis on the AST. It is possible to do on an AST. You would just need to write an AST Visitor that finds declarations, definitions, and uses of functions.<br class="">
<br class="">
Is there a reason you need to do this at the AST level? With C code this analysis can be trivially performed with `nm` on the object files, so if you don't have a strong reason for needing to do this on the AST I'd just write a script to wrap `nm` rather than writing an AST Visitor.<br class="">
<br class="">
-Chris<br class="">
<br class="">
> On Sep 14, 2017, at 6:57 AM, Siddharth Shankar Swain via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class="">
><br class="">
</span><div class="HOEnZb"><div class="h5">> Hi,<br class="">
> Can anyone help if for example we have multiple c files and we want to analyze their ASTs to find out any dependency between them ( like a function defined in one c file is used in other, any external variable etc ). How can we do it at the AST level? I mean is there any automated tool or flag for it in LLVM. If anyone has any idea please tell.<br class="">
> sincerely,<br class="">
> Siddharth<br class="">
</div></div><div class="HOEnZb"><div class="h5">> ______________________________<wbr class="">_________________<br class="">
> LLVM Developers mailing list<br class="">
> <a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>