[cfe-dev] Static Analyzer
Martin Carlberg
martin at oops.se
Mon Jul 6 07:02:21 PDT 2009
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
Is this how it should work or is this a bug? Any information would be
very helpful.
Thanks and best regards,
- Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090706/9610476d/attachment.html>
More information about the cfe-dev
mailing list