From fb6d49d6f4e75dcd4614e7e5e47646587638a397 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Mon, 19 Dec 2016 08:20:13 -0800 Subject: [PATCH] [reactive-capture] Don't count compilation time towards analysis timeout Summary: reactive capture spawns clang from within analysis. Time it takes to compile source code shouldn't be counted towards timout Reviewed By: jvillard, cristianoc Differential Revision: D4334037 fbshipit-source-id: 64f417d --- infer/src/backend/OndemandCapture.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/infer/src/backend/OndemandCapture.ml b/infer/src/backend/OndemandCapture.ml index 975a2b5e3..a6fb0938e 100644 --- a/infer/src/backend/OndemandCapture.ml +++ b/infer/src/backend/OndemandCapture.ml @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. *) -open! Utils +open! IStd let compilation_db = lazy (CompilationDatabase.from_json_files !Config.clang_compilation_db_files) @@ -28,7 +28,11 @@ let try_capture (attributes : ProcAttributes.t) : ProcAttributes.t option = Cfg.store_cfg_to_file *) let cfg_filename = DB.source_dir_get_internal_file source_dir ".cfg" in if not (DB.file_exists cfg_filename) then ( - CaptureCompilationDatabase.capture_file_in_database cdb definition_file; + Logging.out "Started capture of %a...@\n" SourceFile.pp definition_file; + Timeout.suspend_existing_timeout ~keep_symop_total:true; + protect + ~f:(fun () -> CaptureCompilationDatabase.capture_file_in_database cdb definition_file) + ~finally:Timeout.resume_previous_timeout; if Config.debug_mode && Option.is_none (AttributesTable.load_defined_attributes ~cache_none:false attributes.proc_name) then (