importance of __clang_analyzer__

cocoa-touch, ios, iphone, objective-c, xcode

Solution

`__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.

Problem

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 ```

Original source