[cfe-dev] Static Analyzer

Jean-Daniel Dupas devlists at shadowlab.org
Mon Jul 6 07:15:12 PDT 2009

Le 6 juil. 09 à 16:02, Martin Carlberg a écrit :

> Hello!
> I have a problem with the Static Analyzer. I have the following class:
> @interface MyClass : NSObject {}
> - (CFDateRef) returnsCFRetainedCF CF_RETURNS_RETAINED;
> @end
> @implementation MyClass
> - (CFDateRef) returnsCFRetainedCF {
> 	return CFDateCreate(0, CFAbsoluteTimeGetCurrent()); // Potential  
> leak of an object…
> }
> @end
> 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*).
> 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: http://oops.se/StaticAnalyzerTest.zip

AFAK, Xcode 3.2 is under NDA and cannot be discussed publicly.
That said, it does not include that last build of clang, and I don't  
think the version distributed with Xcode 3.2 supports  
Try with an up to date version of the analyzer.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090706/f8eabd98/attachment.html>

More information about the cfe-dev mailing list