[cfe-dev] Static Analyzer
Martin Carlberg
martin at oops.se
Mon Jul 6 08:00:12 PDT 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090706/a709f625/attachment.html>
More information about the cfe-dev
mailing list