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 #ifndef
and #endif
isn't being compiled, which means that the analyzer doesn't see it and can't tell you about the owned CGMutablePath
that you're returning from a function whose name doesn't indicate it returns an owning reference.
You should consider adding create
to the beginning of the function name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.