Refactored Issue for QuandaryBO integration

Reviewed By: mbouaziz

Differential Revision: D9688835

fbshipit-source-id: e0c4dbe1e
master
Julian Sutherland 6 years ago committed by Facebook Github Bot
parent 0cb31a8057
commit 7baac52788

@ -679,37 +679,6 @@ module PreconditionStats = struct
L.result "Procedures with data constraints: %d@." !nr_dataconstraints
end
(** Wrapper of an issue that compares all parts except the procname *)
module Issue = struct
type err_data_ = Errlog.err_data
(* no derived compare for err_data; just compare the locations *)
let compare_err_data_ (err_data1 : Errlog.err_data) (err_data2 : Errlog.err_data) =
Location.compare err_data1.loc err_data2.loc
type proc_name_ = Typ.Procname.t
(* ignore proc name *)
let compare_proc_name_ _ _ = 0
type t =
{proc_name: proc_name_; proc_location: Location.t; err_key: Errlog.err_key; err_data: err_data_}
[@@deriving compare]
(* If two issues are identical except for their procnames, they are probably duplicate reports on
two different instantiations of the same template. We don't want to spam users by reporting
identical warning on the same line. Accomplish this by sorting without regard to procname, then
de-duplicating. *)
let sort_filter_issues issues =
let issues' = List.dedup_and_sort ~compare issues in
( if Config.developer_mode then
let num_pruned_issues = List.length issues - List.length issues' in
if num_pruned_issues > 0 then
L.user_warning "Note: pruned %d duplicate issues@\n" num_pruned_issues ) ;
issues'
end
let error_filter filters proc_name file error_name =
(Config.write_html || not (IssueType.(equal skip_function) error_name))
&& filters.Inferconfig.path_filter file

@ -0,0 +1,38 @@
(*
* Copyright (c) 2016-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
module L = Logging
(** Wrapper of an issue that compares all parts except the procname *)
type err_data_ = Errlog.err_data
(* no derived compare for err_data; just compare the locations *)
let compare_err_data_ (err_data1 : Errlog.err_data) (err_data2 : Errlog.err_data) =
Location.compare err_data1.loc err_data2.loc
type proc_name_ = Typ.Procname.t
(* ignore proc name *)
let compare_proc_name_ _ _ = 0
type t =
{proc_name: proc_name_; proc_location: Location.t; err_key: Errlog.err_key; err_data: err_data_}
[@@deriving compare]
(* If two issues are identical except for their procnames, they are probably duplicate reports on
two different instantiations of the same template. We don't want to spam users by reporting
identical warning on the same line. Accomplish this by sorting without regard to procname, then
de-duplicating. *)
let sort_filter_issues issues =
let issues' = List.dedup_and_sort ~compare issues in
( if Config.developer_mode then
let num_pruned_issues = List.length issues - List.length issues' in
if num_pruned_issues > 0 then
L.user_warning "Note: pruned %d duplicate issues@\n" num_pruned_issues ) ;
issues'

@ -0,0 +1,17 @@
(*
* Copyright (c) 2016-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
type err_data_ = Errlog.err_data
type proc_name_ = Typ.Procname.t
type t =
{proc_name: proc_name_; proc_location: Location.t; err_key: Errlog.err_key; err_data: err_data_}
val sort_filter_issues : t list -> t list
Loading…
Cancel
Save