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 17, 2023
1 parent 718eb62 commit 4b95a38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ digraph callgraph {
N0 [ label = "c\nflag=true" ];
N0 -> N1 ;

N2 [ label = "a\nflag=true" ];
N2 -> N3 ;
N4 [ label = "main\nflag=true" ];

N3 [ label = "main\nflag=true" ];
N2 [ label = "d\nflag=false" ];

N3 [ label = "a\nflag=true" ];
N3 -> N4 ;

}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Incremental analysis: Invalidated 4 of 4 procedure summaries, and file-level analyses for 3 distinct files
Incremental analysis: Invalidated 4 of 5 procedure summaries, and file-level analyses for 3 distinct files

0 comments on commit 4b95a38

Please sign in to comment.