<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Jul 6, 2017 at 10:57 AM Gábor Horváth <<a href="mailto:xazax.hun@gmail.com">xazax.hun@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 5 July 2017 at 23:09, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</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"><div class="gmail_extra"><div class="gmail_quote"><span>On 26 June 2017 at 07:16, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.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"><div class="gmail_quote"><span><div dir="ltr">On Mon, Jun 26, 2017 at 4:08 PM Gábor Horváth via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,<br><br></div>Some benchmarks of the binary size after introducing the libTooling dependency to clang (using static linking on Linux): <br><div><div><br>Release:<br><div>85457072 -> 85505864<br></div><div>Debug:<br>1777932672 -> 1779938696<br><br></div><div>The increase is less than 1% in both cases. So, in my opinion, the binary size is not really a problem here.<br></div><div>Of course, the link times might increase a bit as well. <br></div><div><br></div><div>A question is, who should make the call whether this penalty is ok or not?<br></div></div></div></div></blockquote><div><br></div></span><div>(after replying on the patch without noticing that this thread is not part of the patch, here it goes again :) </div><div><span style="color:rgb(33,33,33);font-size:13px">Richard (cc'ed) usually owns decisions around clang itself. Writing an email to cfe-dev with the numbers and wait for whether others have concerns would probably also be good (many will probably not continue reading this thread).</span></div></div></div></blockquote><div><br></div></span><div>I'm a bit lost as to what's actually being proposed here. It seems that there are at least three separate questions:</div><div><br></div><div>1) Does some kind of support for a database of multiple translation units belong in Clang? (The exact design of that database can be discussed separately.)</div><div>2) Should it be a separate library or part of libTooling?</div><div>3) Is it acceptable for the clang static analyser (and thus the clang binary) to link against that library?</div><div><br></div><div>My thoughts:</div><div><br></div><div>1: Yes, this seems like a sensible thing to have within the clang repository, particularly if there would be in-tree users of it. The clang static analyser would be one justification for this; another would be support of exported templates (if we ever want to be C++98 feature-complete). We'll need to discuss what the model is for this layer (multiple ASTContexts? one ASTContext modeling multiple TUs?), and how it fits in with other parts of Clang that solve similar problems (particularly ExternalASTSources, the serialization layer, ASTImporter).</div></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>This functionality basically using the serialization layer and ASTImporter, and provides the user with an easy interface to import function definitions from other TU and merge into the current one. This could be extended to any kinds of definitions once users need that. <br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>2: I haven't seen anyone provide good justification for merging this library with libTooling, and the fact that the static analyser wants to use this and doesn't want tooling support strongly suggests to me that it should be separate.</div></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Once we add on demand reparsing instead of loading AST files, the libTooling will be a dependency of this code. Moreover it does nothing static analyzer specific, this is the reason why we was thinking that libTooling is a good place for this functionality.<br><br></div><div>The currently proposed (libTooling) functionality can load certain interesting function definitions from external source into the current AST, so existing single TU tools can operate on the AST with more available information as if they had cross TU capabilities. <br></div></div></div></div></blockquote><div><br></div><div>I think we can generally break everything that deals with running clang out of libtooling into an extra library.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>3: The above binary size increases seem acceptable for a significant feature that the static analyser needs.</div></div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Great news, thanks!<br><br></div><div>Regards,<br></div><div>Gábor<br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="m_-7319533834293648873h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-7319533834293648873m_2411873673979389581h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 23 June 2017 at 22:06, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><span class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-"><blockquote type="cite"><div>On Jun 23, 2017, at 12:39 PM, Gábor Horváth <<a href="mailto:xazax.hun@gmail.com" target="_blank">xazax.hun@gmail.com</a>> wrote:</div><br class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-m_-8640984283138883781Apple-interchange-newline"><div><div dir="ltr">This is a dependency for the Static Analyzer component within clang (to another component, which is in clang as well). </div></div></blockquote><div><br></div></span><div>OK. This means that we are talking about adding a dependency on libTooling to clang. This would not only effect the static analyzer, so we’d need an OK from a greater clang community.</div><span class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-"><br><blockquote type="cite"><div><div dir="ltr">It is a similar dependency to this: <a href="https://github.com/llvm-mirror/clang/commit/a994aad333a56b8c9dd49bcfb5090a393d193387" target="_blank">https://github.com/llvm-mirror/clang/commit/a994aad333a56b8c9dd49bcfb5090a393d193387</a><br></div><div class="gmail_extra"><br></div></div></blockquote><div><br></div></span><div>There are 2 differences from the dependency on ASTMatchers:</div><div> - Nothing that is presently in libTooling us used by clang.</div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>This is actually not a difference. When the commit above was excepted, it was the first use of ASTMatchers in the clang binary. <br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div> - The new component that the analyzer will depend on will be supporting a very experimental feature.</div><div><br></div><div>The other expedient options that I can see are:</div><div> - Adding a separate library with just the functionality that this feature needs.</div><div> - Making the dependency conditional, following the same style as Z3 support, and keeping it that way until the feature is fully implemented. This solution definitely has downsides.</div><div><br></div><div>Yet another solution is to pull the analyzer out of clang, but unfortunately that is non-trivial, so I am not sure if there are volunteers for the task.</div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I agree that pulling the analyzer out is a big task and would also break the backward compatibility of the command line. So it is not the best solution for the users.<br><br></div><div>Regards,<br></div><div>Gábor<br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><span class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-HOEnZb"><font color="#888888"><div><br></div><div>Anna.</div></font></span><div><div class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-h5"><div><br></div><blockquote type="cite"><div><div class="gmail_extra"><div class="gmail_quote">On 23 June 2017 at 19:48, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><span><blockquote type="cite"><div>On Jun 23, 2017, at 1:40 AM, Gábor Horváth <<a href="mailto:xazax.hun@gmail.com" target="_blank">xazax.hun@gmail.com</a>> wrote:</div><br class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-m_-8640984283138883781m_-7693555238452178293Apple-interchange-newline"><div><div dir="ltr"><div><div><div>Anna,<br><br></div>Are you ok having libTooling as a dependency of the Static Analyzer? </div></div></div></div></blockquote><div><br></div></span><div>Are we talking about introducing dependency for scan-build or clang itself?</div><div><div class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-m_-8640984283138883781h5"><div><br></div><blockquote type="cite"><div><div dir="ltr"><div><div>I think this is not a bad direction since it has other good utilities that the Static Analyzer could use in the future such as Replacements, FixIts. <br><br></div>Regards,<br></div>Gábor<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 June 2017 at 12:10, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">For clang tooling, I don't really expect us to do cross-TU AST loading outside of what modules will provide, as that inherently doesn't scale. Instead, we usually design pipelined approaches where the first "scan" over the codebase provides data which are reduced to the information needed for the tool.<div><br><div><div>That said, I can't predict the future, and people have expressed interest in that functionality, so</div></div></div><div>a) I agree it's a good idea to add and </div><div>b) I think it's a good fit for libtooling</div><div><br></div><div>Cheers,</div><div>/Manuel</div><div><br></div></div><div class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-m_-8640984283138883781m_-7693555238452178293HOEnZb"><div class="m_-7319533834293648873m_2411873673979389581m_-1270824421744607859m_-2006125352813471392gmail-m_-8640984283138883781m_-7693555238452178293h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 22, 2017 at 11:58 AM Aleksei Sidorin <<a href="mailto:a.sidorin@samsung.com" target="_blank">a.sidorin@samsung.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Gabor,<br>
<br>
Internally, we have created XTU module inside clang (lib/XTU). I think<br>
it is the best way because importing is not related to analyzer<br>
directly. We're not going to use it outside of CSA but I think future<br>
users should have such possibility.<br>
<br>
22.06.2017 12:41, Gábor Horváth пишет:<br>
> Hi!<br>
><br>
> It looks like there is a consensus to accept the cross translation<br>
> unit analysis patch into the clang static analyzer:<br>
> <a href="https://reviews.llvm.org/D30691" rel="noreferrer" target="_blank">https://reviews.llvm.org/D30691</a><br>
><br>
> There is one part of the patch that is independent of the static<br>
> analyzer. The logic which can look up a function in an index and load<br>
> a serialized AST that contains the definition of the function.<br>
> The lookup is cached, and after the AST is loaded, the function<br>
> definition will be merged into the original AST.<br>
><br>
> Right now, in the current patch, this functionality is in the<br>
> ASTContext. This is definitely not the right place to put this. So the<br>
> question is, do you plan to utilize similar functionality in Clang<br>
> tooling or clang tidy?<br>
><br>
> If yes, we might end up creating a new module for that (or add it to<br>
> an existing commonly used one like libtooling?). If no, we will move<br>
> the corresponding code to the static analyzer.<br>
><br>
> What do you think?<br>
><br>
> In case you are interested in how it works, you can check out the<br>
> EuroLLVM talk:<br>
> <a href="http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#7" rel="noreferrer" target="_blank">http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#7</a><br>
><br>
> Regards,<br>
> Gábor<br>
<br>
<br>
--<br>
Best regards,<br>
Aleksei Sidorin,<br>
SRR, Samsung Electronics<br>
<br>
</blockquote></div>
</div></div></blockquote></div><br></div>
</div></blockquote></div></div></div><br></div></blockquote></div><br></div>
</div></blockquote></div></div></div><br></div></blockquote></div></div></div></div></div><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>
</span></blockquote></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div></div></div></blockquote></div></div>