[racerd] no need for quadratic check

Reviewed By: jeremydubreil

Differential Revision: D14367698

fbshipit-source-id: 60c9a4b19
master
Nikos Gorogiannis 6 years ago committed by Facebook Github Bot
parent 22aea43f76
commit 817b1bdf31

@ -942,7 +942,7 @@ end = struct
M.fold f map a M.fold f map a
end end
let should_report_on_proc procdesc tenv = let should_report_on_proc {procdesc; tenv} =
let proc_name = Procdesc.get_proc_name procdesc in let proc_name = Procdesc.get_proc_name procdesc in
match proc_name with match proc_name with
| Java java_pname -> | Java java_pname ->
@ -1116,18 +1116,19 @@ let report_unsafe_accesses (aggregated_access_map : ReportMap.t) =
update_reported snapshot.access pname reported_acc ) update_reported snapshot.access pname reported_acc )
in in
let report_accesses_on_location (grouped_accesses : reported_access list) reported_acc = let report_accesses_on_location (grouped_accesses : reported_access list) reported_acc =
(* reset the reported reads and writes for each memory location *) (* Don't report on location if all accesses are on non-concurrent contexts *)
let reported = if
{ reported_acc with List.for_all grouped_accesses ~f:(fun ({threads} : reported_access) ->
reported_writes= Typ.Procname.Set.empty; reported_reads= Typ.Procname.Set.empty } ThreadsDomain.is_any threads |> not )
in then reported_acc
let should_report {tenv; procdesc} = else
List.exists grouped_accesses ~f:(fun ({threads} : reported_access) -> (* reset the reported reads and writes for each memory location *)
ThreadsDomain.is_any threads ) let init =
&& should_report_on_proc procdesc tenv { reported_acc with
in reported_writes= Typ.Procname.Set.empty; reported_reads= Typ.Procname.Set.empty }
let reportable_accesses = List.filter ~f:should_report grouped_accesses in in
List.fold reportable_accesses ~init:reported ~f:(report_unsafe_access reportable_accesses) let reportable_accesses = List.filter ~f:should_report_on_proc grouped_accesses in
List.fold reportable_accesses ~init ~f:(report_unsafe_access reportable_accesses)
in in
ReportMap.fold report_accesses_on_location aggregated_access_map empty_reported |> ignore ReportMap.fold report_accesses_on_location aggregated_access_map empty_reported |> ignore

Loading…
Cancel
Save