@ -136,87 +136,87 @@ let () =
if Config . debug_mode && CLOpt . is_originator then (
if Config . debug_mode && CLOpt . is_originator then (
L . progress " Logs in %s@. " ( ResultsDir . get_path Logs ) ;
L . progress " Logs in %s@. " ( ResultsDir . get_path Logs ) ;
L . progress " Execution ID %Ld@. " Config . execution_id ) ;
L . progress " Execution ID %Ld@. " Config . execution_id ) ;
( if Config . test_determinator && not Config . process_clang_ast then
( match Config . command with
TestDeterminator . compute_and_emit_test_to_run ()
| _ when Config . test_determinator && not Config . process_clang_ast ->
else
TestDeterminator . compute_and_emit_test_to_run ()
match Config . command with
| _ when Option . is_some Config . java_debug_source_file_info ->
| Analyze ->
JSourceFileInfo . debug_on_file ( Option . value_exn Config . java_debug_source_file_info )
run Driver . Analyze
| Analyze ->
| Capture | Compile | Run ->
run Driver . Analyze
run ( Lazy . force Driver . mode_from_command_line )
| Capture | Compile | Run ->
| Report -> (
run ( Lazy . force Driver . mode_from_command_line )
match Config . issues_tests with
| Report -> (
| None ->
match Config . issues_tests with
if not Config . quiet then L . result " %t " SpecsFiles . pp_from_config
| None ->
| Some out_path ->
if not Config . quiet then L . result " %t " SpecsFiles . pp_from_config
IssuesTest . write_from_json ~ json_path : Config . from_json_report ~ out_path
| Some out_path ->
Config . issues_tests_fields )
IssuesTest . write_from_json ~ json_path : Config . from_json_report ~ out_path
| ReportDiff ->
Config . issues_tests_fields )
(* at least one report must be passed in input to compute differential *)
| ReportDiff ->
( match Config . ( report_current , report_previous , costs_current , costs_previous ) with
(* at least one report must be passed in input to compute differential *)
| None , None , None , None ->
( match Config . ( report_current , report_previous , costs_current , costs_previous ) with
L . ( die UserError )
| None , None , None , None ->
" Expected at least one argument among '--report-current', '--report-previous', \
L . die UserError
' - - costs - current' , and ' - - costs - previous' "
" Expected at least one argument among '--report-current', '--report-previous', \
| _ ->
' - - costs - current' , and ' - - costs - previous' "
() ) ;
| _ ->
ReportDiff . reportdiff ~ current_report : Config . report_current
() ) ;
~ previous_report : Config . report_previous ~ current_costs : Config . costs_current
ReportDiff . reportdiff ~ current_report : Config . report_current
~ previous_costs : Config . costs_previous
~ previous_report : Config . report_previous ~ current_costs : Config . costs_current
| Explore -> (
~ previous_costs : Config . costs_previous
match ( Config . procedures , Config . source_files ) with
| Explore -> (
| true , false ->
match ( Config . procedures , Config . source_files ) with
let filter = Lazy . force Filtering . procedures_filter in
| true , false ->
if Config . procedures_summary then
let filter = Lazy . force Filtering . procedures_filter in
let pp_summary fmt proc_name =
if Config . procedures_summary then
match Summary . OnDisk . get proc_name with
let pp_summary fmt proc_name =
| None ->
match Summary . OnDisk . get proc_name with
Format . fprintf fmt " No summary found: %a@ \n " Procname . pp proc_name
| None ->
| Some summary ->
Format . fprintf fmt " No summary found: %a@ \n " Procname . pp proc_name
Summary . pp_text fmt summary
| Some summary ->
in
Summary . pp_text fmt summary
Option . iter ( Procedures . select_proc_names_interactive ~ filter ) ~ f : ( fun proc_names ->
in
L . result " %a " ( fun fmt () -> List . iter proc_names ~ f : ( pp_summary fmt ) ) () )
Option . iter ( Procedures . select_proc_names_interactive ~ filter ) ~ f : ( fun proc_names ->
else
L . result " %a " ( fun fmt () -> List . iter proc_names ~ f : ( pp_summary fmt ) ) () )
L . result " %a "
else
Config . (
Procedures . pp_all ~ filter ~ proc_name : procedures_name
~ attr_kind : procedures_definedness ~ source_file : procedures_source_file
~ proc_attributes : procedures_attributes )
()
| false , true ->
let filter = Lazy . force Filtering . source_files_filter in
L . result " %a "
L . result " %a "
( SourceFiles . pp_all ~ filter ~ type_environment : Config . source_files_type_environment
Config . (
~ procedure_names : Config . source_files_procedure_names
Procedures . pp_all ~ filter ~ proc_name : procedures_name ~ attr_kind : procedures_definedness
~ freshly_captured : Config . source_files_freshly_captured )
~ source_file : procedures_source_file ~ proc_attributes : procedures_attributes )
() ;
()
if Config . source_files_cfg then (
| false , true ->
let source_files = SourceFiles . get_all ~ filter () in
let filter = Lazy . force Filtering . source_files_filter in
List . iter source_files ~ f : ( fun source_file ->
L . result " %a "
(* create directory in captured/ *)
( SourceFiles . pp_all ~ filter ~ type_environment : Config . source_files_type_environment
DB . Results_dir . init ~ debug : true source_file ;
~ procedure_names : Config . source_files_procedure_names
(* collect the CFGs for all the procedures in [source_file] *)
~ freshly_captured : Config . source_files_freshly_captured )
let proc_names = SourceFiles . proc_names_of_source source_file in
() ;
let cfgs = Procname . Hash . create ( List . length proc_names ) in
if Config . source_files_cfg then (
List . iter proc_names ~ f : ( fun proc_name ->
let source_files = SourceFiles . get_all ~ filter () in
Procdesc . load proc_name
List . iter source_files ~ f : ( fun source_file ->
| > Option . iter ~ f : ( fun cfg -> Procname . Hash . add cfgs proc_name cfg ) ) ;
(* create directory in captured/ *)
(* emit the dot file in captured/... *)
DB . Results_dir . init ~ debug : true source_file ;
DotCfg . emit_frontend_cfg source_file cfgs ) ;
(* collect the CFGs for all the procedures in [source_file] *)
L . result " CFGs written in %s/*/%s@. " ( ResultsDir . get_path Debug )
let proc_names = SourceFiles . proc_names_of_source source_file in
Config . dotty_frontend_output )
let cfgs = Procname . Hash . create ( List . length proc_names ) in
| false , false ->
List . iter proc_names ~ f : ( fun proc_name ->
(* explore bug traces *)
Procdesc . load proc_name
if Config . html then
| > Option . iter ~ f : ( fun cfg -> Procname . Hash . add cfgs proc_name cfg ) ) ;
TraceBugs . gen_html_report ~ report_json : ( ResultsDir . get_path ReportJson )
(* emit the dot file in captured/... *)
~ show_source_context : Config . source_preview ~ max_nested_level : Config . max_nesting
DotCfg . emit_frontend_cfg source_file cfgs ) ;
~ report_html_dir : ( ResultsDir . get_path ReportHtml )
L . result " CFGs written in %s/*/%s@. " ( ResultsDir . get_path Debug )
else
Config . dotty_frontend_output )
TraceBugs . explore ~ selector_limit : None ~ report_json : ( ResultsDir . get_path ReportJson )
| false , false ->
~ report_txt : ( ResultsDir . get_path ReportText ) ~ selected : Config . select
(* explore bug traces *)
~ show_source_context : Config . source_preview ~ max_nested_level : Config . max_nesting
if Config . html then
| true , true ->
TraceBugs . gen_html_report ~ report_json : ( ResultsDir . get_path ReportJson )
L . user_error " Options --procedures and --source-files cannot be used together.@ \n " ) ) ;
~ show_source_context : Config . source_preview ~ max_nested_level : Config . max_nesting
~ report_html_dir : ( ResultsDir . get_path ReportHtml )
else
TraceBugs . explore ~ selector_limit : None ~ report_json : ( ResultsDir . get_path ReportJson )
~ report_txt : ( ResultsDir . get_path ReportText ) ~ selected : Config . select
~ show_source_context : Config . source_preview ~ max_nested_level : Config . max_nesting
| true , true ->
L . user_error " Options --procedures and --source-files cannot be used together.@ \n " ) ) ;
(* to make sure the exitcode=0 case is logged, explicitly invoke exit *)
(* to make sure the exitcode=0 case is logged, explicitly invoke exit *)
L . exit 0
L . exit 0