[retain cycles] Treat missing fields also angelically when it still happens in rare cases

Reviewed By: mbouaziz

Differential Revision: D7550900

fbshipit-source-id: 11703ab
master
Dulma Churchill 7 years ago committed by Facebook Github Bot
parent e507a600a2
commit aa578ea586

@ -65,17 +65,16 @@ let edge_is_strong tenv obj_edge =
(* returns items annotation for field fn in struct t *)
let get_item_annotation (t: Typ.t) fn =
match t.desc with
| Tstruct name
-> (
let equal_fn (fn', _, _) = Typ.Fieldname.equal fn fn' in
match Tenv.lookup tenv name with
| Some {fields; statics} ->
let find fields =
List.find ~f:equal_fn fields |> Option.value_map ~f:trd3 ~default:[]
in
Some (find fields @ find statics)
| Tstruct name -> (
match Tenv.lookup tenv name with
| Some {fields} -> (
match List.find ~f:(fun (fn', _, _) -> Typ.Fieldname.equal fn fn') fields with
| None ->
None )
None
| Some (_, _, ann) ->
Some ann (* Only returns annotations when the type and field are found in the tenv *) )
| None ->
None )
| _ ->
None
in
@ -104,7 +103,7 @@ let edge_is_strong tenv obj_edge =
ia
| None ->
true
(* Assume the edge is weak if the type cannot be found in the tenv, to avoid FPs *)
(* Assume the edge is weak if the type or field cannot be found in the tenv, to avoid FPs *)
in
not (weak_edge_by_type || weak_edge_by_field)

@ -28,7 +28,6 @@ codetoanalyze/objc/errors/field_superclass/SubtypingExample.m, subtyping_test, 0
codetoanalyze/objc/errors/initialization/struct_initlistexpr.c, field_set_correctly, 2, DIVIDE_BY_ZERO, ERROR, [start of procedure field_set_correctly()]
codetoanalyze/objc/errors/initialization/struct_initlistexpr.c, implicit_expr_set_correctly, 3, DIVIDE_BY_ZERO, ERROR, [start of procedure implicit_expr_set_correctly()]
codetoanalyze/objc/errors/initialization/struct_initlistexpr.c, point_coords_set_correctly, 2, DIVIDE_BY_ZERO, ERROR, [start of procedure point_coords_set_correctly()]
codetoanalyze/objc/errors/memory_leaks_benchmark/CADisplayLinkRetainCycle.m, CADisplay_init, 1, RETAIN_CYCLE, ERROR, [start of procedure init]
codetoanalyze/objc/errors/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m, LinkResolver_test_bad, 3, RETAIN_CYCLE, ERROR, [start of procedure test_bad,Executing synthesized setter setDidFinishLoad:]
codetoanalyze/objc/errors/memory_leaks_benchmark/RetainCycleBlocks.m, RCBlock_retain_self_in_block, 1, RETAIN_CYCLE, ERROR, [start of procedure retain_self_in_block,Executing synthesized setter setHandler:]
codetoanalyze/objc/errors/memory_leaks_benchmark/RetainCycleBlocks.m, objc_blockretain_a_in_block_cycle_3, 1, RETAIN_CYCLE, ERROR, [start of procedure block,Executing synthesized setter setChild:]

Loading…
Cancel
Save