<?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: Static Code Analysis (Clang) and Xcode 3.2</title>
	<atom:link href="http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/feed" rel="self" type="application/rss+xml" />
	<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html</link>
	<description>Tips and Tricks for iPhone developers</description>
	<lastBuildDate>Thu, 29 Jul 2010 23:00:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Patrick Alessi</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-20908</link>
		<dc:creator>Patrick Alessi</dc:creator>
		<pubDate>Thu, 22 Jul 2010 23:44:26 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-20908</guid>
		<description>It&#039;s a shame, CLANG can&#039;t find the memory leak in this code:

    NSMutableString *theString = [[NSMutableString alloc] init];
    
    for (int i=0; i&lt;100; i++)
    {
        [theString appendFormat:@&quot;%d &quot;,i] ;
    }
    
    NSLog(@&quot;theString is: %@&quot;, theString);


Not really sure why. I never release theString.  This is caught easily by the Instruments Leaks tool, but CLANG doesn&#039;t catch it.</description>
		<content:encoded><![CDATA[<p>It&#8217;s a shame, CLANG can&#8217;t find the memory leak in this code:</p>
<p>    NSMutableString *theString = [[NSMutableString alloc] init];</p>
<p>    for (int i=0; i&lt;100; i++)<br />
    {<br />
        [theString appendFormat:@&quot;%d &quot;,i] ;<br />
    }</p>
<p>    NSLog(@&quot;theString is: %@&quot;, theString);</p>
<p>Not really sure why. I never release theString.  This is caught easily by the Instruments Leaks tool, but CLANG doesn&#039;t catch it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Payne</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-14757</link>
		<dc:creator>Robert Payne</dc:creator>
		<pubDate>Thu, 06 May 2010 07:36:06 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-14757</guid>
		<description>Great Article... I simply cannot believe I didn&#039;t know about this before it&#039;s insanely faster than GCC.</description>
		<content:encoded><![CDATA[<p>Great Article&#8230; I simply cannot believe I didn&#8217;t know about this before it&#8217;s insanely faster than GCC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-13325</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Thu, 15 Apr 2010 19:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-13325</guid>
		<description>I have written a simple code to check xcode static analyzer.

char b[15];
	
 char a[50]=&quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&quot;;
   strcpy(b,a);

Surprisingly the xcode unable to detect simple buffer overflow issue. I tried with GCC 4.2, LLVM GCC 4.2 and clang LLVM 1.0. No issue detected. Is these any bench mark available for xcode analysis. How much effective is this?</description>
		<content:encoded><![CDATA[<p>I have written a simple code to check xcode static analyzer.</p>
<p>char b[15];</p>
<p> char a[50]=&#8221;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&#8221;;<br />
   strcpy(b,a);</p>
<p>Surprisingly the xcode unable to detect simple buffer overflow issue. I tried with GCC 4.2, LLVM GCC 4.2 and clang LLVM 1.0. No issue detected. Is these any bench mark available for xcode analysis. How much effective is this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casey</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-9400</link>
		<dc:creator>Casey</dc:creator>
		<pubDate>Sat, 06 Feb 2010 05:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-9400</guid>
		<description>Hi John,

Thanks for the tip!  I suspected that Clean had that effect, but I&#039;m glad to hear it confirmed.  Unfortunately, after running Clean I no longer get any static analysis results in the Build Results window when I think I should (ex: synthesized properties not released in dealloc).  I made sure that &quot;Run Static Analyzer&quot; is enabled in the Project Settings, and this seems to happen regardless of which compiler version I&#039;m using.  I&#039;m not sure how I could have broken it, but you never know.  Thoughts?  I hope I can get this working; the more insight I have into my code, the better.

Cheers.</description>
		<content:encoded><![CDATA[<p>Hi John,</p>
<p>Thanks for the tip!  I suspected that Clean had that effect, but I&#8217;m glad to hear it confirmed.  Unfortunately, after running Clean I no longer get any static analysis results in the Build Results window when I think I should (ex: synthesized properties not released in dealloc).  I made sure that &#8220;Run Static Analyzer&#8221; is enabled in the Project Settings, and this seems to happen regardless of which compiler version I&#8217;m using.  I&#8217;m not sure how I could have broken it, but you never know.  Thoughts?  I hope I can get this working; the more insight I have into my code, the better.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Muchow</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-9397</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Sat, 06 Feb 2010 02:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-9397</guid>
		<description>Casey, you may already know this, however....you can touch all the files in a project by choosing the option &#039;Clean&#039; in the &#039;Build&#039; menu. I do this often, clean and rebuild.

Anyone else have any insight on Clang LVM ??

John</description>
		<content:encoded><![CDATA[<p>Casey, you may already know this, however&#8230;.you can touch all the files in a project by choosing the option &#8216;Clean&#8217; in the &#8216;Build&#8217; menu. I do this often, clean and rebuild.</p>
<p>Anyone else have any insight on Clang LVM ??</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casey</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-9390</link>
		<dc:creator>Casey</dc:creator>
		<pubDate>Fri, 05 Feb 2010 21:45:12 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-9390</guid>
		<description>Hi John,

Thanks for the article.  Clang appears to be a great tool and I would love to add it to my kit, but I&#039;ve run into a few problems:

When I try to set the C/C++ Compiler Version in my Project Settings to Clang LLVM 1.0, I get the error &quot;Library not found for -lgcc&quot; when I attempt to build in Xcode.  When I use the system default compiler (GCC 4.2), I can get static analysis to work on a per-file basis when I Build &amp; Analyze.  I would like to rebuild and analyze all files with Clang, but I&#039;m guessing that I need to Touch each file to have Xcode include it in the build process.

Are there benefits to using Clang LLVM 1.0 as the compiler, or is using GCC and leaving &quot;Run Static Analyzer&quot; checked in the Project Settings enough?  Any advice would be appreciated.

Thanks, and keep up the great work.</description>
		<content:encoded><![CDATA[<p>Hi John,</p>
<p>Thanks for the article.  Clang appears to be a great tool and I would love to add it to my kit, but I&#8217;ve run into a few problems:</p>
<p>When I try to set the C/C++ Compiler Version in my Project Settings to Clang LLVM 1.0, I get the error &#8220;Library not found for -lgcc&#8221; when I attempt to build in Xcode.  When I use the system default compiler (GCC 4.2), I can get static analysis to work on a per-file basis when I Build &amp; Analyze.  I would like to rebuild and analyze all files with Clang, but I&#8217;m guessing that I need to Touch each file to have Xcode include it in the build process.</p>
<p>Are there benefits to using Clang LLVM 1.0 as the compiler, or is using GCC and leaving &#8220;Run Static Analyzer&#8221; checked in the Project Settings enough?  Any advice would be appreciated.</p>
<p>Thanks, and keep up the great work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Muchow</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-8108</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Fri, 25 Dec 2009 00:34:37 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-8108</guid>
		<description>Something doesn&#039;t seem right - there is only one opening { and two closing } . Did you copy the code directly from a code block that compiles?</description>
		<content:encoded><![CDATA[<p>Something doesn&#8217;t seem right &#8211; there is only one opening { and two closing } . Did you copy the code directly from a code block that compiles?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Schapira</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-8099</link>
		<dc:creator>Mark Schapira</dc:creator>
		<pubDate>Thu, 24 Dec 2009 21:56:24 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-8099</guid>
		<description>The tool is an excellent tool. However, I believe that I found an instance where it gave an erroneous warning.

-(unsigned long long) computeEntryValue
{
    NSUInteger length= [self.entryString length];
    NSUInteger digit;
    NSUInteger i;
   // declared and initialized here
    unsigned long long evalue=0;
    for(i=0;i= &#039;0&#039; &amp;&amp; c = &#039;A&#039; &amp;&amp; c &lt;= &#039;F&#039;)
            digit = 10+c-&#039;A&#039;;
        evalue = evalue * base + digit;
    }
    return evalue;
}

The analyzer says that evalue is undefined. However, digit is uninitialized this should have been detected.</description>
		<content:encoded><![CDATA[<p>The tool is an excellent tool. However, I believe that I found an instance where it gave an erroneous warning.</p>
<p>-(unsigned long long) computeEntryValue<br />
{<br />
    NSUInteger length= [self.entryString length];<br />
    NSUInteger digit;<br />
    NSUInteger i;<br />
   // declared and initialized here<br />
    unsigned long long evalue=0;<br />
    for(i=0;i= &#8217;0&#8242; &amp;&amp; c = &#8216;A&#8217; &amp;&amp; c &lt;= &#039;F&#039;)<br />
            digit = 10+c-&#039;A&#039;;<br />
        evalue = evalue * base + digit;<br />
    }<br />
    return evalue;<br />
}</p>
<p>The analyzer says that evalue is undefined. However, digit is uninitialized this should have been detected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl Grainger</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-5568</link>
		<dc:creator>Carl Grainger</dc:creator>
		<pubDate>Thu, 08 Oct 2009 18:39:06 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-5568</guid>
		<description>Cheers John, one of the best articles I&#039;ve come across in months. Clang is top of my toolbox.</description>
		<content:encoded><![CDATA[<p>Cheers John, one of the best articles I&#8217;ve come across in months. Clang is top of my toolbox.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Muchow</title>
		<link>http://iPhoneDeveloperTips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html/comment-page-1#comment-4870</link>
		<dc:creator>John Muchow</dc:creator>
		<pubDate>Tue, 08 Sep 2009 03:09:29 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=3698#comment-4870</guid>
		<description>Elisabeth,

I posted a question on the iPhone Dev Tips Google Group to see if anyone knows the how to set the default compiler to LLVM-Clang:

http://groups.google.com/group/iPhoneDeveloperTips/t/e4cb6b9a642049a8</description>
		<content:encoded><![CDATA[<p>Elisabeth,</p>
<p>I posted a question on the iPhone Dev Tips Google Group to see if anyone knows the how to set the default compiler to LLVM-Clang:</p>
<p><a href="http://groups.google.com/group/iPhoneDeveloperTips/t/e4cb6b9a642049a8" rel="nofollow">http://groups.google.com/group/iPhoneDeveloperTips/t/e4cb6b9a642049a8</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
