Skip to content

Commit

Permalink
Add all pnames to CallGraph in AnalysisDependencyGraph
Browse files Browse the repository at this point in the history
This ensures that function never called are still invalidated.
  • Loading branch information
danielmercier committed Oct 13, 2023
1 parent 7178e5b commit d903f0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion infer/src/backend/AnalysisDependencyGraph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ let build ~changed_files =
| Some deps ->
Procname.HashSet.add proc_name deps
| None ->
Procname.HashSet.singleton proc_name |> SourceFile.Hash.add tenv_deps src_file ) ) ;
Procname.HashSet.singleton proc_name |> SourceFile.Hash.add tenv_deps src_file ) ;
(* Ensure proc_name is part of the graph if it has not been referenced yet *)
if not (CallGraph.mem_procname graph proc_name) then CallGraph.create_node graph proc_name [] ) ;
(* Then, flag in [graph] any procedure with a summary depending (transitively) on either (1) a
deleted procedure, (2) the tenv of a changed file or (3) the summary of a changed procedure. *)
List.iter !deleted_procs ~f:(CallGraph.flag_reachable graph) ;
Expand Down

2 comments on commit d903f0c

@ngorogiannis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The conditional can be avoided if the create call is moved up to L47.

@danielmercier
Copy link
Contributor Author

@danielmercier danielmercier commented on d903f0c Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The conditional can be avoided if the create call is moved up to L47.

I put the statement here to avoid any confusion about proc_name and callee. The iterations above are adding edges from callees to proc_name, and not the other way around. I though it would be confusing to put the create_node above as one would think that it needs to be called before adding edges.

Secondly looking at the code for CallGrah it seems to me that 'create_node' would remove existing successors added in previous iterations of iter_specs

Please sign in to comment.