Page MenuHomePhabricator

[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.

Authored by NoQ on Apr 5 2018, 2:24 PM.



D38877 added support for the misplaced CF_RETURNS_RETAINED annotation on CFRetain() wrappers. It works by trusting the function's name (seeing if it confirms to the CoreFoundation naming convention) rather than the annotation.

There are more false positives caused by users using a different naming convention, namely starting the function name with "retain" or "release" rather than suffixing it with "retain" or "release" respectively.

Because this isn't according to the naming convention, these functions are usually inlined and the annotation is therefore ignored, which is correct. But sometimes we run out of inlining stack depth and the function is evaluated conservatively and then the annotation is trusted.

Add support for the "alternative" naming convention and test the situation when we're running out of inlining stack depth.

Diff Detail

Event Timeline

NoQ created this revision.Apr 5 2018, 2:24 PM
NoQ accepted this revision.Apr 19 2018, 4:10 PM

Committed in rC330375 but i misplaced the phabricator link again, sorry.

This revision is now accepted and ready to land.Apr 19 2018, 4:10 PM
NoQ closed this revision.Apr 19 2018, 4:10 PM