<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div>Le 6 juil. 09 à 16:02, Martin Carlberg a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello!<div><br></div><div>I have a problem with the Static Analyzer. I have the following class:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #aa0d91">@interface</span> MyClass : NSObject {}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">- (CFDateRef) returnsCFRetainedCF <span style="color: #643820">CF_RETURNS_RETAINED</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="color: rgb(170, 13, 145); ">@end</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(170, 13, 145); ">@implementation<span style="color: #000000"> MyClass</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">- (CFDateRef) returnsCFRetainedCF {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #aa0d91">return</span> CFDateCreate(<span style="color: #1c00cf">0</span>, CFAbsoluteTimeGetCurrent()); <span style="color: #007400">// Potential leak of an object…</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-style-span" style="color: rgb(170, 13, 145); ">@end</span></div><div><font class="Apple-style-span" color="#AA0D91" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" color="#AA0D91" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">When I run the Static Analyzer on this I get an issue "Potential leak of an object allocated on line n". I have tried to remove the issue with the "CF_RETURNS_RETAINED" in the interface declaration (as you can see above) but that does not work. It works fine if I make a cast and return the object as an objC object (NSDate*).</span></span></font></div><div><br></div><div>I'm running XCode 3.2 on Mac OS 10.6 Beta (IDE/Core: 1602.0, ToolSupport: 1591.0). I have a small XCode project if anyone wants to look closer at my problem: <a href="http://oops.se/StaticAnalyzerTest.zip">http://oops.se/StaticAnalyzerTest.zip</a></div></div></div></blockquote></div><br></div><div><br></div><div>AFAK, Xcode 3.2 is under NDA and cannot be discussed publicly.<div>That said, it does not include that last build of clang, and I don't think the version distributed with Xcode 3.2 supports <span class="Apple-style-span" style="color: rgb(100, 56, 32); font-family: Monaco; font-size: 10px; ">CF_RETURNS_RETAINED. </span></div><div><span class="Apple-style-span" style="color: rgb(100, 56, 32); font-family: Monaco; font-size: 10px; "></span><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="background-color: transparent; font-size: 12px;">Try with an up to date version of the analyzer. </span></font></div><div><br></div></div></body></html>