From e45526ea02e4bc05f3cb914e884a0eb45870c845 Mon Sep 17 00:00:00 2001 From: Phoebe Nichols Date: Wed, 21 Aug 2019 09:32:14 -0700 Subject: [PATCH] Fail if incremental analysis is set without changed files Summary: It doesn't make sense to use incremental analysis without specifying changed files. This is a possible source of future bugs. This commit causes infer to die if incremental analysis is used without changed files. --- Previously: I think this code is currently a bit brittle because the CI shadow builds sometimes use `--incremental-analysis` because they are called with the same command as the diff analysis. I am worried that in the future the shadow builds could be broken by this, although everything looks like it works right now. This diff would prevent breaking smoke builds in future because the shadow builds don't set changed-files (afaik). However, possibly this is not the right place to fix the problem. It might be better to change the CI, I'm not sure. Reviewed By: mityal Differential Revision: D16829192 fbshipit-source-id: 5ee1ce9d0 --- infer/src/backend/InferAnalyze.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index 7c3f3c98f..ac0420e92 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -172,7 +172,11 @@ let main ~changed_files = Summary.OnDisk.reset_all ~filter:(Lazy.force Filtering.procedures_filter) () ; L.progress "Done@." ) else if Config.incremental_analysis then - Option.iter ~f:invalidate_changed_procedures changed_files + match changed_files with + | Some cf -> + invalidate_changed_procedures cf + | None -> + L.die InternalError "Incremental analysis enabled without specifying changed files" else 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 *)