Program variables.
include sig ... end
val compare_translation_unit : translation_unit ‑> translation_unit ‑> int
type t
Type for program variables. There are 4 kinds of variables:
1) local variables, used for local variables and formal parameters
2) callee program variables, used to handle recursion (x | callee
is distinguished from x
)
3) global variables
4) seed variables, used to store the initial value of formal parameters
val get_declaring_function : t ‑> InferIR.Typ.Procname.t option
if not a global, return function declaring var
val get_ret_pvar : InferIR.Typ.Procname.t ‑> t
get_ret_pvar proc_name
retuns the return pvar associated with the procedure name
val get_simplified_name : t ‑> string
Get a simplified version of the name component of a program variable.
val is_frontend_tmp : t ‑> bool
return true if pvar
is a temporary variable generated by the frontend
val is_ssa_frontend_tmp : t ‑> bool
return true if pvar
is a temporary variable generated by the frontend and is only assigned
once on a non-looping control-flow path
val is_cpp_temporary : t ‑> bool
return true if this pvar represents a C++ temporary object (see http://en.cppreference.com/w/cpp/language/lifetime)
val mk : InferIR.Mangled.t ‑> InferIR.Typ.Procname.t ‑> t
mk name proc_name suffix
creates a program var with the given function name and suffix
val mk_abduced_ref_param : InferIR.Typ.Procname.t ‑> int ‑> InferBase.Location.t ‑> t
create an abduced variable for a parameter passed by reference
val mk_abduced_ret : InferIR.Typ.Procname.t ‑> InferBase.Location.t ‑> t
create an abduced return variable for a call to proc_name
at loc
val mk_callee : InferIR.Mangled.t ‑> InferIR.Typ.Procname.t ‑> t
mk_callee name proc_name
creates a program var
for a callee function with the given function name
val mk_global : ?is_constexpr:bool ‑> ?is_pod:bool ‑> ?is_static_local:bool ‑> ?is_static_global:bool ‑> ?translation_unit:InferBase.SourceFile.t ‑> InferIR.Mangled.t ‑> t
create a global variable with the given name
val mk_tmp : string ‑> InferIR.Typ.Procname.t ‑> t
create a fresh temporary variable local to procedure pname
. for use in the frontends only!
val pp_translation_unit : F.formatter ‑> translation_unit ‑> unit
val to_callee : InferIR.Typ.Procname.t ‑> t ‑> t
Turn an ordinary program variable into a callee program variable
val get_translation_unit : t ‑> translation_unit
Get the translation unit corresponding to a global. Raises Invalid_arg if not a global.
val is_compile_constant : t ‑> bool
Is the variable's value a compile-time constant? Always (potentially incorrectly) returns
false
for non-globals.
val is_pod : t ‑> bool
Is the variable's type a "Plain Old Data" type (C++)? Always (potentially incorrectly) returns
true
for non-globals.
val get_initializer_pname : t ‑> InferIR.Typ.Procname.t option
Get the procname of the initializer function for the given global variable
val get_name_of_local_with_procname : t ‑> InferIR.Mangled.t
get_name_of_local_with_procname var
Return a name that is composed of the name of
var and the name of the procname in case of locals