[infer] Add --continue-analysis option

Summary:
The `--continue-analysis` option enables continuing analysis after more targets are captured by
`--continue`.  For example,

```
$ infer capture -- buck build tgt1
$ infer analyze --merge
$ infer capture --continue -- bucck build tgt2
$ infer analyze --merge --continue-analyze
```

In the last analysis, it reuses the analysis results of `tgt1` from the previous analysis.  If
`tgt1` and `tgt2` have a same dependency to a library, the analysis results of the library is also
reused.

Reviewed By: dulmarod

Differential Revision: D19996598

fbshipit-source-id: bb6874a6f
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent bcaa0e0dfe
commit 046e392f3a

@ -54,11 +54,11 @@ OPTIONS
Activates: Enable --class-loads and disable all other checkers
(Conversely: --no-class-loads-only)
--continue
Activates: Continue the capture for the reactive analysis,
increasing the changed files/procedures. (If a procedure was
changed beforehand, keep the changed marking.) (Conversely:
--no-continue)
--continue-analysis
Activates: Continue the analysis after more targets are captured
by --continue. The other analysis options should be given the same
before. Not compatible with --reanalyze and
--incremental-analysis. (Conversely: --no-continue-analysis)
--cost
Activates: checker for performance cost analysis (Conversely:

@ -24,6 +24,12 @@ DESCRIPTION
OPTIONS
--continue
Activates: Continue the capture for the reactive analysis,
increasing the changed files/procedures. (If a procedure was
changed beforehand, keep the changed marking.) (Conversely:
--no-continue)
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --print-buckets, --print-types,

@ -250,7 +250,14 @@ OPTIONS
Activates: Continue the capture for the reactive analysis,
increasing the changed files/procedures. (If a procedure was
changed beforehand, keep the changed marking.) (Conversely:
--no-continue) See also infer-analyze(1).
--no-continue) See also infer-capture(1).
--continue-analysis
Activates: Continue the analysis after more targets are captured
by --continue. The other analysis options should be given the same
before. Not compatible with --reanalyze and
--incremental-analysis. (Conversely: --no-continue-analysis)
See also infer-analyze(1).
--cost
Activates: checker for performance cost analysis (Conversely:
@ -1441,8 +1448,8 @@ INTERNAL OPTIONS
--incremental-analysis
Activates: [EXPERIMENTAL] Use incremental analysis for changed
files. Not compatible with --reanalyze. (Conversely:
--no-incremental-analysis)
files. Not compatible with --reanalyze and --continue-analysis.
(Conversely: --no-incremental-analysis)
--iphoneos-target-sdk-version-path-regex-reset
Set --iphoneos-target-sdk-version-path-regex to the empty list.
@ -1664,7 +1671,8 @@ INTERNAL OPTIONS
--reanalyze
Activates: Rerun the analysis. Not compatible with
--incremental-analysis. (Conversely: --no-reanalyze)
--incremental-analysis and --continue-analysis. (Conversely:
--no-reanalyze)
--report-blacklist-files-containing-reset
Set --report-blacklist-files-containing to the empty list.

@ -250,7 +250,14 @@ OPTIONS
Activates: Continue the capture for the reactive analysis,
increasing the changed files/procedures. (If a procedure was
changed beforehand, keep the changed marking.) (Conversely:
--no-continue) See also infer-analyze(1).
--no-continue) See also infer-capture(1).
--continue-analysis
Activates: Continue the analysis after more targets are captured
by --continue. The other analysis options should be given the same
before. Not compatible with --reanalyze and
--incremental-analysis. (Conversely: --no-continue-analysis)
See also infer-analyze(1).
--cost
Activates: checker for performance cost analysis (Conversely:

@ -196,11 +196,12 @@ let invalidate_changed_procedures changed_files =
let main ~changed_files =
let time0 = Mtime_clock.counter () in
register_active_checkers () ;
if Config.reanalyze then (
L.progress "Invalidating procedures to be reanalyzed@." ;
Summary.OnDisk.reset_all ~filter:(Lazy.force Filtering.procedures_filter) () ;
L.progress "Done@." )
else if not Config.incremental_analysis then DB.Results_dir.clean_specs_dir () ;
if not Config.continue_analysis then
if Config.reanalyze then (
L.progress "Invalidating procedures to be reanalyzed@." ;
Summary.OnDisk.reset_all ~filter:(Lazy.force Filtering.procedures_filter) () ;
L.progress "Done@." )
else if not Config.incremental_analysis then DB.Results_dir.clean_specs_dir () ;
let source_files = get_source_files_to_analyze ~changed_files in
(* empty all caches to minimize the process heap to have less work to do when forking *)
clear_caches () ;

@ -1084,11 +1084,19 @@ and compute_analytics =
marking. *)
and continue =
CLOpt.mk_bool ~deprecated:["continue"] ~long:"continue"
~in_help:InferCommand.[(Analyze, manual_generic)]
~in_help:InferCommand.[(Capture, manual_generic)]
"Continue the capture for the reactive analysis, increasing the changed files/procedures. (If \
a procedure was changed beforehand, keep the changed marking.)"
and continue_analysis =
CLOpt.mk_bool ~long:"continue-analysis"
~in_help:InferCommand.[(Analyze, manual_generic)]
"Continue the analysis after more targets are captured by $(b,--continue). The other analysis \
options should be given the same before. Not compatible with $(b,--reanalyze) and \
$(b,--incremental-analysis)."
and costs_current =
CLOpt.mk_path_opt ~long:"costs-current"
~in_help:InferCommand.[(ReportDiff, manual_generic)]
@ -2036,7 +2044,8 @@ and reactive_capture =
and reanalyze =
CLOpt.mk_bool ~long:"reanalyze"
"Rerun the analysis. Not compatible with $(b,--incremental-analysis)."
"Rerun the analysis. Not compatible with $(b,--incremental-analysis) and \
$(b,--continue-analysis)."
and relative_path_backtrack =
@ -2439,7 +2448,7 @@ and use_cost_threshold =
and incremental_analysis =
CLOpt.mk_bool ~long:"incremental-analysis" ~default:false
"[EXPERIMENTAL] Use incremental analysis for changed files. Not compatible with \
$(b,--reanalyze)."
$(b,--reanalyze) and $(b,--continue-analysis)."
and version =
@ -2827,6 +2836,8 @@ and class_loads_roots = String.Set.of_list !class_loads_roots
and compute_analytics = !compute_analytics
and continue_analysis = !continue_analysis
and continue_capture = !continue
and cost = !cost

@ -290,6 +290,8 @@ val command : InferCommand.t
val compute_analytics : bool
val continue_analysis : bool
val continue_capture : bool
val cost : bool

Loading…
Cancel
Save