[debug] add proc names of each spec to the dumped json

Summary: It's useful to know which procedure we're talking about :)

Reviewed By: skcho

Differential Revision: D24504592

fbshipit-source-id: abe2425b6
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 8f94d39ce1
commit b2109fa0b9

@ -26,6 +26,8 @@ let compare_pointerness _ _ = 0
(** signed and unsigned integer literals *)
type t = {signedness: signedness; i: Z.t; pointerness: pointerness} [@@deriving compare]
let yojson_of_t {i} = [%yojson_of: string] (Z.to_string i)
exception OversizedShift
let area {signedness; i} =

@ -10,7 +10,7 @@ open! IStd
module F = Format
(** signed and unsigned integer literals *)
type t
type t [@@deriving yojson_of]
exception OversizedShift

@ -11,7 +11,7 @@ module L = Logging
(** invariant: if [package = Some str] then [not (String.equal str "")]. [classname] appears first
so that the comparator fails earlier *)
type t = {classname: string; package: string option} [@@deriving compare, equal]
type t = {classname: string; package: string option} [@@deriving compare, equal, yojson_of]
module Map = Caml.Map.Make (struct
type nonrec t = t [@@deriving compare]

@ -7,7 +7,7 @@
open! IStd
type t [@@deriving compare, equal]
type t [@@deriving compare, equal, yojson_of]
module Map : Caml.Map.S with type key = t

@ -20,7 +20,7 @@ module Java = struct
| Non_Static
(** in Java, procedures called with invokevirtual, invokespecial, and invokeinterface *)
| Static (** in Java, procedures called with invokestatic *)
[@@deriving compare]
[@@deriving compare, yojson_of]
(** Type of java procedure names. *)
type t =
@ -29,7 +29,7 @@ module Java = struct
; class_name: Typ.Name.t
; return_type: Typ.t option (* option because constructors have no return type *)
; kind: kind }
[@@deriving compare]
[@@deriving compare, yojson_of]
let ensure_java_type t =
if not (Typ.is_java_type t) then
@ -177,7 +177,7 @@ module Parameter = struct
(** Type for parameters in clang procnames, [Some name] means the parameter is of type pointer to
struct, with [name] being the name of the struct, [None] means the parameter is of some other
type. *)
type clang_parameter = Typ.Name.t option [@@deriving compare, equal]
type clang_parameter = Typ.Name.t option [@@deriving compare, equal, yojson_of]
(** Type for parameters in procnames, for java and clang. *)
type t = JavaParameter of Typ.t | ClangParameter of clang_parameter [@@deriving compare, equal]
@ -218,7 +218,7 @@ module ObjC_Cpp = struct
| ObjCClassMethod
| ObjCInstanceMethod
| ObjCInternalMethod
[@@deriving compare]
[@@deriving compare, yojson_of]
type t =
{ class_name: Typ.Name.t
@ -226,7 +226,7 @@ module ObjC_Cpp = struct
; method_name: string
; parameters: Parameter.clang_parameter list
; template_args: Typ.template_spec_info }
[@@deriving compare]
[@@deriving compare, yojson_of]
let make class_name method_name kind template_args parameters =
{class_name; method_name; kind; template_args; parameters}
@ -319,7 +319,7 @@ module C = struct
; mangled: string option
; parameters: Parameter.clang_parameter list
; template_args: Typ.template_spec_info }
[@@deriving compare]
[@@deriving compare, yojson_of]
let c name mangled parameters template_args =
{name; mangled= Some mangled; parameters; template_args}
@ -359,9 +359,10 @@ end
module Block = struct
(** Type of Objective C block names. *)
type block_name = string [@@deriving compare]
type block_name = string [@@deriving compare, yojson_of]
type t = {name: block_name; parameters: Parameter.clang_parameter list} [@@deriving compare]
type t = {name: block_name; parameters: Parameter.clang_parameter list}
[@@deriving compare, yojson_of]
let make name parameters = {name; parameters}
@ -388,7 +389,7 @@ type t =
| Block of Block.t
| ObjC_Cpp of ObjC_Cpp.t
| WithBlockParameters of t * Block.t list
[@@deriving compare]
[@@deriving compare, yojson_of]
let equal = [%compare.equal: t]

@ -197,7 +197,7 @@ type t =
| Block of Block.t
| ObjC_Cpp of ObjC_Cpp.t
| WithBlockParameters of t * Block.t list
[@@deriving compare]
[@@deriving compare, yojson_of]
val block_of_procname : t -> Block.t

@ -11,7 +11,7 @@ module F = Format
exception ParseError of string
(* internally it uses reversed list to store qualified name, for example: ["get", "shared_ptr<int>", "std"]*)
type t = string list [@@deriving compare]
type t = string list [@@deriving compare, yojson_of]
let empty = []

@ -9,7 +9,7 @@ open! IStd
exception ParseError of string
type t [@@deriving compare]
type t [@@deriving compare, yojson_of]
val empty : t
(** empty qualified name *)

@ -54,7 +54,7 @@ type ikind =
| IULongLong (** [unsigned long long] (or [unsigned int64_] on Microsoft Visual C) *)
| I128 (** [__int128_t] *)
| IU128 (** [__uint128_t] *)
[@@deriving compare]
[@@deriving compare, yojson_of]
let equal_ikind = [%compare.equal: ikind]
@ -130,7 +130,7 @@ let ikind_is_char = function IChar | ISChar | IUChar -> true | _ -> false
(** Kinds of floating-point numbers *)
type fkind = FFloat (** [float] *) | FDouble (** [double] *) | FLongDouble (** [long double] *)
[@@deriving compare]
[@@deriving compare, yojson_of]
let equal_fkind = [%compare.equal: fkind]
@ -150,7 +150,7 @@ type ptr_kind =
| Pk_objc_weak (** Obj-C __weak pointer *)
| Pk_objc_unsafe_unretained (** Obj-C __unsafe_unretained pointer *)
| Pk_objc_autoreleasing (** Obj-C __autoreleasing pointer *)
[@@deriving compare]
[@@deriving compare, yojson_of]
let equal_ptr_kind = [%compare.equal: ptr_kind]
@ -168,10 +168,11 @@ let ptr_kind_string = function
module T = struct
type type_quals = {is_const: bool; is_restrict: bool; is_volatile: bool} [@@deriving compare]
type type_quals = {is_const: bool; is_restrict: bool; is_volatile: bool}
[@@deriving compare, yojson_of]
(** types for sil (structured) expressions *)
type t = {desc: desc; quals: type_quals} [@@deriving compare]
type t = {desc: desc; quals: type_quals}
and desc =
| Tint of ikind (** integer type *)
@ -183,7 +184,6 @@ module T = struct
| TVar of string (** type variable (ie. C++ template variables) *)
| Tarray of {elt: t; length: IntLit.t option; stride: IntLit.t option}
(** array type with statically fixed length and stride *)
[@@deriving compare]
and name =
| CStruct of QualifiedCppName.t
@ -192,15 +192,13 @@ module T = struct
| JavaClass of JavaClassName.t
| ObjcClass of QualifiedCppName.t
| ObjcProtocol of QualifiedCppName.t
[@@deriving compare]
and template_arg = TType of t | TInt of Int64.t | TNull | TNullPtr | TOpaque
[@@deriving compare]
and template_arg = TType of t | TInt of int64 | TNull | TNullPtr | TOpaque
and template_spec_info =
| NoTemplate
| Template of {mangled: string option; args: template_arg list}
[@@deriving compare]
[@@deriving compare, yojson_of]
let yojson_of_name = [%yojson_of: _]

@ -86,7 +86,7 @@ val is_restrict : type_quals -> bool
val is_volatile : type_quals -> bool
(** types for sil (structured) expressions *)
type t = {desc: desc; quals: type_quals} [@@deriving compare]
type t = {desc: desc; quals: type_quals} [@@deriving compare, yojson_of]
and desc =
| Tint of ikind (** integer type *)
@ -98,7 +98,6 @@ and desc =
| TVar of string (** type variable (ie. C++ template variables) *)
| Tarray of {elt: t; length: IntLit.t option; stride: IntLit.t option}
(** array type with statically fixed length and stride *)
[@@deriving compare]
and name =
| CStruct of QualifiedCppName.t
@ -110,9 +109,8 @@ and name =
| JavaClass of JavaClassName.t
| ObjcClass of QualifiedCppName.t
| ObjcProtocol of QualifiedCppName.t
[@@deriving compare]
and template_arg = TType of t | TInt of Int64.t | TNull | TNullPtr | TOpaque [@@deriving compare]
and template_arg = TType of t | TInt of Int64.t | TNull | TNullPtr | TOpaque
and template_spec_info =
| NoTemplate
@ -122,7 +120,6 @@ and template_spec_info =
mangling is not guaranteed to be unique to a single type. All the information in the
template arguments is also needed for uniqueness. *)
; args: template_arg list }
[@@deriving compare]
val pp_template_spec_info : Pp.env -> F.formatter -> template_spec_info -> unit [@@warning "-32"]

@ -68,7 +68,9 @@ include struct
[@@deriving fields]
end
let yojson_of_t {payloads} = [%yojson_of: Payloads.t] payloads
let yojson_of_t {proc_desc; payloads} =
[%yojson_of: Procname.t * Payloads.t] (Procdesc.get_proc_name proc_desc, payloads)
type full_summary = t

Loading…
Cancel
Save