Skip to content

Commit

Permalink
[annot] Log sources in debug mode
Browse files Browse the repository at this point in the history
Summary: Helps to get stats on how many procedures are sources. (For sinks we already have logging in nodes.)

Reviewed By: jvillard

Differential Revision: D66237252

fbshipit-source-id: 8cfdb940c8cffa6f0f25becc9af974c716489e9c
  • Loading branch information
hajduakos authored and facebook-github-bot committed Nov 20, 2024
1 parent 81510cb commit bef8c76
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions infer/src/checkers/annotationReachability.ml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ let check_srcs_and_find_snk ({InterproceduralAnalysis.proc_desc; tenv} as analys
let proc_name = Procdesc.get_proc_name proc_desc in
let check_one_src_and_find_snk src =
if method_overrides_annot src spec.models tenv proc_name then (
L.d_printfln "%s: Finding paths from source (`@%s`) `%a`" spec.kind src.Annot.class_name
Procname.pp proc_name ;
(* If there are callsites to sinks, find/report such paths. *)
Option.iter (Domain.find_opt spec.sink_annotation annot_map) ~f:(fun sink_map ->
find_paths_to_snk analysis_data src spec sink_map ) ;
Expand Down Expand Up @@ -564,8 +566,11 @@ let checker ({InterproceduralAnalysis.proc_desc} as analysis_data) : Domain.t op
let specs = expensive_specs @ no_alloc_specs @ custom_specs in
let proc_data = {TransferFunctions.analysis_data; loop_nodes; specs} in
let post = Analyzer.compute_post proc_data ~initial proc_desc in
Option.iter post ~f:(fun annot_map ->
List.iter specs ~f:(fun spec ->
spec.AnnotationSpec.pre_check analysis_data ;
check_srcs_and_find_snk analysis_data spec annot_map ) ) ;
let pp_name f = F.pp_print_string f "annotation reachability reporting" in
AnalysisCallbacks.html_debug_new_node_session (Procdesc.get_exit_node proc_desc)
~pp_name ~kind:`ExecNode ~f:(fun () ->
Option.iter post ~f:(fun annot_map ->
List.iter specs ~f:(fun spec ->
spec.AnnotationSpec.pre_check analysis_data ;
check_srcs_and_find_snk analysis_data spec annot_map ) ) ) ;
post

0 comments on commit bef8c76

Please sign in to comment.