<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Mar 16, 2017 at 7:06 PM Devin Coughlin <<a href="mailto:dcoughlin@apple.com">dcoughlin@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Mar 16, 2017, at 4:42 AM, Manuel Klimek via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="m_3969686606020480451Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg">Yea, none of these seem to be path sensitive, but only flow sensitive, which clang-tidy supports.</div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">I’m surprised that even flow sensitivity is needed. I would have thought a purely lexical analysis on the AST would be sufficient. What is the case where the analysis would need to compute per-program-point facts?</div></div></div></blockquote><div><br></div><div>Well, will depend on whether you'll count analyzing where the "throw" and the corresponding "catch" is as flow sensitive (I would, but I'm no expert :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I could see context sensitivity being useful (to look through calls to unannotated functions) — but with the exception of function pointers and virtual calls I would expect calls to be better handled by analyzing the call graph from the bottom up, inferring the exception behavior for callees before analyzing the caller.</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Devin</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div></div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Thu, Mar 16, 2017 at 12:37 PM Jonas Toth via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Why would the second case not be possible?<div class="gmail_msg">What i have in mind by example:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">```</div><div class="gmail_msg">void definitly_throws() { // should be marked noexcept(false), maybe as configuration option</div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">   if (some_condition())</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">    </span><span style="white-space:pre-wrap" class="gmail_msg">    throw std::logic_error{"Reasons"};</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">     else</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">     </span><span style="white-space:pre-wrap" class="gmail_msg">    // do unproblematic stuff</span></div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">void probably_throws() { // this needs more analysis then AST matching so leave it as is</div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">        try  {</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">   </span><span style="white-space:pre-wrap" class="gmail_msg">    // operation</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">     </span><span style="white-space:pre-wrap" class="gmail_msg">    if (op_failed())</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg"> </span><span style="white-space:pre-wrap" class="gmail_msg">    </span><span style="white-space:pre-wrap" class="gmail_msg">    throw std::runtime_error{"Operation failed"};</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">  } </span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">       catch (std::runtime_error& e)</span></div><div class="gmail_msg"><span style="white-space:pre-wrap" class="gmail_msg">        { /* handle */ }</span></div><div class="gmail_msg">}</div><div class="gmail_msg">```</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The second one can be noexcept if the operation will not throw. It is not noexcept if operation is not noexcept.</div><div class="gmail_msg">What did I miss?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The deeper analysis will not happen if the analyser does not see all code, but if it can shouldnt there the possibility to decide? Maybe it has bad complexity and is therefor not practical. But maybe in some cases there can be insight gained?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">

Am Do, 16. Mär, 2017 um 11:25  schrieb Daniel Marjamäki <<a href="mailto:Daniel.Marjamaki@evidente.se" class="gmail_msg" target="_blank">Daniel.Marjamaki@evidente.se</a>>:<br class="gmail_msg">
<blockquote type="cite" class="gmail_msg">






<div class="gmail_msg m_3969686606020480451m_-4071199109463940059WordSection1"><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">As far as I see:<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">- a function calling only `noexcept` operations that does not throw can be marked noexcept<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">possible<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">- a function that has a `throw` statement not within a `try/catch` block can be marked noexcept(false)<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">Not possible<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">- a function calling a function that is not marked noexcept can not be marked noexcept<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" class="gmail_msg">   but it could be noexecpt with deeper analysis on what exception could be thrown and what exceptions are handled<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p><p class="MsoNormal gmail_msg"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="gmail_msg">not possible<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
</div></blockquote><br class="gmail_msg">
</div>_______________________________________________<br class="gmail_msg">
cfe-dev mailing list<br class="gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg">
</blockquote></div>
_______________________________________________<br class="gmail_msg">cfe-dev mailing list<br class="gmail_msg"><a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg"></div></blockquote></div></div></blockquote></div></div>