[cfe-dev] Static Analyzer

Ted Kremenek kremenek at apple.com
Mon Jul 6 10:06:50 PDT 2009


Hi Martin,

Please file a bug report with self-contained Xcode project that  
exhibits the false positive.  I'll then looking at fixing it ASAP.   
Since this issue is with the analyzer itself, it is fine to use  
Bugzilla.  You can also file the bug at bugreporter.apple.com and it  
will get routed to me.  Specific issues with Xcode 3.2 or Snow Leopard  
should not be discussed on this list until it is publicly released.

Ted

On Jul 6, 2009, at 8:00 AM, Martin Carlberg wrote:

>
> 6 jul 2009 kl. 16.15 skrev Jean-Daniel Dupas:
>
>> 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  
>> CF_RETURNS_RETAINED.
>> Try with an up to date version of the analyzer.
>
>
> I tried the latest stable build (checker-0.212.tar.bz2) and it gives  
> the same problem.
>
> - Martin
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

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


More information about the cfe-dev mailing list