<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>IR__Pvar (infer.IR__Pvar)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../index.html">infer</a> » IR__Pvar</nav><h1>Module <code>IR__Pvar</code></h1><p>Program variables.</p></header><div class="spec module" id="module-F"><a href="#module-F" class="anchor"></a><code><span class="keyword">module</span> F = Stdlib.Format</code></div><dl><dt class="spec type" id="type-translation_unit"><a href="#type-translation_unit" class="anchor"></a><code><span class="keyword">type</span> translation_unit</code><code> = <span><a href="../IBase/SourceFile/index.html#type-t">IBase.SourceFile.t</a> option</span></code></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_translation_unit"><a href="#val-compare_translation_unit" class="anchor"></a><code><span class="keyword">val</span> compare_translation_unit : <a href="index.html#type-translation_unit">translation_unit</a> <span>-></span> <a href="index.html#type-translation_unit">translation_unit</a> <span>-></span> int</code></dt></dl></div></div></div><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt><dd><p>Type for program variables. There are 4 kinds of variables:</p><ol><li>local variables, used for local variables and formal parameters</li><li>callee program variables, used to handle recursion (<code>x | callee</code> is distinguished from <code>x</code>)</li><li>global variables</li><li>seed variables, used to store the initial value of formal parameters</li></ol></dd></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span class="keyword">val</span> compare : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> int</code></dt></dl></div></div></div><dl><dt class="spec value" id="val-compare_modulo_this"><a href="#val-compare_modulo_this" class="anchor"></a><code><span class="keyword">val</span> compare_modulo_this : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> int</code></dt><dd><p>Comparison considering all pvars named 'this'/'self' to be equal</p></dd></dl><dl><dt class="spec value" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span class="keyword">val</span> equal : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Equality for pvar's</p></dd></dl><dl><dt class="spec value" id="val-get_declaring_function"><a href="#val-get_declaring_function" class="anchor"></a><code><span class="keyword">val</span> get_declaring_function : <a href="index.html#type-t">t</a> <span>-></span> <span><a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> option</span></code></dt><dd><p>if not a global, return function declaring var</p></dd></dl><dl><dt class="spec value" id="val-d"><a href="#val-d" class="anchor"></a><code><span class="keyword">val</span> d : <a href="index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><p>Dump a program variable.</p></dd></dl><dl><dt class="spec value" id="val-get_name"><a href="#val-get_name" class="anchor"></a><code><span class="keyword">val</span> get_name : <a href="index.html#type-t">t</a> <span>-></span> <a href="../IR/Mangled/index.html#type-t">IR.Mangled.t</a></code></dt><dd><p>Get the name component of a program variable.</p></dd></dl><dl><dt class="spec value" id="val-get_ret_pvar"><a href="#val-get_ret_pvar" class="anchor"></a><code><span class="keyword">val</span> get_ret_pvar : <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>get_ret_pvar proc_name</code> retuns the return pvar associated with the procedure name</p></dd></dl><dl><dt class="spec value" id="val-get_ret_param_pvar"><a href="#val-get_ret_param_pvar" class="anchor"></a><code><span class="keyword">val</span> get_ret_param_pvar : <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>get_ret_param_pvar proc_name</code> retuns the return_param pvar associated with the procedure name</p></dd></dl><dl><dt class="spec value" id="val-get_simplified_name"><a href="#val-get_simplified_name" class="anchor"></a><code><span class="keyword">val</span> get_simplified_name : <a href="index.html#type-t">t</a> <span>-></span> string</code></dt><dd><p>Get a simplified version of the name component of a program variable.</p></dd></dl><dl><dt class="spec value" id="val-is_abduced"><a href="#val-is_abduced" class="anchor"></a><code><span class="keyword">val</span> is_abduced : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is an abduced return var or param passed by ref</p></dd></dl><dl><dt class="spec value" id="val-is_callee"><a href="#val-is_callee" class="anchor"></a><code><span class="keyword">val</span> is_callee : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is a callee var</p></dd></dl><dl><dt class="spec value" id="val-is_global"><a href="#val-is_global" class="anchor"></a><code><span class="keyword">val</span> is_global : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is a global var or a static local var</p></dd></dl><dl><dt class="spec value" id="val-is_static_local"><a href="#val-is_static_local" class="anchor"></a><code><span class="keyword">val</span> is_static_local : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is a static variable declared inside a function</p></dd></dl><dl><dt class="spec value" id="val-is_constant_array"><a href="#val-is_constant_array" class="anchor"></a><code><span class="keyword">val</span> is_constant_array : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar has a constant array type</p></dd></dl><dl><dt class="spec value" id="val-is_local"><a href="#val-is_local" class="anchor"></a><code><span class="keyword">val</span> is_local : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is a (non-static) local var</p></dd></dl><dl><dt class="spec value" id="val-is_seed"><a href="#val-is_seed" class="anchor"></a><code><span class="keyword">val</span> is_seed : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is a seed var</p></dd></dl><dl><dt class="spec value" id="val-is_return"><a href="#val-is_return" class="anchor"></a><code><span class="keyword">val</span> is_return : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if the pvar is a return var</p></dd></dl><dl><dt class="spec value" id="val-is_this"><a href="#val-is_this" class="anchor"></a><code><span class="keyword">val</span> is_this : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if a pvar is the special "this" var</p></dd></dl><dl><dt class="spec value" id="val-is_self"><a href="#val-is_self" class="anchor"></a><code><span class="keyword">val</span> is_self : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if a pvar is the special "self" var</p></dd></dl><dl><dt class="spec value" id="val-is_frontend_tmp"><a href="#val-is_frontend_tmp" class="anchor"></a><code><span class="keyword">val</span> is_frontend_tmp : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>return true if <code>pvar</code> is a temporary variable generated by the frontend</p></dd></dl><dl><dt class="spec value" id="val-is_clang_tmp"><a href="#val-is_clang_tmp" class="anchor"></a><code><span class="keyword">val</span> is_clang_tmp : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>return true if <code>pvar</code> is a temporary variable generated by clang</p></dd></dl><dl><dt class="spec value" id="val-is_ssa_frontend_tmp"><a href="#val-is_ssa_frontend_tmp" class="anchor"></a><code><span class="keyword">val</span> is_ssa_frontend_tmp : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>return true if <code>pvar</code> is a temporary variable generated by the frontend and is only assigned once on a non-looping control-flow path</p></dd></dl><dl><dt class="spec value" id="val-is_cpp_temporary"><a href="#val-is_cpp_temporary" class="anchor"></a><code><span class="keyword">val</span> is_cpp_temporary : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>return true if this pvar represents a C++ temporary object (see http://en.cppreference.com/w/cpp/language/lifetime)</p></dd></dl><dl><dt class="spec value" id="val-is_objc_static_local_of_proc_name"><a href="#val-is_objc_static_local_of_proc_name" class="anchor"></a><code><span class="keyword">val</span> is_objc_static_local_of_proc_name : string <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if a pvar is a local static in objc</p></dd></dl><dl><dt class="spec value" id="val-is_block_pvar"><a href="#val-is_block_pvar" class="anchor"></a><code><span class="keyword">val</span> is_block_pvar : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Check if a pvar is a local pointing to a block in objc</p></dd></dl><dl><dt class="spec value" id="val-mk"><a href="#val-mk" class="anchor"></a><code><span class="keyword">val</span> mk : <a href="../IR/Mangled/index.html#type-t">IR.Mangled.t</a> <span>-></span> <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>mk name proc_name</code> creates a program var with the given function name</p></dd></dl><dl><dt class="spec value" id="val-mk_abduced_ref_param"><a href="#val-mk_abduced_ref_param" class="anchor"></a><code><span class="keyword">val</span> mk_abduced_ref_param : <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> int <span>-></span> <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>create an abduced variable for a parameter passed by reference</p></dd></dl><dl><dt class="spec value" id="val-mk_abduced_ret"><a href="#val-mk_abduced_ret" class="anchor"></a><code><span class="keyword">val</span> mk_abduced_ret : <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>create an abduced return variable for a call to <code>proc_name</code> at <code>loc</code></p></dd></dl><dl><dt class="spec value" id="val-mk_callee"><a href="#val-mk_callee" class="anchor"></a><code><span class="keyword">val</span> mk_callee : <a href="../IR/Mangled/index.html#type-t">IR.Mangled.t</a> <span>-></span> <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>mk_callee name proc_name</code> creates a program var for a callee function with the given function name</p></dd></dl><dl><dt class="spec value" id="val-mk_global"><a href="#val-mk_global" class="anchor"></a><code><span class="keyword">val</span> mk_global : <span>?⁠is_constexpr:bool</span> <span>-></span> <span>?⁠is_ice:bool</span> <span>-></span> <span>?⁠is_pod:bool</span> <span>-></span> <span>?⁠is_static_local:bool</span> <span>-></span> <span>?⁠is_static_global:bool</span> <span>-></span> <span>?⁠is_constant_array:bool</span> <span>-></span> <span>?⁠translation_unit:<a href="../IBase/SourceFile/index.html#type-t">IBase.SourceFile.t</a></span> <span>-></span> <a href="../IR/Mangled/index.html#type-t">IR.Mangled.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>create a global variable with the given name</p></dd></dl><dl><dt class="spec value" id="val-mk_tmp"><a href="#val-mk_tmp" class="anchor"></a><code><span class="keyword">val</span> mk_tmp : string <span>-></span> <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>create a fresh temporary variable local to procedure <code>pname</code>. for use in the frontends only!</p></dd></dl><dl><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val</span> pp : <a href="../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a> <span>-></span> <a href="index.html#module-F">F</a>.formatter <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><p>Pretty print a program variable.</p></dd></dl><dl><dt class="spec value" id="val-pp_value"><a href="#val-pp_value" class="anchor"></a><code><span class="keyword">val</span> pp_value : <a href="index.html#module-F">F</a>.formatter <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><p>Pretty print a pvar which denotes a value, not an address</p></dd></dl><dl><dt class="spec value" id="val-pp_value_non_verbose"><a href="#val-pp_value_non_verbose" class="anchor"></a><code><span class="keyword">val</span> pp_value_non_verbose : <a href="index.html#module-F">F</a>.formatter <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> unit</code></dt><dd><p>Non-verbose version of pp_value</p></dd></dl><dl><dt class="spec value" id="val-pp_translation_unit"><a href="#val-pp_translation_unit" class="anchor"></a><code><span class="keyword">val</span> pp_translation_unit : <a href="index.html#module-F">F</a>.formatter <span>-></span> <a href="index.html#type-translation_unit">translation_unit</a> <span>-></span> unit</code></dt><dt class="spec value" id="val-to_callee"><a href="#val-to_callee" class="anchor"></a><code><span class="keyword">val</span> to_callee : <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>Turn an ordinary program variable into a callee program variable</p></dd></dl><dl><dt class="spec value" id="val-to_seed"><a href="#val-to_seed" class="anchor"></a><code><span class="keyword">val</span> to_seed : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>Turn a pvar into a seed pvar (which stores the initial value of a stack var)</p></dd></dl><dl><dt class="spec value" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span class="keyword">val</span> to_string : <a href="index.html#type-t">t</a> <span>-></span> string</code></dt><dd><p>Convert a pvar to string.</p></dd></dl><dl><dt class="spec value" id="val-get_translation_unit"><a href="#val-get_translation_unit" class="anchor"></a><code><span class="keyword">val</span> get_translation_unit : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-translation_unit">translation_unit</a></code></dt><dd><p>Get the translation unit corresponding to a global. Raises Invalid_arg if not a global.</p></dd></dl><dl><dt class="spec value" id="val-is_compile_constant"><a href="#val-is_compile_constant" class="anchor"></a><code><span class="keyword">val</span> is_compile_constant : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Is the variable's value a compile-time constant? Always (potentially incorrectly) returns <code>false</code> for non-globals.</p></dd></dl><dl><dt class="spec value" id="val-is_ice"><a href="#val-is_ice" class="anchor"></a><code><span class="keyword">val</span> is_ice : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Is the variable's type an integral constant expression? Always (potentially incorrectly) returns <code>false</code> for non-globals.</p></dd></dl><dl><dt class="spec value" id="val-is_pod"><a href="#val-is_pod" class="anchor"></a><code><span class="keyword">val</span> is_pod : <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dd><p>Is the variable's type a "Plain Old Data" type (C++)? Always (potentially incorrectly) returns <code>true</code> for non-globals.</p></dd></dl><dl><dt class="spec value" id="val-get_initializer_pname"><a href="#val-get_initializer_pname" class="anchor"></a><code><span class="keyword">val</span> get_initializer_pname : <a href="index.html#type-t">t</a> <span>-></span> <span><a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> option</span></code></dt><dd><p>Get the procname of the initializer function for the given global variable</p></dd></dl><dl><dt class="spec value" id="val-build_formal_from_pvar"><a href="#val-build_formal_from_pvar" class="anchor"></a><code><span class="keyword">val</span> build_formal_from_pvar : <a href="index.html#type-t">t</a> <span>-></span> <a href="../IR/Mangled/index.html#type-t">IR.Mangled.t</a></code></dt><dd><p><code>build_formal_from_pvar var</code> Return a name that is composed of the name of var (and the name of the procname in case of locals)</p></dd></dl><dl><dt class="spec value" id="val-materialized_cpp_temporary"><a href="#val-materialized_cpp_temporary" class="anchor"></a><code><span class="keyword">val</span> materialized_cpp_temporary : string</code></dt><dt class="spec value" id="val-swap_proc_in_local_pvar"><a href="#val-swap_proc_in_local_pvar" class="anchor"></a><code><span class="keyword">val</span> swap_proc_in_local_pvar : <a href="index.html#type-t">t</a> <span>-></span> <a href="../IR/Procname/index.html#type-t">IR.Procname.t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dt class="spec value" id="val-rename"><a href="#val-rename" class="anchor"></a><code><span class="keyword">val</span> rename : <span>f:<span>(string <span>-></span> string)</span></span> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt></dl><dl><dt class="spec module" id="module-Set"><a href="#module-Set" class="anchor"></a><code><span class="keyword">module</span> Set : <a href="../IStdlib/PrettyPrintable/index.html#module-type-PPSet">IStdlib.PrettyPrintable.PPSet</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../IStdlib/PrettyPrintable/index.html#module-type-PPSet">PPSet</a>.elt = <a href="index.html#type-t">t</a></code></dt><dd><p>Sets of pvars.</p></dd></dl><dl><dt class="spec type" id="type-capture_mode"><a href="#type-capture_mode" class="anchor"></a><code><span class="keyword">type</span> capture_mode</code><code> = </code><table class="variant"><tr id="type-capture_mode.ByReference" class="anchored"><td class="def constructor"><a href="#type-capture_mode.ByReference" class="anchor"></a><code>| </code><code><span class="constructor">ByReference</span></code></td></tr><tr id="type-capture_mode.ByValue" class="anchored"><td class="def constructor"><a href="#type-capture_mode.ByValue" class="anchor"></a><code>| </code><code><span class="constructor">ByValue</span></code></td></tr></table></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_capture_mode"><a href="#val-compare_capture_mode" class="anchor"></a><code><span class="keyword">val</span> compare_capture_mode : <a href="index.html#type-capture_mode">capture_mode</a> <span>-></span> <a href="index.html#type-capture_mode">capture_mode</a> <span>-></span> int</code></dt><dt class="spec value" id="val-equal_capture_mode"><a href="#val-equal_capture_mode" class="anchor"></a><code><span class="keyword">val</span> equal_capture_mode : <a href="index.html#type-capture_mode">capture_mode</a> <span>-></span> <a href="index.html#type-capture_mode">capture_mode</a> <span>-></span> bool</code></dt></dl></div></div></div><dl><dt class="spec value" id="val-string_of_capture_mode"><a href="#val-string_of_capture_mode" class="anchor"></a><code><span class="keyword">val</span> string_of_capture_mode : <a href="index.html#type-capture_mode">capture_mode</a> <span>-></span> string</code></dt></dl></div></body></html>