[infer][PR] Added 'delegates' string to exclusions in STRONG_DELEGATE_CHECK

Summary:
Hi!
It's quite common to have collections of delegates. The collection itself is usually named like "delegatesHash", "delegatesStorage" or simply "delegates". Obviously, there is common part in all these cases, but currently you're excluding property only if it contains "queue".
I've added a simple exclusion by common part. It solved false-positive warnings for me and I think for others it'll be quite helpful too.
Closes https://github.com/facebook/infer/pull/582

Reviewed By: ddino

Differential Revision: D4565221

Pulled By: dulmarod

fbshipit-source-id: c48242e
master
Nikita Anisimov 8 years ago committed by Facebook Github Bot
parent cfd3770a8b
commit 096ee4e2a8

@ -138,11 +138,12 @@ DEFINE-CHECKER REGISTERED_OBSERVER_BEING_DEALLOCATED = {
DEFINE-CHECKER STRONG_DELEGATE_WARNING = {
LET name_contains_delegate = property_name_contains_word(delegate);
LET name_does_not_contain_delegates = NOT property_name_contains_word(delegates);
LET name_does_not_contains_queue = NOT property_name_contains_word(queue);
SET report_when =
WHEN
name_contains_delegate AND name_does_not_contains_queue AND is_strong_property()
name_contains_delegate AND name_does_not_contain_delegates AND name_does_not_contains_queue AND is_strong_property()
HOLDS-IN-NODE ObjCPropertyDecl;
SET message = "Property or ivar %decl_name% declared strong";

Loading…
Cancel
Save