diff --git a/infer/src/clang/cFrontend_checkers.ml b/infer/src/clang/cFrontend_checkers.ml index 381e367b9..d160cf527 100644 --- a/infer/src/clang/cFrontend_checkers.ml +++ b/infer/src/clang/cFrontend_checkers.ml @@ -29,7 +29,7 @@ type warning_desc = { (* Helper functions *) -let property_name_contains_word pname word = +let name_contains_word pname word = let rexp = Str.regexp_string_case_fold word in try Str.search_forward rexp pname.Clang_ast_t.ni_name 0 >= 0 @@ -87,7 +87,8 @@ let dec_body_eventually atomic_pred param dec = (* Strong Delegate Warning: a property with name delegate should not be declared strong *) let strong_delegate_warning decl_info pname obj_c_property_decl_info = - let condition = property_name_contains_word pname "delegate" + let condition = (name_contains_word pname "delegate") + && not (name_contains_word pname "queue") && ObjcProperty_decl.is_strong_property obj_c_property_decl_info in if condition then Some { name = "STRONG_DELEGATE_WARNING"; diff --git a/infer/tests/codetoanalyze/objc/warnings/strong_delegate.m b/infer/tests/codetoanalyze/objc/warnings/strong_delegate.m index 49c6b3883..5e7a86dfa 100644 --- a/infer/tests/codetoanalyze/objc/warnings/strong_delegate.m +++ b/infer/tests/codetoanalyze/objc/warnings/strong_delegate.m @@ -24,6 +24,10 @@ @property(nonatomic, strong) id OneDelegateFile; +@property(nonatomic, strong) id OneDelegateQueue; + +@property(nonatomic, strong) id OneQueueInTheMiddleDelegate; + @end @implementation A {