<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body class="" style="word-wrap:break-word" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hello!
<div><br>
</div>
<div><span style="font-size: 10pt;">I want to have path-sensitive analysis. However I do not understood how it's done effectively in Clang yet. It's quite different to Cppcheck. :-)</span></div>
<div><br>
</div>
<div>> <span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;">My understanding is that you are working around this by performing checking within a single basic block</span></div>
<div><span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;"><br>
</span></div>
<div><span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;">The problem is mostly that I don't understand how CFG is used effectively. I don't see how to properly handle inner/outer/same scope.</span></div>
<div><br>
</div>
<div>> <span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;">I think it’s best to write these as non-path sensitive data flow analysis on the CFG. What do you think?</span></div>
<div><span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;"><br>
</span></div>
<div><span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;">sorry.. could you be more specific. do you want to move the checker. do you want it to use a different visitor? do you want that we remove some logic?</span></div>
<div><br>
</div>
<div><span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;">best regards,</span></div>
<div><span style="font-family: 'Segoe UI', Helvetica, Arial, sans-serif; font-size: medium;">Daniel Marjamäki</span></div>
<div>
<div><br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">..................................................................................................................</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span style="font-family:'Arial','sans-serif'; color:black; font-size:8pt">Daniel Marjamäki
</span><span style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">Senior Engineer</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8.5pt">Evidente ES East</span><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"> AB<span>
</span>Warfvinges väg 34<span> </span>SE-112 51 Stockholm<span> </span>Sweden </span>
</p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">Mobile</span><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">:<span>
</span>+46 (0)709 12 42 62</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">E-mail:<span>
</span><span> <a tabindex="0" href="mailto:Daniel.Marjamaki@evidente.se">
Daniel.Marjamaki</a></span><a tabindex="0" href="mailto:Daniel.Marjamaki@evidente.se">@evidente.se</a><span>
</span><span> </span></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; font-size:8pt">www.evidente.se</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF787629" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>Från:</b> Anna Zaks [ganna@apple.com]<br>
<b>Skickat:</b> den 27 augusti 2014 19:48<br>
<b>Till:</b> Daniel Marjamäki<br>
<b>Cc:</b> cfe-dev@cs.uiuc.edu; Jordan Rose<br>
<b>Ämne:</b> Re: [cfe-dev] [RFC] Creating base class for 'Test after X' checkers<br>
</font><br>
</div>
<div></div>
<div>Hi Daniel,
<div class=""><br class="">
</div>
<div class="">As Jordan mentioned earlier, I am concerned about making test after div-zero/dereference checkers rely on path sensitive analysis. These require all path reasoning and the analyzer does not guarantee to cover all paths (some of them might be silently
dropped). My understanding is that you are working around this by performing checking within a single basic block; however, in that case relying on the power of path sensitivity is an overkill. I think it’s best to write these as non-path sensitive data flow
analysis on the CFG. What do you think?</div>
<div class=""><br class="">
</div>
<div class="">If we decided to go with path-sensitive checkers for this, addition of the base class would be the right way to go.</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Aug 24, 2014, at 2:25 AM, Daniel Marjamäki <<a href="mailto:Daniel.Marjamaki@evidente.se" class="" target="_blank">Daniel.Marjamaki@evidente.se</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; direction:ltr; font-family:Tahoma; font-size:10pt">
Hello!<br class="">
<br class="">
Recently a TestAfterDivZero checker was added to the static analyser (r212731).<br class="">
<br class="">
We could add many related checkers, for example:<br class="">
* test after null pointer dereference<br class="">
* test after array index out of bounds<br class="">
* test after dangerous/invalid function argument<br class="">
* ...<br class="">
<br class="">
I wonder what you think about creating generic base classes for TestAfterX checkers. Would you prefer copy/paste?<br class="">
<br class="">
I attach a proof of concept patch. It adds a include file llvm/tools/clang/include/StaticAnalyzer/Core/TestAfterChecker.h.
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>This one should be added under include/clang/StaticAnalyzer/Checkers/. See ObjCRetainCount.h as an example.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="" style="font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; direction:ltr; font-family:Tahoma; font-size:10pt">
Is that the proper path where it should be or would it be better somewhere else? There is no implementation but I should add it in llvm/tools/clang/lib/StaticAnalyzer/Core/TestAfterChecker.cpp, shouldn't I? Do you have an opinion about the namespace usage?<br class="">
<br class="">
It might still be possible to move some more code from the checker to the base classes. The current code is work-in-progress.<br class="">
<br class="">
<div class="">Best regards,<br class="">
Daniel Marjamäki<br class="">
<br class="">
<div class="" style="font-family:Tahoma; font-size:13px">
<div class="" style="font-family:Tahoma; font-size:13px">
<div class="" style="font-family:Tahoma; font-size:13px">
<div class="" style="font-family:Tahoma; font-size:13px">
<div class="" style="font-family:Tahoma; font-size:13px">
<div class="" style="font-family:Tahoma; font-size:13px">
<div class="" style="margin:0cm 0cm 0pt"><span class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt">..................................................................................................................</span></div>
<div class="" style="margin:0cm 0cm 0pt"><span class="" style="font-family:Arial,sans-serif; font-size:8pt">Daniel Marjamäki<span class="Apple-converted-space"> </span></span><span class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt">Senior
Engineer</span></div>
<div class="" style="margin:0cm 0cm 0pt"><span lang="EN-US" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8.5pt">Evidente ES East</span><span lang="EN-US" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt"><span class="Apple-converted-space"> </span>AB<span class=""> <span class="Apple-converted-space"> </span></span>Warfvinges
väg 34<span class=""> <span class="Apple-converted-space"> </span></span>SE-112 51 Stockholm<span class=""> <span class="Apple-converted-space"> </span></span>Sweden<span class="Apple-converted-space"> </span></span></div>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt"></span> </p>
<div class="" style="margin:0cm 0cm 0pt"><span lang="EN-GB" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt">Mobile</span><span lang="EN-GB" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt">:<span class=""> <span class="Apple-converted-space"> </span></span>+46
(0)709 12 42 62</span></div>
<div class="" style="margin:0cm 0cm 0pt"><span lang="EN-GB" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt"></span><span lang="EN-GB" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt">E-mail:<span class=""> <span class="Apple-converted-space"> </span></span><span class=""> <span class="Apple-converted-space"> </span><a tabindex="0" href="mailto:Daniel.Marjamaki@evidente.se" class="" target="_blank">Daniel.Marjamaki</a></span><a tabindex="0" href="mailto:Daniel.Marjamaki@evidente.se" class="" target="_blank">@evidente.se</a><span class=""> <span class="Apple-converted-space"> </span></span><span class=""> <span class="Apple-converted-space"> </span></span></span></div>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" class="" style="font-family:Arial,sans-serif; color:gray; font-size:8pt"></span> </p>
<div class="" style="margin:0cm 0cm 0pt"><span lang="EN-GB" class="" style="font-family:Arial,sans-serif; font-size:8pt"><a href="http://www.evidente.se/" class="" target="_blank">www.evidente.se</a></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; float:none; display:inline!important">cfe-dev
mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<a href="mailto:cfe-dev@cs.uiuc.edu" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank">cfe-dev@cs.uiuc.edu</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</div>
</body>
</html>