<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Clang Static Analyzer</title>
	<atom:link href="http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/feed/" rel="self" type="application/rss+xml" />
	<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/</link>
	<description>All Blown Up</description>
	<lastBuildDate>Fri, 23 Dec 2011 19:11:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Ted Kremenek</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1384</link>
		<dc:creator>Ted Kremenek</dc:creator>
		<pubDate>Tue, 22 Jul 2008 23:43:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1384</guid>
		<description>Quentin - Thanks for the confirmation on the fix to the MissingDealloc check.  A test case that illustrates the check giving erroneous output for SEL ivars would also be extremely useful.

One comment about the dead stores: even if it doesn&#039;t identify real bugs for you, it should never flag a store as being dead if that value is ever read.  Put another way, if the check flags a dead store, it really should be a dead store.  That particular check is not suppose to emit any false positives.  If you notice such cases, please feel free to file a bug report.

Thanks for your continuing feedback regarding the tool!</description>
		<content:encoded><![CDATA[<p>Quentin &#8211; Thanks for the confirmation on the fix to the MissingDealloc check.  A test case that illustrates the check giving erroneous output for SEL ivars would also be extremely useful.</p>
<p>One comment about the dead stores: even if it doesn&#8217;t identify real bugs for you, it should never flag a store as being dead if that value is ever read.  Put another way, if the check flags a dead store, it really should be a dead store.  That particular check is not suppose to emit any false positives.  If you notice such cases, please feel free to file a bug report.</p>
<p>Thanks for your continuing feedback regarding the tool!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quentin Carnicelli</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1375</link>
		<dc:creator>Quentin Carnicelli</dc:creator>
		<pubDate>Mon, 21 Jul 2008 00:33:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1375</guid>
		<description>Ted - MissingDealloc fix worked good, took out 26 false MissingDeallocs for us. Most of the rest were confused about non-retained delegates, which I imagine will be harder to filter out. Also I did see one about a class which had 2 SEL ivars. I&#039;ll see about reporting these on Bugzilla.

We did start working through some of our dead stores, and did find at least one bug in them. But most of them have yet to be useful. The new flags to turn these reports on/off in the newer builds are cool and should settle that though. Thanks!</description>
		<content:encoded><![CDATA[<p>Ted &#8211; MissingDealloc fix worked good, took out 26 false MissingDeallocs for us. Most of the rest were confused about non-retained delegates, which I imagine will be harder to filter out. Also I did see one about a class which had 2 SEL ivars. I&#8217;ll see about reporting these on Bugzilla.</p>
<p>We did start working through some of our dead stores, and did find at least one bug in them. But most of them have yet to be useful. The new flags to turn these reports on/off in the newer builds are cool and should settle that though. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ted Kremenek</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1368</link>
		<dc:creator>Ted Kremenek</dc:creator>
		<pubDate>Wed, 16 Jul 2008 17:15:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1368</guid>
		<description>Hi Quentin,

For the MissingDealloc check, yesterday (after reading your comments) I added support in the analyzer to not flag warnings for objects whose ivars are all IBOutlets (please report problems when this doesn&#039;t work). This should now be in checker-62 or later (available at http://clang.llvm.org).  If anyone has ideas of how the MissingDealloc check can be further improved, please feel free to file a Bugzilla report via the Clang website.

As for the dead stores checker, its purpose is to identify logical mistakes, not penalize legitimate code, so I am completely open to making it smarter to work with different coding idioms. This checker has actually found interesting bugs in code at Apple, with sometimes the check identifying performance bugs and other cases identifying insidious logic errors.  From the performance side, although the optimizer in a compiler can optimize away the store itself, it cannot always optimize away the computation used to generate the value that would be stored to the variable.  This is particularly the case when the value is computed via Objective-C message expressions; since Objective-C is so dynamic, the compiler takes a conservative approach and typically cannot ever inline the called methods.  This means that dead method calls will always be executed, so dead stores can be useful in identifying optimization opportunities for the programmer.

To help address some of your own concerns, in checker-62 I also added support in the analyzer to distinguish between &quot;dead initializations&quot; and &quot;dead stores&quot;, which may go part of the way to give you a way to automatically filter some of the false positives for your specific coding idiom.  I realize that this may not actually help you for your use of error variables, but in general it should be helpful for users to better triage these bugs.  Any suggestions of how to further refine the reporting of dead store bugs to make this check more useful are welcome!

As for reporting more information such as BUGDESC, BUGLINE, etc., we can easily report more information.  Please feel free to file Bugzilla reports with such feature requests!  We want to make the workflow of using this tool both flexible and fluid, so suggestions of how the workflow can be improved are greatly appreciated.  There has also been some mention on the Clang developers&#039; mailing list to potentially support XML output from the analyzer.  This would help enable others who wanted to build their own report tracking and presentation infrastructure.  This is something that I personally won&#039;t have time to work on in the near future, but since the entire tool is open source, anyone who is interested in helping is welcome to do so (more information on the Clang website).</description>
		<content:encoded><![CDATA[<p>Hi Quentin,</p>
<p>For the MissingDealloc check, yesterday (after reading your comments) I added support in the analyzer to not flag warnings for objects whose ivars are all IBOutlets (please report problems when this doesn&#8217;t work). This should now be in checker-62 or later (available at <a href="http://clang.llvm.org" rel="nofollow">http://clang.llvm.org</a>).  If anyone has ideas of how the MissingDealloc check can be further improved, please feel free to file a Bugzilla report via the Clang website.</p>
<p>As for the dead stores checker, its purpose is to identify logical mistakes, not penalize legitimate code, so I am completely open to making it smarter to work with different coding idioms. This checker has actually found interesting bugs in code at Apple, with sometimes the check identifying performance bugs and other cases identifying insidious logic errors.  From the performance side, although the optimizer in a compiler can optimize away the store itself, it cannot always optimize away the computation used to generate the value that would be stored to the variable.  This is particularly the case when the value is computed via Objective-C message expressions; since Objective-C is so dynamic, the compiler takes a conservative approach and typically cannot ever inline the called methods.  This means that dead method calls will always be executed, so dead stores can be useful in identifying optimization opportunities for the programmer.</p>
<p>To help address some of your own concerns, in checker-62 I also added support in the analyzer to distinguish between &#8220;dead initializations&#8221; and &#8220;dead stores&#8221;, which may go part of the way to give you a way to automatically filter some of the false positives for your specific coding idiom.  I realize that this may not actually help you for your use of error variables, but in general it should be helpful for users to better triage these bugs.  Any suggestions of how to further refine the reporting of dead store bugs to make this check more useful are welcome!</p>
<p>As for reporting more information such as BUGDESC, BUGLINE, etc., we can easily report more information.  Please feel free to file Bugzilla reports with such feature requests!  We want to make the workflow of using this tool both flexible and fluid, so suggestions of how the workflow can be improved are greatly appreciated.  There has also been some mention on the Clang developers&#8217; mailing list to potentially support XML output from the analyzer.  This would help enable others who wanted to build their own report tracking and presentation infrastructure.  This is something that I personally won&#8217;t have time to work on in the near future, but since the entire tool is open source, anyone who is interested in helping is welcome to do so (more information on the Clang website).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilja Iwas</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1364</link>
		<dc:creator>Ilja Iwas</dc:creator>
		<pubDate>Tue, 15 Jul 2008 20:38:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1364</guid>
		<description>Quentin,
Thanks for taking the time and writing this article. Otherwise I&#039;d never known this tool even existed.</description>
		<content:encoded><![CDATA[<p>Quentin,<br />
Thanks for taking the time and writing this article. Otherwise I&#8217;d never known this tool even existed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Villiom Podlaski Christiansen</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1363</link>
		<dc:creator>Dan Villiom Podlaski Christiansen</dc:creator>
		<pubDate>Tue, 15 Jul 2008 18:49:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1363</guid>
		<description>I&#039;d suggest adding a line below the statement:
(void)err;

When I write new code, I generally enable as many checks and diagnostics as possible on the assumption that it will improve the quality of the code, and make it more maintainable and readable. I find the aforementioned method a good way of saying &quot;yes, I know this is unused&quot; in e.g. main(). Wrapping it in a macro and optionally using __attribute__((unused)) might be even better.

(I&#039;m a measly CS student, so I wouldn&#039;t know whether it actually works out there in the Real World ;))</description>
		<content:encoded><![CDATA[<p>I&#8217;d suggest adding a line below the statement:<br />
(void)err;</p>
<p>When I write new code, I generally enable as many checks and diagnostics as possible on the assumption that it will improve the quality of the code, and make it more maintainable and readable. I find the aforementioned method a good way of saying &#8220;yes, I know this is unused&#8221; in e.g. main(). Wrapping it in a macro and optionally using __attribute__((unused)) might be even better.</p>
<p>(I&#8217;m a measly CS student, so I wouldn&#8217;t know whether it actually works out there in the Real World ;))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert 'Groby' Blum</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1362</link>
		<dc:creator>Robert 'Groby' Blum</dc:creator>
		<pubDate>Tue, 15 Jul 2008 18:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1362</guid>
		<description>Can&#039;t speak for the RA guys, but in my case, I&#039;m also reluctant to use the (void)doStuff();

Why? Because by assigning it to a variable, you can see the error code in debug builds, or potentially even attach conditional break points.</description>
		<content:encoded><![CDATA[<p>Can&#8217;t speak for the RA guys, but in my case, I&#8217;m also reluctant to use the (void)doStuff();</p>
<p>Why? Because by assigning it to a variable, you can see the error code in debug builds, or potentially even attach conditional break points.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1361</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Tue, 15 Jul 2008 14:49:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1361</guid>
		<description>Kevin, that’s what I’ve been telling him, but he doesn’t like that. ;-)</description>
		<content:encoded><![CDATA[<p>Kevin, that’s what I’ve been telling him, but he doesn’t like that. ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: table</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1359</link>
		<dc:creator>table</dc:creator>
		<pubDate>Tue, 15 Jul 2008 13:02:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1359</guid>
		<description>I&#039;m happy Mac/Objective C land is finally getting static analysers.  Are there any continuous integration build servers that group together unit tests, Clang&#039;s static analysis and other reports?</description>
		<content:encoded><![CDATA[<p>I&#8217;m happy Mac/Objective C land is finally getting static analysers.  Are there any continuous integration build servers that group together unit tests, Clang&#8217;s static analysis and other reports?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Ballard</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1358</link>
		<dc:creator>Kevin Ballard</dc:creator>
		<pubDate>Tue, 15 Jul 2008 07:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1358</guid>
		<description>Quentin, if you want to annotate that a function&#039;s return value is being explicitly ignored, I would suggest something like: (void)doStuff();</description>
		<content:encoded><![CDATA[<p>Quentin, if you want to annotate that a function&#8217;s return value is being explicitly ignored, I would suggest something like: (void)doStuff();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quentin Carnicelli</title>
		<link>http://rogueamoeba.com/utm/2008/07/14/the-clang-static-analyzer/comment-page-1/#comment-1357</link>
		<dc:creator>Quentin Carnicelli</dc:creator>
		<pubDate>Tue, 15 Jul 2008 07:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.rogueamoeba.com/utm/?p=550#comment-1357</guid>
		<description>Ted - Overall we are very happy with it as is.

Most of the MissingDealloc false positives are coming from Window/View objects whos ivars are all IBOutlets (and thus released by NSWindowController or the like). Over time we&#039;ll probably just add -deallocs to all our classes, as stylistically I think that is a beneficial thing to do.

The DeadStores on the other hand, bug me more. We often do DeadStores on purpose, like: int err = doStuff(); //Ignore error because we don&#039;t care if doStuff() fails. This way the code annotates that an error is returned, and ignored on purpose. These I have no plans on changing.

I believe the true solution for false positives though, is a way of tracking these bugs, this way a false positive can be marked as such, and ignored from future reports. Between BUGDESC, BUGLINE and BUGPATH we can almost do this now, but not quite. If we had just a little more information like the function the bug is in, and the line number relative to the start of the function (or similar), that would be enough for us to build a persistent tracker on top of the reports.</description>
		<content:encoded><![CDATA[<p>Ted &#8211; Overall we are very happy with it as is.</p>
<p>Most of the MissingDealloc false positives are coming from Window/View objects whos ivars are all IBOutlets (and thus released by NSWindowController or the like). Over time we&#8217;ll probably just add -deallocs to all our classes, as stylistically I think that is a beneficial thing to do.</p>
<p>The DeadStores on the other hand, bug me more. We often do DeadStores on purpose, like: int err = doStuff(); //Ignore error because we don&#8217;t care if doStuff() fails. This way the code annotates that an error is returned, and ignored on purpose. These I have no plans on changing.</p>
<p>I believe the true solution for false positives though, is a way of tracking these bugs, this way a false positive can be marked as such, and ignored from future reports. Between BUGDESC, BUGLINE and BUGPATH we can almost do this now, but not quite. If we had just a little more information like the function the bug is in, and the line number relative to the start of the function (or similar), that would be enough for us to build a persistent tracker on top of the reports.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

