Reporting cleanup 9: move NodeKey to Procdesc

Reviewed By: jeremydubreil

Differential Revision: D9351622

fbshipit-source-id: f8c5690f8
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent d9e12850b9
commit eb282797ab

@ -60,7 +60,7 @@ let compute_local_exception_line loc_trace =
List.fold_until ~init:(None, None) ~f:compute_local_exception_line ~finish:snd loc_trace
type node_id_key = {node_id: int; node_key: NodeKey.t}
type node_id_key = {node_id: int; node_key: Procdesc.NodeKey.t}
type err_key =
{ severity: Exceptions.severity

@ -34,7 +34,7 @@ val compute_local_exception_line : loc_trace -> int option
This extra information adds value to the report itself, and may avoid
digging into the trace to understand the cause of the report. *)
type node_id_key = {node_id: int; node_key: NodeKey.t}
type node_id_key = {node_id: int; node_key: Procdesc.NodeKey.t}
type err_key = private
{ severity: Exceptions.severity

@ -1,19 +0,0 @@
(*
* Copyright (c) 2018-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 t = Caml.Digest.t
let to_string = Caml.Digest.to_hex
let compute node ~simple_key ~succs ~preds =
let v = (simple_key node, List.rev_map ~f:simple_key succs, List.rev_map ~f:simple_key preds) in
Utils.better_hash v
let of_frontend_node_key = Utils.better_hash

@ -1,17 +0,0 @@
(*
* Copyright (c) 2018-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 t
val to_string : t -> string
val compute :
'node -> simple_key:('node -> 'simple_key) -> succs:'node list -> preds:'node list -> t
val of_frontend_node_key : string -> t

@ -11,6 +11,21 @@ module Hashtbl = Caml.Hashtbl
module L = Logging
module F = Format
module NodeKey = struct
type t = Caml.Digest.t
let to_string = Caml.Digest.to_hex
let compute node ~simple_key ~succs ~preds =
let v =
(simple_key node, List.rev_map ~f:simple_key succs, List.rev_map ~f:simple_key preds)
in
Utils.better_hash v
let of_frontend_node_key = Utils.better_hash
end
(* =============== START of module Node =============== *)
module Node = struct
type id = int [@@deriving compare]

@ -8,6 +8,14 @@
open! IStd
module NodeKey : sig
type t
val to_string : t -> string
val of_frontend_node_key : string -> t
end
(** node of the control flow graph *)
module Node : sig
(** type of nodes *)

@ -315,7 +315,7 @@ module JsonIssuePrinter = MakeJsonListPrinter (struct
; procedure_start_line
; file
; bug_trace= loc_trace_to_jsonbug_record err_data.loc_trace err_key.severity
; node_key= err_data.node_id_key.node_key |> NodeKey.to_string
; node_key= err_data.node_id_key.node_key |> Procdesc.NodeKey.to_string
; key= compute_key bug_type proc_name file
; hash= compute_hash severity bug_type proc_name file qualifier
; dotty= error_desc_to_dotty_string err_key.err_desc

@ -456,7 +456,7 @@ let log_frontend_issue method_decl_opt (node: Ctl_parser_types.ast_node)
| Stmt st ->
CAst_utils.generate_key_stmt st
in
let node_key = NodeKey.of_frontend_node_key key_str in
let node_key = Procdesc.NodeKey.of_frontend_node_key key_str in
Reporting.log_issue_from_errlog procname issue_desc.severity errlog exn ~loc:issue_desc.loc
~ltr:trace ~node_id_key:{Errlog.node_id= 0; node_key} ~linters_def_file
~doc_url:issue_desc.doc_url

Loading…
Cancel
Save