[refactor] InferAnalyze initialization code into separate Exe module

Reviewed By: jvillard

Differential Revision: D4114514

fbshipit-source-id: 74fa97a
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent e9654ca51d
commit 9f42c047fe

@ -63,7 +63,7 @@ C_STUBS_OBJ = $(C_STUBS_SOURCE:.c=.o)
#### Backend declarations #### #### Backend declarations ####
INFER_MAIN = backend/infer INFER_MAIN = backend/infer
INFERANALYZE_MAIN = backend/InferAnalyze INFERANALYZE_MAIN = backend/InferAnalyzeExe
#### Checkers declarations #### #### Checkers declarations ####
@ -251,7 +251,7 @@ rei:
%.rei : %.mli %.rei : %.mli
refmt -assume-explicit-arity -heuristics-file unary.txt -parse ml -print re $< > $*.rei refmt -assume-explicit-arity -heuristics-file unary.txt -parse ml -print re $< > $*.rei
roots:=Infer InferAnalyze InferClang JMain InferPrintExe BuckCompilationDatabase roots:=Infer InferAnalyzeExe InferClang JMain InferPrintExe BuckCompilationDatabase
clusters:=base clang java IR clusters:=base clang java IR
src_dirs:=$(shell find * -type d) src_dirs:=$(shell find * -type d)

@ -15,22 +15,6 @@ let module L = Logging;
let module F = Format; let module F = Format;
let () = {
Logging.set_log_file_identifier
CommandLineOption.Analyze (Option.map Filename.basename Config.cluster_cmdline);
if Config.print_builtins {
Builtin.print_and_exit ()
};
switch Config.modified_targets {
| Some file => MergeCapture.modified_file file
| None => ()
};
if (not (Sys.file_exists Config.results_dir)) {
L.err "ERROR: results directory %s does not exist@.@." Config.results_dir;
Config.print_usage_exit ()
}
};
let analyze_exe_env exe_env => { let analyze_exe_env exe_env => {
let init_time = Unix.gettimeofday (); let init_time = Unix.gettimeofday ();
L.log_progress_file (); L.log_progress_file ();
@ -125,7 +109,20 @@ let register_perf_stats_report () => {
PerfStats.register_report_at_exit stats_file PerfStats.register_report_at_exit stats_file
}; };
let () = { let main () => {
Logging.set_log_file_identifier
CommandLineOption.Analyze (Option.map Filename.basename Config.cluster_cmdline);
if Config.print_builtins {
Builtin.print_and_exit ()
};
switch Config.modified_targets {
| Some file => MergeCapture.modified_file file
| None => ()
};
if (not (Sys.file_exists Config.results_dir)) {
L.err "ERROR: results directory %s does not exist@.@." Config.results_dir;
Config.print_usage_exit ()
};
register_perf_stats_report (); register_perf_stats_report ();
BuiltinDefn.init (); BuiltinDefn.init ();
if Config.developer_mode { if Config.developer_mode {
@ -148,7 +145,7 @@ let () = {
ClusterMakefile.create_cluster_makefile clusters Config.makefile_cmdline ClusterMakefile.create_cluster_makefile clusters Config.makefile_cmdline
} else { } else {
IList.iteri (fun i cluster => analyze_cluster i cluster) clusters; IList.iteri (fun i cluster => analyze_cluster i cluster) clusters;
L.stdout "Analysis finished in %as@." pp_elapsed_time () L.stdout "@\nAnalysis finished in %as@." pp_elapsed_time ()
}; };
output_json_makefile_stats clusters output_json_makefile_stats clusters
} }

@ -8,4 +8,9 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
open! Utils; open! Utils;
/** Main module for the analysis after the capture phase */ /** Main module for the analysis after the capture phase */
let main: unit => unit;
let output_json_makefile_stats: list DB.source_dir => unit;

@ -0,0 +1,13 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* 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;
/** Main module for the analysis after the capture phase */
let () = InferAnalyze.main ();

@ -0,0 +1,10 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* 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;
/** Main module for the analysis after the capture phase */
Loading…
Cancel
Save