Store the issue file only if there are issues

Reviewed By: jberdine

Differential Revision: D3819698

fbshipit-source-id: 63b9e3d
master
Dulma Churchill 8 years ago committed by Facebook Github Bot 4
parent 6c4762b9de
commit f6636c6d41

@ -196,7 +196,7 @@ let log_issue _ekind err_log loc node_id_key session ltr pre_opt exn =
| _ -> added in
let print_now () =
let ex_name, desc, ml_loc_opt, _, _, _, _ = Exceptions.recognize_exception exn in
L.err "%a@?" (Exceptions.pp_err node_id_key loc ekind ex_name desc ml_loc_opt) ();
L.err "@\n%a@\n@?" (Exceptions.pp_err node_id_key loc ekind ex_name desc ml_loc_opt) ();
if _ekind <> Exceptions.Kerror then begin
let warn_str =
let pp fmt () =

@ -13,6 +13,9 @@ open! Utils
let errLogMap = ref Procname.Map.empty
let exists_issues () =
not (Procname.Map.is_empty !errLogMap)
let get_err_log procname =
try Procname.Map.find procname !errLogMap
with Not_found ->

@ -11,6 +11,8 @@
val errLogMap : Errlog.t Procname.Map.t ref
val exists_issues : unit -> bool
(** Save issues to a file *)
val get_err_log : Procname.t -> Errlog.t

@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*)
open! Utils
open CFrontend_utils
let rec do_frontend_checks_stmt (context:CLintersContext.context) cfg cg stmt =
@ -66,7 +67,7 @@ let context_with_ck_set context decl_list =
let store_issues source_file =
let abbrev_source_file = DB.source_file_encoding source_file in
let lint_issues_dir = Filename.concat Config.results_dir Config.lint_issues_dir_name in
let lint_issues_dir = Config.results_dir // Config.lint_issues_dir_name in
DB.create_dir lint_issues_dir;
let lint_issues_file =
DB.filename_from_string (Filename.concat lint_issues_dir (abbrev_source_file ^ ".issue")) in
@ -82,5 +83,6 @@ let do_frontend_checks cfg cg source_file ast =
let allowed_decls = IList.filter is_decl_allowed decl_list in
IList.iter (do_frontend_checks_decl context cfg cg) allowed_decls;
(* TODO (t12740727): Remove condition once the transition to linters mode is finished *)
if Config.analyzer = Some Config.Linters then store_issues source_file
if Config.analyzer = Some Config.Linters && (LintIssues.exists_issues ()) then
store_issues source_file
| _ -> assert false (* NOTE: Assumes that an AST alsways starts with a TranslationUnitDecl *)

Loading…
Cancel
Save