What is the importance of clang_analyzer as without using this I see analyzer shouting a leak on the below piece of code.
#ifndef __clang_analyzer__
CGPathRef pathWithRoundRect(CGRect iRect, CGFloat iRadius) {
CGMutablePathRef returnVal = CGPathCreateMutable();
CGPathMoveToPoint();
CGPathAddArcToPoint();
CGPathAddArcToPoint();
CGPathAddArcToPoint();
CGPathAddArcToPoint();
CGPathCloseSubpath(returnVal);
return returnVal;
}
#endif
__clang_analyzer__is a macro, defined when the program is compiled for the analyzer (see the Clang User’s Manual).When it’s defined, the code between
#ifndefand#endifisn’t being compiled, which means that the analyzer doesn’t see it and can’t tell you about the ownedCGMutablePaththat you’re returning from a function whose name doesn’t indicate it returns an owning reference.You should consider adding
createto the beginning of the function name.