|
|
@ -47,10 +47,12 @@ let direct_atomic_property_access context stmt_info ivar_name =
|
|
|
|
| Some Sil.Tstruct (flds1, flds2, _, _, _, _, _) ->
|
|
|
|
| Some Sil.Tstruct (flds1, flds2, _, _, _, _, _) ->
|
|
|
|
(* We give the warning when:
|
|
|
|
(* We give the warning when:
|
|
|
|
(1) the property has the atomic attribute and
|
|
|
|
(1) the property has the atomic attribute and
|
|
|
|
(2) the access of the ivar is not in a getter or setter method. This condition
|
|
|
|
(2) the access of the ivar is not in a getter or setter method.
|
|
|
|
avoids false positives *)
|
|
|
|
(3) the access of the ivar is not in the init method
|
|
|
|
|
|
|
|
Last two conditions avoids false positives *)
|
|
|
|
let condition = (CField_decl.is_ivar_atomic ivar (flds1 @ flds2))
|
|
|
|
let condition = (CField_decl.is_ivar_atomic ivar (flds1 @ flds2))
|
|
|
|
&& not (ObjcProperty_decl.is_getter_setter curr_class mname ivar_name) in
|
|
|
|
&& not (ObjcProperty_decl.is_getter_setter curr_class mname ivar_name)
|
|
|
|
|
|
|
|
&& not (Procname.is_constructor mname) in
|
|
|
|
let warning_desc = {
|
|
|
|
let warning_desc = {
|
|
|
|
name = "DIRECT_ATOMIC_PROPERTY_ACCESS";
|
|
|
|
name = "DIRECT_ATOMIC_PROPERTY_ACCESS";
|
|
|
|
description = "Direct access to ivar " ^ (Ident.fieldname_to_string ivar) ^
|
|
|
|
description = "Direct access to ivar " ^ (Ident.fieldname_to_string ivar) ^
|
|
|
|