Page MenuHomePhabricator

[analyzer] RetainCount: Add a suppression for functions that follow "the Matching rule".
ClosedPublic

Authored by NoQ on Apr 25 2019, 4:42 PM.

Details

Summary

In the OSObject universe there appears to be another slightly popular contract, apart from "create" and "get", which is "matching". It optionally consumes a "table" parameter and if a table is passed, it fills in the table and returns it at +0; otherwise, it creates a new table, fills it in and returns it at +1.

For now suppress false positives by doing a conservative escape on all functions that end with "Matching", which is the naming convention that seems to be followed by all such methods. Let's see if we'll ever get to actually supporting these semantics.

Diff Detail

Repository
rC Clang

Event Timeline

NoQ created this revision.Apr 25 2019, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2019, 4:42 PM
dcoughlin accepted this revision.Apr 25 2019, 5:03 PM

Looks good to me!

This revision is now accepted and ready to land.Apr 25 2019, 5:03 PM
NoQ updated this revision to Diff 196763.Apr 25 2019, 5:07 PM

Make tests more C++-y. They still test the C function case.

NoQ updated this revision to Diff 196764.Apr 25 2019, 5:08 PM

Fix whitespace.

This revision was automatically updated to reflect the committed changes.