|
|
@ -52,7 +52,7 @@ let find_first_arg_pvar node ~fun_name ~class_name_f =
|
|
|
|
else None
|
|
|
|
else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let report_matching_get tenv summary pvar loop_nodes : unit =
|
|
|
|
let report_matching_get attrs err_log tenv pvar loop_nodes : unit =
|
|
|
|
LoopNodes.iter
|
|
|
|
LoopNodes.iter
|
|
|
|
(fun node ->
|
|
|
|
(fun node ->
|
|
|
|
let instrs = Procdesc.Node.get_instrs node in
|
|
|
|
let instrs = Procdesc.Node.get_instrs node in
|
|
|
@ -75,7 +75,7 @@ let report_matching_get tenv summary pvar loop_nodes : unit =
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let loc = Procdesc.Node.get_loc node in
|
|
|
|
let loc = Procdesc.Node.get_loc node in
|
|
|
|
let ltr = [Errlog.make_trace_element 0 loc exp_desc []] in
|
|
|
|
let ltr = [Errlog.make_trace_element 0 loc exp_desc []] in
|
|
|
|
SummaryReporting.log_error summary ~loc ~ltr
|
|
|
|
Reporting.log_error attrs err_log ~loc ~ltr
|
|
|
|
IssueType.inefficient_keyset_iterator exp_desc ) ) )
|
|
|
|
IssueType.inefficient_keyset_iterator exp_desc ) ) )
|
|
|
|
loop_nodes
|
|
|
|
loop_nodes
|
|
|
|
|
|
|
|
|
|
|
@ -102,12 +102,11 @@ let when_dominating_preds_satisfy idom my_node ~fun_name ~class_name_f ~f =
|
|
|
|
aux my_node 4
|
|
|
|
aux my_node 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let checker Callbacks.{summary; exe_env} : Summary.t =
|
|
|
|
let checker {IntraproceduralAnalysis.proc_desc; tenv; err_log} =
|
|
|
|
let proc_desc = Summary.get_proc_desc summary in
|
|
|
|
|
|
|
|
let tenv = Exe_env.get_tenv exe_env (Summary.get_proc_name summary) in
|
|
|
|
|
|
|
|
let cfg = CFG.from_pdesc proc_desc in
|
|
|
|
let cfg = CFG.from_pdesc proc_desc in
|
|
|
|
let _, loop_head_to_loop_nodes = Loop_control.get_loop_control_maps cfg in
|
|
|
|
let _, loop_head_to_loop_nodes = Loop_control.get_loop_control_maps cfg in
|
|
|
|
let idom = Dominators.get_idoms proc_desc in
|
|
|
|
let idom = Dominators.get_idoms proc_desc in
|
|
|
|
|
|
|
|
let attrs = Procdesc.get_attributes proc_desc in
|
|
|
|
Procdesc.NodeMap.iter
|
|
|
|
Procdesc.NodeMap.iter
|
|
|
|
(fun loop_head loop_nodes ->
|
|
|
|
(fun loop_head loop_nodes ->
|
|
|
|
if
|
|
|
|
if
|
|
|
@ -119,6 +118,5 @@ let checker Callbacks.{summary; exe_env} : Summary.t =
|
|
|
|
~class_name_f:(PatternMatch.implements_set tenv) ~f:(fun itr_node _ ->
|
|
|
|
~class_name_f:(PatternMatch.implements_set tenv) ~f:(fun itr_node _ ->
|
|
|
|
when_dominating_preds_satisfy idom itr_node ~fun_name:"keySet"
|
|
|
|
when_dominating_preds_satisfy idom itr_node ~fun_name:"keySet"
|
|
|
|
~class_name_f:(implements_map tenv) ~f:(fun _keySet_node get_pvar ->
|
|
|
|
~class_name_f:(implements_map tenv) ~f:(fun _keySet_node get_pvar ->
|
|
|
|
report_matching_get tenv summary get_pvar loop_nodes ) ) )
|
|
|
|
report_matching_get attrs err_log tenv get_pvar loop_nodes ) ) )
|
|
|
|
loop_head_to_loop_nodes ;
|
|
|
|
loop_head_to_loop_nodes
|
|
|
|
summary
|
|
|
|
|
|
|
|