<div dir="ltr">So we are primarily focusing on improving clang SA capability to do cross file analysis, but with nm analysis on object file can we have the clang SA with it for analysis. Our aim is to find bugs or security vulnerabilities across files with the help of clang SA.<div>Thanks,</div><div>Siddharth</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 19, 2017 at 11:01 PM, Chris Bieneman <span dir="ltr"><<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Sep 19, 2017, at 10:09 AM, Siddharth Shankar Swain <<a href="mailto:h2015096@pilani.bits-pilani.ac.in" target="_blank">h2015096@pilani.bits-pilani.<wbr>ac.in</a>> wrote:</div><br class="m_-8124018215790345295Apple-interchange-newline"><div><div dir="ltr">Hi Chris,<div>Thanks for the suggestion i was trying to use the patch <a href="https://reviews.llvm.org/D30691" target="_blank">https://reviews.llvm.<wbr>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></div></span><div>There is a tutorial on ASTVisitors here:</div><div><a href="http://clang.llvm.org/docs/RAVFrontendAction.html" target="_blank">http://clang.llvm.org/docs/<wbr>RAVFrontendAction.html</a></div><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div> What is <span style="font-size:12.8px">`nm` on the object files ?</span></div></div></div></blockquote><div><br></div></span><div>nm is a standard unix tool:</div><div><a href="https://en.wikipedia.org/wiki/Nm_(Unix)" target="_blank">https://en.wikipedia.org/wiki/<wbr>Nm_%28Unix%29</a></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div></font></span><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div><span style="font-size:12.8px"> Can u suggest some approach to start on this cross file analysis tool. </span></div><div><span style="font-size:12.8px">Thanks,</span></div><div><span style="font-size:12.8px">Siddharth</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 19, 2017 at 9:42 PM, Chris Bieneman <span dir="ltr"><<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>></span> wrote:<br><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>
<span class="m_-8124018215790345295im m_-8124018215790345295HOEnZb"><br>
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>
<br>
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>
<br>
-Chris<br>
<br>
> On Sep 14, 2017, at 6:57 AM, Siddharth Shankar Swain via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
</span><div class="m_-8124018215790345295HOEnZb"><div class="m_-8124018215790345295h5">> Hi,<br>
> 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>
> sincerely,<br>
> Siddharth<br>
</div></div><div class="m_-8124018215790345295HOEnZb"><div class="m_-8124018215790345295h5">> ______________________________<wbr>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div>