diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index f24d5af16..e9783fb54 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -542,6 +542,11 @@ OPTIONS machine-readable format (Conversely: --no-log-events) See also infer-run(1). + --log-skipped + Activates: Turn on the feature that logs skipped functions (one + per file) in a machine-readable format (Conversely: + --no-log-skipped) See also infer-run(1). + --loop-hoisting Activates: checker for loop-hoisting (Conversely: --no-loop-hoisting) See also infer-analyze(1). diff --git a/infer/man/man1/infer-run.txt b/infer/man/man1/infer-run.txt index a5abab832..aff1029c1 100644 --- a/infer/man/man1/infer-run.txt +++ b/infer/man/man1/infer-run.txt @@ -89,6 +89,11 @@ OPTIONS Activates: Turn on the feature that logs events in a machine-readable format (Conversely: --no-log-events) + --log-skipped + Activates: Turn on the feature that logs skipped functions (one + per file) in a machine-readable format (Conversely: + --no-log-skipped) + --pmd-xml Activates: Output issues in (PMD) XML format (Conversely: --no-pmd-xml) diff --git a/infer/man/man1/infer.txt b/infer/man/man1/infer.txt index b3f29f846..b6318c34e 100644 --- a/infer/man/man1/infer.txt +++ b/infer/man/man1/infer.txt @@ -542,6 +542,11 @@ OPTIONS machine-readable format (Conversely: --no-log-events) See also infer-run(1). + --log-skipped + Activates: Turn on the feature that logs skipped functions (one + per file) in a machine-readable format (Conversely: + --no-log-skipped) See also infer-run(1). + --loop-hoisting Activates: checker for loop-hoisting (Conversely: --no-loop-hoisting) See also infer-analyze(1). diff --git a/infer/src/backend/ondemand.ml b/infer/src/backend/ondemand.ml index 8bf32761c..d8014751e 100644 --- a/infer/src/backend/ondemand.ml +++ b/infer/src/backend/ondemand.ml @@ -291,7 +291,9 @@ let analyze_proc_name ?caller_pdesc callee_pname = (analyze_proc ?caller_pdesc callee_pdesc, true) | None -> (Summary.get callee_pname, true) - else (Summary.get callee_pname, true) + else ( + EventLogger.log_skipped_pname (F.asprintf "%a" Typ.Procname.pp callee_pname) ; + (Summary.get callee_pname, true) ) in if update_memcached then memcache_set callee_pname summary_option ; Typ.Procname.Hash.add cache callee_pname summary_option ; diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 3d05b2707..85d3abebf 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1493,6 +1493,12 @@ and log_file = ~default:"logs" "Specify the file to use for logging" +and log_skipped = + CLOpt.mk_bool ~long:"log-skipped" + ~in_help:InferCommand.[(Run, manual_generic)] + "Turn on the feature that logs skipped functions (one per file) in a machine-readable format" + + and perf_profiler_data_file = CLOpt.mk_path_opt ~long:"perf-profiler-data-file" ~in_help:InferCommand.[(Analyze, manual_generic)] @@ -2727,6 +2733,8 @@ and log_events = !log_events and log_file = !log_file +and log_skipped = !log_skipped + and perf_profiler_data_file = !perf_profiler_data_file and loop_hoisting = !loop_hoisting diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index ed2bd22ba..1973cae14 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -466,6 +466,8 @@ val log_events : bool val log_file : string +val log_skipped : bool + val perf_profiler_data_file : string option val loop_hoisting : bool diff --git a/infer/src/base/EventLogger.ml b/infer/src/base/EventLogger.ml index cf6694901..86c34a3d4 100644 --- a/infer/src/base/EventLogger.ml +++ b/infer/src/base/EventLogger.ml @@ -38,6 +38,14 @@ module IO = struct match !out_chan with Some oc -> Printf.fprintf oc fmt | _ -> Printf.ifprintf stdout fmt + let write_skipped_pname pname = + let fname = events_dir ^/ "skipped_functions" ^ log_file_extension in + let oc = Pervasives.open_out_gen [Open_append; Open_creat] 0o666 fname in + Out_channel.output_string oc pname ; + Out_channel.output_char oc '\n' ; + Out_channel.close oc + + let dump () = let dump_file_to_stdout fname = let ic = In_channel.create fname in @@ -333,6 +341,8 @@ module type S = sig val log : event -> unit + val log_skipped_pname : string -> unit + val dump : unit -> unit end @@ -382,6 +392,8 @@ module LoggerImpl : S = struct let log event = IO.write "%s\n" (create_row event) let dump = IO.dump + + let log_skipped_pname pname = if Config.log_skipped then IO.write_skipped_pname pname else () end module DummyLogger : S = struct @@ -392,6 +404,8 @@ module DummyLogger : S = struct let log _ = () let dump _ = () + + let log_skipped_pname _ = () end (* use real logger if logging is enabled, dummy logger otherwise *) diff --git a/infer/src/base/EventLogger.mli b/infer/src/base/EventLogger.mli index e8cca0bde..e209f7ce6 100644 --- a/infer/src/base/EventLogger.mli +++ b/infer/src/base/EventLogger.mli @@ -98,4 +98,6 @@ val prepare : unit -> unit val log : event -> unit +val log_skipped_pname : string -> unit + val dump : unit -> unit