Skip to content

Commit 04ec1fb

Browse files
committed
[alpha.webkit.RetainPtrCtorAdoptChecker] An assortment of small enhancements (llvm#135329)
This PR implements various small enhancements to alpha.webkit.RetainPtrCtorAdoptChecker: - Detect leaks from [[X alloc] init] when ARC is disabled. - Detect leaks from calling Create, Copy, and other +1 CF functions. - Recognize [allocX() init] pattern where allocX is a C/C++ function. - Recognize _init in addition to init as an init function. - Recognize [[[X alloc] init] autorelease]. - Recognize CFBridgingRelease. - Support CF_RETRUNS_RETAINED on out arguments of a C function. - Support returning +1 object in Create, Copy, and other +1 functions or +1 selectors. - Support variadic Create, Copy, and other +1 C/C++ functions. To make these enhancements, this PR introduces new visit functions for ObjCMessageExpr, ReturnStmt, VarDecl, and BinaryOperator. These functions look for a specific construct mentioned above and adds an expression such as [[X alloc] init] or CreateX to a DenseSet CreateOrCopyFnCall when the expression does not result in leaks. When the code to detect leaks such as the one in visitObjCMessageExpr later encounters this expression, it can bail out early if the expression is in the set.
1 parent 41f92b6 commit 04ec1fb

File tree

4 files changed

+653
-38
lines changed

4 files changed

+653
-38
lines changed

0 commit comments

Comments
 (0)