Summary: Move proc_attributes to a separate module. Field err_log, in common between proc desc and summary, can now be moved to ProcAttributes without creating cycles of dependencies.master
parent
a9b6f33940
commit
ea7c13ff6c
@ -0,0 +1,82 @@
|
|||||||
|
(*
|
||||||
|
* Copyright (c) 2015 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*)
|
||||||
|
|
||||||
|
(** Attributes of a procedure. *)
|
||||||
|
|
||||||
|
module L = Logging
|
||||||
|
module F = Format
|
||||||
|
open Utils
|
||||||
|
|
||||||
|
type t =
|
||||||
|
{
|
||||||
|
access : Sil.access; (** visibility access *)
|
||||||
|
captured : (Mangled.t * Sil.typ) list; (** name and type of variables captured in blocks *)
|
||||||
|
err_log: Errlog.t; (** Error log for the procedure *)
|
||||||
|
exceptions : string list; (** exceptions thrown by the procedure *)
|
||||||
|
formals : (string * Sil.typ) list; (** name and type of formal parameters *)
|
||||||
|
func_attributes : Sil.func_attribute list;
|
||||||
|
is_abstract : bool; (** the procedure is abstract *)
|
||||||
|
mutable is_bridge_method : bool; (** the procedure is a bridge method *)
|
||||||
|
is_defined : bool; (** true if the procedure is defined, and not just declared *)
|
||||||
|
is_generated : bool; (** the procedure has been generated *)
|
||||||
|
is_objc_instance_method : bool; (** the procedure is an objective-C instance method *)
|
||||||
|
mutable is_synthetic_method : bool; (** the procedure is a synthetic method *)
|
||||||
|
language : Config.language; (** language of the procedure *)
|
||||||
|
loc : Location.t; (** location of this procedure in the source code *)
|
||||||
|
mutable locals : (Mangled.t * Sil.typ) list; (** name and type of local variables *)
|
||||||
|
method_annotation : Sil.method_annotation; (** annotations for java methods *)
|
||||||
|
proc_flags : proc_flags; (** flags of the procedure *)
|
||||||
|
proc_name : Procname.t; (** name of the procedure *)
|
||||||
|
ret_type : Sil.typ; (** return type *)
|
||||||
|
}
|
||||||
|
|
||||||
|
let copy pa =
|
||||||
|
{
|
||||||
|
access = pa.access;
|
||||||
|
captured = pa.captured;
|
||||||
|
err_log = pa.err_log;
|
||||||
|
exceptions = pa.exceptions;
|
||||||
|
formals = pa.formals;
|
||||||
|
func_attributes = pa.func_attributes;
|
||||||
|
is_abstract = pa.is_abstract;
|
||||||
|
is_bridge_method = pa.is_bridge_method;
|
||||||
|
is_defined = pa.is_defined;
|
||||||
|
is_generated = pa.is_generated;
|
||||||
|
is_objc_instance_method = pa.is_objc_instance_method;
|
||||||
|
is_synthetic_method = pa.is_synthetic_method;
|
||||||
|
language = pa.language;
|
||||||
|
loc = pa.loc;
|
||||||
|
locals = pa.locals;
|
||||||
|
method_annotation = pa.method_annotation;
|
||||||
|
proc_flags = pa.proc_flags;
|
||||||
|
proc_name = pa.proc_name;
|
||||||
|
ret_type = pa.ret_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
let default proc_name language = {
|
||||||
|
access = Sil.Default;
|
||||||
|
formals = [];
|
||||||
|
captured = [];
|
||||||
|
err_log = Errlog.empty ();
|
||||||
|
exceptions = [];
|
||||||
|
func_attributes = [];
|
||||||
|
is_abstract = false;
|
||||||
|
is_defined = false;
|
||||||
|
is_bridge_method = false;
|
||||||
|
is_generated = false;
|
||||||
|
is_objc_instance_method = false;
|
||||||
|
is_synthetic_method = false;
|
||||||
|
language;
|
||||||
|
loc = Location.dummy;
|
||||||
|
locals = [];
|
||||||
|
method_annotation = Sil.method_annotation_empty;
|
||||||
|
proc_flags = proc_flags_empty ();
|
||||||
|
proc_name;
|
||||||
|
ret_type = Sil.Tvoid;
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
(*
|
||||||
|
* Copyright (c) 2015 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*)
|
||||||
|
|
||||||
|
(** Attributes of a procedure. *)
|
||||||
|
|
||||||
|
open Utils
|
||||||
|
|
||||||
|
type t =
|
||||||
|
{
|
||||||
|
access : Sil.access; (** visibility access *)
|
||||||
|
captured : (Mangled.t * Sil.typ) list; (** name and type of variables captured in blocks *)
|
||||||
|
err_log: Errlog.t; (** Error log for the procedure *)
|
||||||
|
exceptions : string list; (** exceptions thrown by the procedure *)
|
||||||
|
formals : (string * Sil.typ) list; (** name and type of formal parameters *)
|
||||||
|
func_attributes : Sil.func_attribute list;
|
||||||
|
is_abstract : bool; (** the procedure is abstract *)
|
||||||
|
mutable is_bridge_method : bool; (** the procedure is a bridge method *)
|
||||||
|
is_defined : bool; (** true if the procedure is defined, and not just declared *)
|
||||||
|
is_generated : bool; (** the procedure has been generated *)
|
||||||
|
is_objc_instance_method : bool; (** the procedure is an objective-C instance method *)
|
||||||
|
mutable is_synthetic_method : bool; (** the procedure is a synthetic method *)
|
||||||
|
language : Config.language; (** language of the procedure *)
|
||||||
|
loc : Location.t; (** location of this procedure in the source code *)
|
||||||
|
mutable locals : (Mangled.t * Sil.typ) list; (** name and type of local variables *)
|
||||||
|
method_annotation : Sil.method_annotation; (** annotations for java methods *)
|
||||||
|
proc_flags : proc_flags; (** flags of the procedure *)
|
||||||
|
proc_name : Procname.t; (** name of the procedure *)
|
||||||
|
ret_type : Sil.typ; (** return type *)
|
||||||
|
}
|
||||||
|
|
||||||
|
(** Create a copy of a proc_attributes *)
|
||||||
|
val copy : t -> t
|
||||||
|
|
||||||
|
(** Create a proc_attributes with default values. *)
|
||||||
|
val default : Procname.t -> Config.language -> t
|
Loading…
Reference in new issue