Module IR.Procname

module F = Stdlib.Format

Module for Procedure Names.

type detail_level =
  1. | FullNameOnly
  2. | NameOnly
  3. | Non_verbose
  4. | Simple
  5. | Verbose

Level of verbosity of some to_string functions.

module CSharp : sig ... end

Type of csharp procedure names.

module Java : sig ... end

Type of java procedure names.

module Parameter : sig ... end
module ObjC_Cpp : sig ... end
module C : sig ... end
module Block : sig ... end

Type of Objective C block names.

module Erlang : sig ... end
module Hack : sig ... end
module Python : sig ... end
type t =
  1. | Block of Block.t
  2. | C of C.t
  3. | CSharp of CSharp.t
  4. | Erlang of Erlang.t
  5. | Hack of Hack.t
  6. | Java of Java.t
  7. | ObjC_Cpp of ObjC_Cpp.t
  8. | Python of Python.t

Type of procedure names.

include Ppx_compare_lib.Comparable.S with type t := t
val yojson_of_t : t -> Ppx_yojson_conv_lib.Yojson.Safe.t
include Sexplib0.Sexpable.S with type t := t
val t_of_sexp : Sexplib0__.Sexp.t -> t
val sexp_of_t : t -> Sexplib0__.Sexp.t
include Ppx_hash_lib.Hashable.S with type t := t
val hash_fold_t : t Base__Ppx_hash_lib.hash_fold
val hash : t -> Base__Ppx_hash_lib.Std.Hash.hash_value
val hash_normalize : t -> t
val hash_normalize_opt : t option -> t option
val hash_normalize_list : t list -> t list
val compare_name : t -> t -> int

Similar to compare, but compares only names, except parameter types and template arguments.

val get_class_type_name : t -> Typ.Name.t option
val get_class_name : t -> string option
val python_classify : t -> Python.kind option

Classify a Python name into a Python.kind

val mk_python_init : t -> t

Turns a Python **toplevel** name into a valid initializer. E.g. it is used to turn a statement like x = C(42) into C.__init__(x, 42)

val get_parameters : t -> Parameter.t list
val replace_parameters : Parameter.t list -> t -> t
val parameter_of_name : t -> Typ.Name.t -> Parameter.t
val is_cpp_assignment_operator : t -> bool
val is_destructor : t -> bool
val is_java_static_method : t -> bool
val is_java_instance_method : t -> bool
val is_java_access_method : t -> bool
val is_java_class_initializer : t -> bool
val is_java_anonymous_inner_class_method : t -> bool
val is_java_autogen_method : t -> bool
val is_objc_method : t -> bool

Includes specialized objective-c methods

val is_objc_instance_method : t -> bool

Includes specialized objective-c instance methods

val is_objc_class_method : t -> bool

Includes specialized objective-c class methods

val is_objc_nsobject_class : t -> bool
val get_objc_class_name : t -> string option
val is_std_move : t -> bool
val is_shared_ptr_observer : t -> bool

Check if it is C++ shared pointer observer, e.g. std::shared_ptr::operator*

module Comparable : IStdlib.IStd.Comparable.S with type t := t
include module type of struct include Comparable end
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t
val clamp : t -> min:t -> max:t -> t Base__.Or_error.t
type comparator_witness = Comparable.comparator_witness
val comparator : (t, comparator_witness) Base__Comparator.comparator
val validate_lbound : min:t Core__.Maybe_bound.t -> t Validate.check
val validate_ubound : max:t Core__.Maybe_bound.t -> t Validate.check
val validate_bound : min:t Core__.Maybe_bound.t -> max:t Core__.Maybe_bound.t -> t Validate.check
module Replace_polymorphic_compare = Comparable.Replace_polymorphic_compare
module Hash : IStdlib.IStd.Caml.Hashtbl.S with type key = t

Hash tables with proc names as keys.

module LRUHash : IStdlib.LRUHashtbl.S with type key = t
module HashQueue : IStdlib.IStd.Hash_queue.S with type key = t
module HashSet : IStdlib.HashSet.S with type elt = t
module Map : IStdlib.PrettyPrintable.PPMap with type key = t

Maps from proc names.

module Set : IStdlib.PrettyPrintable.PPSet with type elt = t

Sets of proc names.

module SQLite : IBase.SqliteUtils.Data with type t = t
module SQLiteList : IBase.SqliteUtils.Data with type t = t list
module UnitCache : sig ... end

One-sized cache for one procedure at a time. Returns getter and setter.

val make_java : class_name:Typ.Name.t -> return_type:Typ.t option -> method_name:string -> parameters:Typ.t list -> kind:Java.kind -> t

Create a Java procedure name.

val make_csharp : class_name:Typ.Name.t -> return_type:Typ.t option -> method_name:string -> parameters:Typ.t list -> kind:CSharp.kind -> t

Create a CSharp procedure name.

val make_erlang : module_name:string -> function_name:string -> arity:int -> t

Create an Erlang procedure name.

val make_hack : class_name:HackClassName.t option -> function_name:string -> arity:int option -> t

Create a Hack procedure name.

val make_objc_dealloc : Typ.Name.t -> t

Create a Objective-C dealloc name. This is a destructor for an Objective-C class. This procname is given by the class name, since it is always an instance method with the name "dealloc"

val make_objc_copy : Typ.Name.t -> t

Create a Objective-C copy name.

val make_objc_copyWithZone : is_mutable:bool -> Typ.Name.t -> t

Create an Objective-C method for copyWithZone: or mutableCopyWithZone: according to is_mutable.

val make_python : class_name:PythonClassName.t option -> function_name:string -> arity:int option -> t

Create a Python procedure name.

val empty_block : t

Empty block name.

val get_language : t -> IBase.Language.t

Return the language of the procedure.

val get_method : t -> string

Return the method/function of a procname.

val is_objc_block : t -> bool

Return whether the procname is a block procname.

val is_cpp_lambda : t -> bool

Return whether the procname is a cpp lambda procname.

val is_cpp_method : t -> bool

Return whether the procname is a cpp method.

val is_objc_dealloc : t -> bool

Return whether the dealloc method of an Objective-C class.

val is_objc_init : t -> bool

Return whether the init method of an Objective-C class.

val is_c_method : t -> bool

Return true this is an Objective-C/C++ method name.

val is_clang : t -> bool

Return true this is an Objective-C/C++ method name or a C function.

val is_constructor : t -> bool

Check if this is a constructor.

val is_csharp : t -> bool

Check if this is a CSharp procedure name.

val is_hack : t -> bool

Check if this is a Hack procedure name.

val is_java : t -> bool

Check if this is a Java procedure name.

val is_python : t -> bool

Check if this is a Python procedure name.

val objc_cpp_replace_method_name : t -> string -> t
val is_infer_undefined : t -> bool

Check if this is a special Infer undefined procedure.

val is_static : t -> bool option

Check if a procedure is a static class method or not. If the procedure is not a class method or is unknown to be static, it returns None. For now, this checking does not work on C++ methods.

val get_global_name_of_initializer : t -> string option

Return the name of the global for which this procedure is the initializer if this is an initializer, None otherwise.

val pp_without_templates : Stdlib.Format.formatter -> t -> unit

Pretty print a c++ proc name for the user to see.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty print a proc name for the user to see.

val pp_verbose : Stdlib.Format.formatter -> t -> unit

Pretty print a proc name for the user to see with verbosity parameter.

val to_string : ?verbosity:detail_level -> t -> string

Convert a proc name into a string for the user to see.

val to_string_verbose : t -> string

Convert a proc name into a string for the user to see with verbosity parameter.

val describe : Stdlib.Format.formatter -> t -> unit

to use in user messages

val replace_class : t -> ?arity_incr:int -> Typ.Name.t -> t

Replace the class name component of a procedure name. In case of Java, replace package and class name.

val is_method_in_objc_protocol : t -> bool
val pp_simplified_string : ?withclass:bool -> F.formatter -> t -> unit

Pretty print a proc name as an easy string for the user to see in an IDE.

val to_simplified_string : ?withclass:bool -> t -> string

Convert a proc name into an easy string for the user to see in an IDE.

val from_string_c_fun : string -> t

Convert a string to a c function name.

val replace_java_inner_class_prefix_regex : string -> string

Replace "$[0-9]+" index into "$_" in Java proc name.

val hashable_name : t -> string

Convert the procedure name in a format suitable for computing the bug hash.

val pp_unique_id : F.formatter -> t -> unit

Print a proc name as a unique identifier.

val to_unique_id : t -> string

Convert a proc name into a unique identifier.

val to_short_unique_name : t -> string

Convert a proc name into a unique identfier guaranteed to be short (less than 50 characters)

val to_filename : t -> string

Convert a proc name to a filename.

val get_qualifiers : t -> QualifiedCppName.t

get qualifiers of C/objc/C++ method/function

val decr_hack_arity : t -> t option

return a Hack procname with decremented arity. Return None if input has no arity or 0 arity

val get_hack_arity : t -> int option

get the arity of a Hack procname

val get_hack_static_constinit : is_trait:bool -> HackClassName.t -> t

get the constinit procname in Hack

val pp_name_only : F.formatter -> t -> unit

Print name of procedure with at most one-level path. For example,

  • In C++: "<ClassName>::<ProcName>"
  • In Java, ObjC, C#: "<ClassName>.<ProcName>"
  • In C: "<ProcName>"
  • In Erlang: "<ModuleName>:<ProcName>"
val pp_fullname_only : F.formatter -> t -> unit

Like pp_name_only, but include package name for Java.

val is_c : t -> bool
val is_lambda_name : string -> bool
val is_lambda : t -> bool
val is_lambda_or_block : t -> bool
val patterns_match : IStdlib.IStd.Str.regexp list -> t -> bool

Test whether a proc name matches to one of the regular expressions.

val is_erlang_unsupported : t -> bool
val is_erlang : t -> bool
val erlang_call_unqualified : arity:int -> t

A special infer-erlang procname that represents a syntactic erlang (unqualified) function call. arity is the arity of the erlang function. First parameter of this procedure is expecteed to be the erlang function name, and the remaining parameters are the erlang parameters (given one-by-one and not as an erlang list).

val erlang_call_qualified : arity:int -> t

Same as erlang_call_unqualified but is expected to have an erlang module name as the first parameter, and the function name as second. arity is (still) the erlang arity of the function.

val is_erlang_call_unqualified : t -> bool
val is_erlang_call_qualified : t -> bool
val is_hack_builtins : t -> bool
val is_hack_constinit : t -> bool
val has_hack_classname : t -> bool
val is_hack_async_name : t -> bool
val is_hack_construct : t -> bool
val is_hack_xinit : t -> bool