This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!DOCTYPE html>
<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>Pvar (infer.IR.Pvar)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.1"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><scriptsrc="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divclass="content"><header><nav><ahref="../index.html">Up</a>–<ahref="../../index.html">infer</a>»<ahref="../index.html">IR</a>» Pvar</nav><h1>Module <code>IR.Pvar</code></h1></header><aside><p>Program variables.</p></aside><divclass="spec module"id="module-F"><ahref="#module-F"class="anchor"></a><code><spanclass="keyword">module</span> F = Stdlib.Format</code></div><dl><dtclass="spec type"id="type-translation_unit"><ahref="#type-translation_unit"class="anchor"></a><code><spanclass="keyword">type</span> translation_unit</code><code> = <span><ahref="../../IBase/SourceFile/index.html#type-t">IBase.SourceFile.t</a> option</span></code></dt></dl><div><divclass="spec include"><divclass="doc"><dl><dtclass="spec value"id="val-compare_translation_unit"><ahref="#val-compare_translation_unit"class="anchor"></a><code><spanclass="keyword">val</span> compare_translation_unit : <ahref="index.html#type-translation_unit">translation_unit</a><span>-></span><ahref="index.html#type-translation_unit">translation_unit</a><span>-></span> int</code></dt></dl></div></div></div><dl><dtclass="spec type"id="type-t"><ahref="#type-t"class="anchor"></a><code><spanclass="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><divclass="spec include"><divclass="doc"><dl><dtclass="spec value"id="val-compare"><ahref="#val-compare"class="anchor"></a><code><spanclass="keyword">val</span> compare : <ahref="index.html#type-t">t</a><span>-></span><ahref="index.html#type-t">t</a><span>-></span> int</code></dt></dl></div></div></div><dl><dtclass="spec value"id="val-compare_modulo_this"><ahref="#val-compare_modulo_this"class="anchor"></a><code><spanclass="keyword">val</span> compare_modulo_this : <ahref="index.html#type-t">t</a><span>-></span><ahref="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><dtclass="spec value"id="val-equal"><ahref="#val-equal"class="anchor"></a><code><spanclass="keyword">val</span> equal : <ahref="index.html#type-t">t</a><span>-></span><ahref="index.html#type-t">t</a><span>-></span> bool</code></dt><dd><p>Equality for pvar's</p></dd></dl><dl><dtclass="spec value"id="val-get_declaring_function"><ahref="#val-get_declaring_function"class="anchor"></a><code><spanclass="keyword">val</span> get_declaring_function : <ahref="index.html#type-t">t</a><span>-></span><span><ahref="../Procname/index.html#type-t">Procname.t</a> option</span></code></dt><dd><p>if not a global, return function declaring var</p></dd></dl><dl><dtclass="spec value"id="val-d"><ahref="#val-d"class="anchor"></a><code><spanclass="keyword">val</span> d : <ahref="index.html#type-t">t</a><span>-></span> unit</code></dt><dd><p>Dump a program variable.</p></dd></dl><dl><dtclass="spec value"id="val-get_name"><ahref="#val-get_name"class="anchor"></a><code><spanclass="keyword">val</span> get_name : <ahref="index.html#type-t">t</a><span>-></span><ahref="../Mangled/index.html#type-t">Mangled.t</a></code></dt><dd><p>Get the name component of a program variable.</p></dd></dl><dl><dtclass="spec value"id="val-get_ret_pvar"><ahref="#val-get_ret_pvar"class="anchor"></a><code><spanclass="keyword">val</span> get_ret_pvar : <ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="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><dtclass="spec value"id="val-get_ret_param_pvar"><ahref="#val-get_ret_param_pvar"class="anchor"></a><code><spanclass="keyword">val</span> get_ret_param_pvar : <ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="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><dtclass="spec value"id="val-get_simplified_name"><ahref="#val-get_simplified_name"class="anchor"></a><code><spanclass="keyword">val</span> get_simplified_name : <ahref="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><dtclass="spec value"id="val-is_abduced"><ahref="#val-is_abduced"class="anchor"></a><code><spanclass="keyword">val</span> is_abduced : <ahref="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><dtclass="spec value"id="val-is_callee"><ahref="#val-is_callee"class="anchor"></a><code><spanclass="keyword">val</span> is_callee : <ahref="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><dtclass="spec value"id="val-is_global"><ahref="#val-is_global"class="anchor"></a><code><spanclass="keyword">val</span> is_global : <ahref="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><dtclass="spec value"id="val-is_static_local"><ahref="#val-is_static_local"class="anchor"></a><code><spanclass="keyword">val</span> is_static_local : <ahref="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><dtclass="spec value"id="val-is_constant_array"><ahref="#val-is_constant_array"class="anchor"></a><code><spanclass="keyword">val</span> is_constant_array : <ahref="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><dtclass="spec value"id="val-is_local"><ahref="#val-is_local"class="anchor"></a><code><spanclass="keyword">val</span> is_local : <ahref="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><dtclass="spec value"id="val-is_seed"><ahref="#val-is_seed"class="anchor"></a><code><spanclass="keyword">val</span> is_seed : <ahref="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><dtclass="spec value"id="val-is_return"><ahref="#val-is_return"class="anchor"></a><code><spanclass="keyword">val</span> is_return : <ahref="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><dtclass="spec value"id="val-is_this"><ahref="#val-is_this"class="anchor"></a><code><spanclass="keyword">val</span> is_this : <ahref="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><dtclass="spec value"id="val-is_self"><ahref="#val-is_self"class="anchor"></a><code><spanclass="keyword">val</span> is_self : <ahref="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><dtclass="spec value"id="val-is_frontend_tmp"><ahref="#val-is_frontend_tmp"class="anchor"></a><code><spanclass="keyword">val</span> is_frontend_tmp : <ahref="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><dtclass="spec value"id="val-is_clang_tmp"><ahref="#val-is_clang_tmp"class="anchor"></a><code><spanclass="keyword">val</span> is_clang_tmp : <ahref="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><dtclass="spec value"id="val-is_ssa_frontend_tmp"><ahref="#val-is_ssa_frontend_tmp"class="anchor"></a><code><spanclass="keyword">val</span> is_ssa_frontend_tmp : <ahref="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><dtclass="spec value"id="val-is_cpp_temporary"><ahref="#val-is_cpp_temporary"class="anchor"></a><code><spanclass="keyword">val</span> is_cpp_temporary : <ahref="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><dtclass="spec value"id="val-is_objc_static_local_of_proc_name"><ahref="#val-is_objc_static_local_of_proc_name"class="anchor"></a><code><spanclass="keyword">val</span> is_objc_static_local_of_proc_name : string <span>-></span><ahref="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><dtclass="spec value"id="val-is_block_pvar"><ahref="#val-is_block_pvar"class="anchor"></a><code><spanclass="keyword">val</span> is_block_pvar : <ahref="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><dtclass="spec value"id="val-mk"><ahref="#val-mk"class="anchor"></a><code><spanclass="keyword">val</span> mk : <ahref="../Mangled/index.html#type-t">Mangled.t</a><span>-></span><ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="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><dtclass="spec value"id="val-mk_abduced_ref_param"><ahref="#val-mk_abduced_ref_param"class="anchor"></a><code><spanclass="keyword">val</span> mk_abduced_ref_param : <ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span> int <span>-></span><ahref="../../IBase/Location/index.html#type-t">IBase.Location.t</a><span>-></span><ahref="index.html#type-t">t</a></code></dt><dd><p>create an abduced variable for a parameter passed by reference</p></dd></dl><dl><dtclass="spec value"id="val-mk_abduced_ret"><ahref="#val-mk_abduced_ret"class="anchor"></a><code><spanclass="keyword">val</span> mk_abduced_ret : <ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="../../IBase/Location/index.html#type-t">IBase.Location.t</a><span>-></span><ahref="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><dtclass="spec value"id="val-mk_callee"><ahref="#val-mk_callee"class="anchor"></a><code><spanclass="keyword">val</span> mk_callee : <ahref="../Mangled/index.html#type-t">Mangled.t</a><span>-></span><ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="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><dtclass="spec value"id="val-mk_global"><ahref="#val-mk_global"class="anchor"></a><code><spanclass="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:<ahref="../../IBase/SourceFile/index.html#type-t">IBase.SourceFile.t</a></span><span>-></span><ahref="../Mangled/index.html#type-t">Mangled.t</a><span>-></span><ahref="index.html#type-t">t</a></code></dt><dd><p>create a global variable with the given name</p></dd></dl><dl><dtclass="spec value"id="val-mk_tmp"><ahref="#val-mk_tmp"class="anchor"></a><code><spanclass="keyword">val</span> mk_tmp : string <span>-></span><ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="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><dtclass="spec value"id="val-pp"><ahref="#val-pp"class="anchor"></a><code><spanclass="keyword">val</span> pp : <ahref="../../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a><span>-></span><ahref="index.html#module-F">F</a>.formatter <span>-></span><ahref="index.html#type-t">t</a><span>-></span> unit</code></dt><dd><p>Pretty print a program variable.</p></dd></dl><dl><dtclass="spec value"id="val-pp_value"><ahref="#val-pp_value"class="anchor"></a><code><spanclass="keyword">val</span> pp_value : <ahref="index.html#module-F">F</a>.formatter <span>-></span><ahref="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><dtclass="spec value"id="val-pp_value_non_verbose"><ahref="#val-pp_value_non_verbose"class="anchor"></a><code><spanclass="keyword">val</span> pp_value_non_verbose : <ahref="index.html#module-F">F</a>.formatter <span>-></span><ahref="index.html#type-t">t</a><span>-></span> unit</code></dt><dd><p>Non-verbose version of pp_value</p></dd></dl><dl><dtclass="spec value"id="val-pp_translation_unit"><ahref="#val-pp_translation_unit"class="anchor"></a><code><spanclass="keyword">val</span> pp_translation_unit : <ahref="index.html#module-F">F</a>.formatter <span>-></span><ahref="index.html#type-translation_unit">translation_unit</a><span>-></span> unit</code></dt><dtclass="spec value"id="val-to_callee"><ahref="#val-to_callee"class="anchor"></a><code><spanclass="keyword">val</span> to_callee : <ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="index.html#type-t">t</a><span>-></span><ahref="index.html#type-t">t</a></code></dt><dd><p>Turn an ordinary program variable into a callee program variable</p></dd></dl><dl><dtclass="spec value"id="val-to_seed"><ahref="#val-to_seed"class="anchor"></a><code><spanclass="keyword">val</span> to_seed : <ahref="index.html#type-t">t</a><span>-></span><ahref="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><dtclass="spec value"id="val-to_string"><ahref="#val-to_string"class="anchor"></a><code><spanclass="keyword">val</span> to_string : <ahref="index.html#type-t">t</a><span>-></span> string</code></dt><dd><p>Convert a pvar to string.</p></dd></dl><dl><dtclass="spec value"id="val-get_translation_unit"><ahref="#val-get_translation_unit"class="anchor"></a><code><spanclass="keyword">val</span> get_translation_unit : <ahref="index.html#type-t">t</a><span>-></span><ahref="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><dtclass="spec value"id="val-is_compile_constant"><ahref="#val-is_compile_constant"class="anchor"></a><code><spanclass="keyword">val</span> is_compile_constant : <ahref="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><dtclass="spec value"id="val-is_ice"><ahref="#val-is_ice"class="anchor"></a><code><spanclass="keyword">val</span> is_ice : <ahref="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><dtclass="spec value"id="val-is_pod"><ahref="#val-is_pod"class="anchor"></a><code><spanclass="keyword">val</span> is_pod : <ahref="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><dtclass="spec value"id="val-get_initializer_pname"><ahref="#val-get_initializer_pname"class="anchor"></a><code><spanclass="keyword">val</span> get_initializer_pname : <ahref="index.html#type-t">t</a><span>-></span><span><ahref="../Procname/index.html#type-t">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><dtclass="spec value"id="val-build_formal_from_pvar"><ahref="#val-build_formal_from_pvar"class="anchor"></a><code><spanclass="keyword">val</span> build_formal_from_pvar : <ahref="index.html#type-t">t</a><span>-></span><ahref="../Mangled/index.html#type-t">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><dtclass="spec value"id="val-materialized_cpp_temporary"><ahref="#val-materialized_cpp_temporary"class="anchor"></a><code><spanclass="keyword">val</span> materialized_cpp_temporary : string</code></dt><dtclass="spec value"id="val-swap_proc_in_local_pvar"><ahref="#val-swap_proc_in_local_pvar"class="anchor"></a><code><spanclass="keyword">val</span> swap_proc_in_local_pvar : <ahref="index.html#type-t">t</a><span>-></span><ahref="../Procname/index.html#type-t">Procname.t</a><span>-></span><ahref="index.html#type-t">t</a></code></dt><dtclass="spec value"id="val-rename"><ahref="#val-rename"class="anchor"></a><code><spanclass="keyword">val</span> rename : <span>f:<span>(string <span>-></span> string)</span></span><span>-></span><ahref="index.html#type-t">t</a><span>-></span><ahref="index.html#type-t">t</a></code></dt></dl><dl><dtclass="spec module"id="module-Set"><ahref="#module-Set"class="anchor"></a><code><spanclass="keyword">module</span> Set : <ahref="../../IStdlib/PrettyPrintable/index.html#module-type-PPSet">IStdlib.PrettyPrintable.PPSet</a><spanclass="keyword">with</span><spanclass="keyword">type</span><ahref="../../IStdlib/PrettyPrintable/index.html#module-type-PPSet">PPSet</a>.elt = <ahref="index.html#type-t">t</a></code></dt><dd><p>Sets of pvars.</p></dd></dl><dl><dtclass="spec type"id="type-capture_mode"><ahref="#type-capture_mode"class="anchor"></a><code><spanclass="keyword">type</span> capture_mode</code><code> = </code><tableclass="variant"><trid="type-capture_mode.ByReference"class="anchored"><tdclass="def constructor"><ahref="#type-capture_mode.ByReference"class="anchor"></a><code>| </code><code><spanclass="constructor">ByReference</span></code></td></tr><trid="type-capture_mode.ByValue"class="anchored"><tdclass="def constructor"><ahref="#type-capture_mode.ByValue"class="anchor"></a><code>| </code><code><spanclass="constructor">ByValue</span></code></td></tr></table></dt></dl><div><divclass="spec include"><divclass="doc"><dl><dtclass="spec value"id="val-compare_capture_mode"><ahref="#val-compare_capture_mode"class="anchor"></a><code><spanclass="keyword">val</span> compare_capture_mode : <ahref="index.html#type-capture_mode">capture_mode</a><span>-></span><ahref="index.html#type-capture_mode">capture_mode</a><span>-></span> int</code></dt><dtclass="spec value"id="val-equal_capture_mode"><ahref="#val-equal_capture_mode"class="anchor"></a><code><spanclass="keyword">val</span> equal_capture_mode : <ahref="index.html#type-capture_mode">capture_mode</a><span>-></span><ahref="index.html#type-capture_mode">capture_mode</a><span>-></span> bool</code></dt></dl></div></div></div><dl><dtclass="spec value"id="val-string_of_capture_mode"><ahref="#val-string_of_capture_mode"class="anchor"></a><code><spanclass="keyword">val</span> string_of_capture_mode : <ahref="index.html#type-capture_mode">capture_mode</a><span>-></span> string</code></dt></dl></div></body></html>