JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++
Binaries

Symbol (cs_abs_loc): cs_abs_loc.h

Defines a set of symbol (cs_abs_loc) operations and supporting types.

Internal representation for symbols is available for C/C++ and binary analyses only. For C# and Java analyses, plug-ins that rely on symbol properties and relationships will generally not produce useful information.


Links


Defines

#define CS_ABS_LOC_H
#define cs_func_attr(x) ((cs_func_attrs)(x))
#define cs_func_attr_none cs_func_attr(0x0) No function attributes.
#define cs_func_attr_weak cs_func_attr(0x1) The function has weak linkage (e.g., __attribute__((weak)) ).
#define cs_func_attr_inline cs_func_attr(0x2) The function has inline linkage.
#define cs_func_attr_initialization cs_func_attr(0x4) The function is declared with __attribute__((constructor)) or is a C++/CLI "static constructor.".
#define cs_func_attr_finalization cs_func_attr(0x8) The function is declared with __attribute__((destructor)) .
#define cs_func_attr_library cs_func_attr(0x10) CSURF_MARKER_LIBRARY_FUNCTION was #define'd to 1 at the definition site of the function.
#define cs_func_attr_compiler_generated cs_func_attr(0x20) The function is synthesized by the compiler; its definition does not appear in the source code.
#define cs_func_attr_cs_generated cs_func_attr(0x40) The function is synthesized by CodeSonar/CodeSurfer.
#define cs_func_attr_constructor cs_func_attr(0x80) The function is a constructor.
#define cs_func_attr_destructor cs_func_attr(0x100) The function is a destructor.
#define cs_func_attr_assignment_operator cs_func_attr(0x200) The function is an operator= overload.
#define cs_func_attr_template cs_func_attr(0x400) The function is the result of a template instantiation.
#define cs_func_attr_csonar_library_refine cs_func_attr(0x800) CodeSonar is encouraged to "step into" this function if it is summarized along a path.

Normally, CodeSonar does not step into library models summarized in the middle of a path. This flag is not meaningful for non-library-model functions, or for any function in a CodeSurfer project.

#define cs_func_attr_multi_define cs_func_attr(0x1000) The linkage for this function permits multiple definitions.

Functions with non-static weak or inline linkage, for example, would have this flag.

#define cs_func_attr_main cs_func_attr(0x2000) This is a main or WinMain function.
#define cs_func_attr_method cs_func_attr(0x4000) This is a C++ non-static method.
#define cs_func_attr_declared_static cs_func_attr(0x8000) This is a statically-declared function or method.
#define cs_func_attr_coroutine cs_func_attr(0x10000) This function is a coroutine.
#define cs_func_attr_all cs_func_attr(0x1ffff) All attributes together.
#define cs_var_attr(x) ((cs_var_attrs)(x))
#define cs_var_attr_none cs_var_attr(0x0) No variable attributes.
#define cs_var_attr_weak cs_var_attr(0x1) The variable has weak linkage (e.g., __attribute__((weak)) ).
#define cs_var_attr_threadlocal cs_var_attr(0x2) The variable has thread-local storage (e.g., __thread).
#define cs_var_attr_all cs_var_attr(0x3) All variable attributes together.
#define CS_ABS_LOC_NULL (cs_abs_loc_get_null()) The null cs_abs_loc.
#define CS_ABS_LOC_INL_H

Types

typedef cs_abs_loc_kind
Definition typedef __cs_abs_loc_kind_enum cs_abs_loc_kind
Notes Enumeration of the kinds associated with cs_abs_loc objects.
typedef cs_func_attrs
Definition typedef csuint32 cs_func_attrs
Notes Describes the attributes of a cs_abs_loc of kind cs_abs_loc_kind_function.

For C and C++, a cs_func_attrs value will represent some combination of the following.

  • cs_func_attr_none
  • cs_func_attr_weak
  • cs_func_attr_inline
  • cs_func_attr_initialization
  • cs_func_attr_finalization
  • cs_func_attr_library
  • cs_func_attr_compiler_generated
  • cs_func_attr_cs_generated
  • cs_func_attr_constructor
  • cs_func_attr_destructor
  • cs_func_attr_assignment_operator
  • cs_func_attr_template
  • cs_func_attr_csonar_library_refine
  • cs_func_attr_main
  • cs_func_attr_method
  • cs_func_attr_declared_static
  • cs_func_attr_all

Attributes for cs_abs_loc objects of other kinds are described by values of type cs_var_attrs.

typedef cs_var_attrs
Definition typedef csuint32 cs_var_attrs
Notes Describes the attributes of a cs_abs_loc of any kind except cs_abs_loc_kind_function.

For C and C++, a cs_var_attrs value will represent some combination of the following.

  • cs_var_attr_none
  • cs_var_attr_weak
  • cs_var_attr_threadlocal
  • cs_var_attr_all

Attributes for cs_abs_loc objects of kind cs_abs_loc_kind_function are described by values of type cs_func_attrs.

typedef cs_abs_loc_for_each_iter
Definition typedef struct cs_abs_loc_for_each_iter_t cs_abs_loc_for_each_iter
Notes A cs_abs_loc universe iterator.

Used by:

API clients should never directly access the fields of this type. This is only exported so that clients may stack allocate these things. Future versions of the API reserve the right to change the definition of this iterator type.

enum __cs_abs_loc_kind_enum
Definition typedef enum { } __cs_abs_loc_kind_enum
Notes Enumeration defining the kinds associated with cs_abs_loc.

On Separate Pages

struct cs_abs_loc_for_each_iter_t

Functions

cs_result cs_abs_loc_get_kind ( cs_abs_loc abs_loc, cs_abs_loc_kind * out_kind )
Retrieve the cs_abs_loc_kind of a cs_abs_loc.
cs_result cs_abs_loc_kind_name ( cs_abs_loc_kind kind, cs_const_string * out_string )
Retrieve the name of a cs_abs_loc_kind.
cs_result cs_abs_loc_var_attrs ( cs_abs_loc abs_loc, cs_var_attrs * out_attrs )
Get the attributes associated with a non-function cs_abs_loc.
cs_result cs_abs_loc_func_attrs ( cs_abs_loc abs_loc, cs_func_attrs * out_attrs )
Get the attributes associated with a function cs_abs_loc.
cs_boolean cs_abs_loc_is_global ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a global variable.
cs_boolean cs_abs_loc_is_heap ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a heap variable
cs_boolean cs_abs_loc_is_function ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a function.
cs_boolean cs_abs_loc_is_static_function ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a static function.
cs_boolean cs_abs_loc_is_string ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a string variable
cs_boolean cs_abs_loc_is_file_static ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a file static variable.
cs_boolean cs_abs_loc_is_local_static ( cs_abs_loc abs_loc )
cs_boolean cs_abs_loc_is_local ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a local.
cs_boolean cs_abs_loc_is_formal ( cs_abs_loc abs_loc )
Check if a cs_abs_loc represents a formal parameter.
cs_boolean cs_abs_loc_extern_only ( cs_abs_loc abs_loc )
Check if a cs_abs_loc has only non-storage-allocating declarations.
cs_result cs_abs_loc_name ( cs_abs_loc abs_loc, cs_string out_string, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Retrieve the variable name of a cs_abs_loc.
cs_result cs_abs_loc_function_to_pdg ( cs_abs_loc abs_loc, cs_pdg * out_pdg )
Retrieve the cs_pdg corresponding to a function cs_abs_loc.
cs_result cs_abs_loc_represented_string ( cs_abs_loc abs_loc, cs_string out_string, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Retrieve the cs_string that represents a cs_abs_loc.
cs_result cs_abs_loc_pdg ( cs_abs_loc abs_loc, cs_pdg * out_pdg )
Retrieve the cs_pdg that encloses a local or local-static cs_abs_loc.
cs_result cs_abs_loc_compilation_uid ( cs_abs_loc abs_loc, cs_uid * out_uid )
Retrieve the cs_uid of the compilation unit that encloses a cs_abs_loc.
cs_result cs_abs_loc_ast ( cs_abs_loc abs_loc, cs_ast_family ast_family, cs_ast * out_ast )
Retrieve the cs_ast in a given cs_abs_loc.
cs_result cs_abs_loc_type ( cs_abs_loc abs_loc, cs_ast_family ast_family, cs_ast * out_ast )
Retrieve the type cs_ast of the specified cs_ast_family that is associated with the specified cs_abs_loc.
cs_result cs_abs_loc_file_line ( cs_abs_loc abs_loc, cs_sfid * out_sfid, cs_line * out_line )
Find the cs_sfid and cs_line of the smallest offset of a declaration vertex for a given cs_abs_loc.
cs_result cs_abs_loc_source_uid ( cs_abs_loc abs_loc, cs_uid * out_uid )
Find the cs_uid containing the declaration for a given cs_abs_loc.
cs_result cs_abs_loc_for_each_first ( cs_abs_loc * abs_loc, cs_abs_loc_for_each_iter * itr )
Retrieve the first cs_abs_loc in the project and an iterator for the rest of the cs_abs_loc objects.
cs_result cs_abs_loc_for_each_next ( cs_abs_loc * abs_loc, cs_abs_loc_for_each_iter * itr )
Retrieve the next cs_abs_loc from a cs_abs_loc_for_each_iter over the set of cs_abs_loc objects in the project.
cs_result cs_abs_loc_for_each_close ( cs_abs_loc_for_each_iter * itr )
Close a cs_abs_loc_for_each_iter iterator object.
cs_result cs_abs_loc_get_param ( cs_size_t num, cs_abs_loc * out )
Retrieve $param_NUM: the cs_abs_loc representing the NUM'th formal parameter.
cs_result cs_abs_loc_lookup ( cs_const_string aname, cs_abs_loc * out_loc )
Retrieve the cs_abs_loc with the given name.
cs_result cs_abs_loc_lookup_in_file ( cs_const_string loc_name, cs_const_file_path fname, cs_abs_loc * out_loc )
Retrieve the cs_abs_loc with the given name in the given file.
cs_result cs_abs_loc_lookup_in_uid ( cs_const_string loc_name, cs_uid uid, cs_abs_loc * out_loc )
Retrieve the cs_abs_loc with the given name in the given compilation unit.
cs_result cs_abs_loc_temp_source ( cs_abs_loc abs_loc, cs_string buf, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Given a temporary variable cs_abs_loc, get a cs_string containing the pretty-printed unnormalized C/C++ AST for that cs_abs_loc.
const char * cs_abs_loc_string ( cs_abs_loc abs_loc )
Get the variable name of a cs_abs_loc.
const char * cs_abs_loc_friendly_string ( cs_abs_loc abs_loc )
Get the user-friendly variable name of a cs_abs_loc.
const char * cs_abs_loc_temp_source_string ( cs_abs_loc abs_loc )
Given a temporary variable cs_abs_loc, get a string containing the pretty-printed unnormalized C/C++ AST for that cs_abs_loc.
const char * cs_abs_loc_represented_string_string ( cs_abs_loc abs_loc )
Get the string representation of a cs_abs_loc.
int cs_abs_loc_stable_compare ( cs_abs_loc aloc_a, cs_abs_loc aloc_b )
Compare two cs_abs_loc objects, with stable results across sufficiently-similar analyses.
cs_hash_t cs_abs_loc_stable_hash ( cs_abs_loc abs_loc )
Get a hash value for a cs_abs_loc, with stable results across sufficiently-similar analyses.
cs_result cs_abs_loc_get_handle ( cs_abs_loc abs_loc, cs_string abs_loc_handle, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Get a storable handle for a symbol (cs_abs_loc).
cs_result cs_abs_loc_lookup_handle ( cs_const_string abs_loc_handle, cs_abs_loc * abs_loc )
Retrieve a symbol (cs_abs_loc) from a handle.
cs_boolean cs_abs_loc_equal ( cs_abs_loc abs_loc1, cs_abs_loc abs_loc2 )
Check: are two cs_abs_loc objects equal?
int cs_abs_loc_compare ( cs_abs_loc aloc_a, cs_abs_loc aloc_b )
Compare two cs_abs_loc objects.
cs_hash_t cs_abs_loc_hash ( cs_abs_loc abs_loc )
Hash function for cs_abs_loc.
cs_hash_t cs_abs_loc_hash_seed ( cs_abs_loc abs_loc, cs_hash_t hash_seed )
Seeded hash function for cs_abs_loc.
cs_boolean cs_abs_loc_is_null ( cs_abs_loc abs_loc )
Determine whether a cs_abs_loc is null.
cs_abs_loc cs_abs_loc_get_null ( )
Return a null cs_abs_loc.

Function Descriptions

Function cs_abs_loc_get_kind
cs_result cs_abs_loc_get_kind (
Retrieve the cs_abs_loc_kind of a cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which to find the cs_abs_loc_kind.
out_kind [out] The cs_abs_loc_kind of abs_loc.
Returns A cs_result:
Function cs_abs_loc_kind_name
cs_result cs_abs_loc_kind_name (
Retrieve the name of a cs_abs_loc_kind.
Parameters
kind [in] The cs_abs_loc_kind for which the name is to be retrieved.
out_string [out] The string representation of the name of kind.
Returns A cs_result:
Time-Complexity O(1)
Function cs_abs_loc_var_attrs
cs_result cs_abs_loc_var_attrs (
Get the attributes associated with a non-function cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which attributes are to be retrieved.
out_attrs [out] A user-allocated buffer to be populated with the attributes for abs_loc (as a cs_var_attrs).
Returns A cs_result:
Function cs_abs_loc_func_attrs
cs_result cs_abs_loc_func_attrs (
Get the attributes associated with a function cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which attributes are to be retrieved.
out_attrs [out] A user-allocated buffer to be populated with the attributes for abs_loc (as a cs_func_attrs).
Returns A cs_result:
Function cs_abs_loc_is_global
cs_boolean cs_abs_loc_is_global (
Check if a cs_abs_loc represents a global variable.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a global variable, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_heap
cs_boolean cs_abs_loc_is_heap (
Check if a cs_abs_loc represents a heap variable
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a heap variable, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_function
cs_boolean cs_abs_loc_is_function (
Check if a cs_abs_loc represents a function.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a function, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_static_function
cs_boolean cs_abs_loc_is_static_function (
Check if a cs_abs_loc represents a static function.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a static function, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_string
cs_boolean cs_abs_loc_is_string (
Check if a cs_abs_loc represents a string variable
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a string variable, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_file_static
cs_boolean cs_abs_loc_is_file_static (
Check if a cs_abs_loc represents a file static variable.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a file static variable, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_local_static
cs_boolean cs_abs_loc_is_local_static (
Check if a cs_abs_loc represents a static variable local to a procedure.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a static variable local to a procedure, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_local
cs_boolean cs_abs_loc_is_local (
Check if a cs_abs_loc represents a local.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a non-static variable local to a procedure, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_is_formal
cs_boolean cs_abs_loc_is_formal (
Check if a cs_abs_loc represents a formal parameter.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_true if abs_loc represents a formal parameter, cs_false otherwise.
Time-Complexity O(1)
Function cs_abs_loc_extern_only
cs_boolean cs_abs_loc_extern_only (
Check if a cs_abs_loc has only non-storage-allocating declarations.
Parameters
abs_loc [in] The cs_abs_loc to check.
Returns cs_false if the abs_loc has any storage-allocating declarations, cs_true otherwise.
Time-Complexity O(1)
Function cs_abs_loc_name
cs_result cs_abs_loc_name (
Retrieve the variable name of a cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc whose variable name is to be obtained.
out_string [out] A user-allocated buffer to be populated with the variable name of abs_loc.
capacity_bytes [in] The capacity of out_string, measured in bytes.
bytes_needed [out] The number of bytes required to store the entire variable name of abs_loc.
Returns A cs_result:
  • CS_TRUNCATED if out_string is not large enough to hold the entire variable name of abs_loc (and so the name was truncated),
  • CS_SUCCESS otherwise.
Time-Complexity O(n), where n is the length of the variable name of abs_loc, bounded above by capacity_bytes.
Notes Retrieve the variable name of abs_loc and write it to out_string. If out_string is not large enough to hold the entire name, the name is truncated to fit into out_string. Note that this name may have a suffix of the form -i, where i is a unique integer.

Call this function with out_string NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the name of abs_loc.

Function cs_abs_loc_function_to_pdg
cs_result cs_abs_loc_function_to_pdg (
Retrieve the cs_pdg corresponding to a function cs_abs_loc.
Parameters
abs_loc [in] The function for which the cs_pdg should be obtained.
out_pdg [out] The cs_pdg corresponding to abs_loc.
Returns A cs_result:
Notes See also cs_abs_loc_pdg().
Function cs_abs_loc_represented_string
cs_result cs_abs_loc_represented_string (
Retrieve the cs_string that represents a cs_abs_loc.
Parameters
abs_loc [in] The variable for which the cs_string should be obtained.
out_string [out] A user-allocated buffer to be populated with the string that represents abs_loc.
capacity_bytes [in] The capacity of out_string, measured in bytes.
bytes_needed [out] The number of bytes needed to store the entire cs_string that represents abs_loc.
Returns A cs_result:
Notes Retrieve the cs_string that represents a abs_loc, surrounded by double quotation marks, and write it to out_string. If out_string is not large enough to hold the entire string, the string is truncated to fit into out_string.

Call this function with out_string NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the representation of abs_loc.

Function cs_abs_loc_pdg
cs_result cs_abs_loc_pdg (
Retrieve the cs_pdg that encloses a local or local-static cs_abs_loc.
Parameters
abs_loc [in] The variable for which the cs_pdg should be obtained.
out_pdg [out] The cs_pdg that encloses abs_loc.
Returns A cs_result:
Notes Retrieve the cs_pdg that encloses a local or local-static cs_abs_loc. See also cs_abs_loc_function_to_pdg().
Function cs_abs_loc_compilation_uid
cs_result cs_abs_loc_compilation_uid (
Retrieve the cs_uid of the compilation unit that encloses a cs_abs_loc.
Parameters
abs_loc [in] The variable for which the compilation unit cs_uid is to be obtained.
out_uid [out] The cs_uid of the compilation unit that encloses abs_loc.
Returns A cs_result:
Function cs_abs_loc_ast
cs_result cs_abs_loc_ast (
Retrieve the cs_ast in a given cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc whose AST is required.
ast_family [in] ABS_LOCs may be associated with multiple ASTs. This specifies which one to get. Each language dependent AST header file will define its AST families.
out_ast [out] The cs_ast associated with abs_loc.
Returns A cs_result:
Time-Complexity O(1)
Function cs_abs_loc_type
cs_result cs_abs_loc_type (
Retrieve the type cs_ast of the specified cs_ast_family that is associated with the specified cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which the type cs_ast is required.
ast_family [in] ABS_LOCs may be associated with multiple type ASTs. This specifies which one to get. Each language dependent ast header file will define its ast families.
out_ast [out] The retrieved type cs_ast.
Returns A cs_result:
Time-Complexity O(1)
Function cs_abs_loc_file_line
cs_result cs_abs_loc_file_line (
Find the cs_sfid and cs_line of the smallest offset of a declaration vertex for a given cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which the cs_sfid and cs_line are to be obtained.
out_sfid [out] Location to write the cs_sfid determined for abs_loc.
out_line [out] Location to write the cs_line determined for abs_loc.
Returns A cs_result:
Time-Complexity O(1)
Function cs_abs_loc_source_uid
cs_result cs_abs_loc_source_uid (
Find the cs_uid containing the declaration for a given cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which the cs_uid is to be obtained.
out_uid [out] Location to write the cs_uid determined for abs_loc.
Returns A cs_result:
Notes This function is deprecated. Use cs_abs_loc_file_line() instead.
Function cs_abs_loc_for_each_first
cs_result cs_abs_loc_for_each_first (
Retrieve the first cs_abs_loc in the project and an iterator for the rest of the cs_abs_loc objects.
Parameters
abs_loc [out] The first cs_abs_loc in the project.
itr [out] An iterator to traverse each cs_abs_loc in the project.
Returns A cs_result:
Notes Retrieve the first cs_abs_loc in the project. This function opens itr, which is required by cs_abs_loc_for_each_next(). Use cs_abs_loc_for_each_close() to close the iterator.
Function cs_abs_loc_for_each_next
cs_result cs_abs_loc_for_each_next (
Retrieve the next cs_abs_loc from a cs_abs_loc_for_each_iter over the set of cs_abs_loc objects in the project.
Parameters
abs_loc [out] The next cs_abs_loc in the project.
itr [inout] The iterator from which to retrieve abs_loc.
Returns A cs_result:
Function cs_abs_loc_for_each_close
cs_result cs_abs_loc_for_each_close (
Close a cs_abs_loc_for_each_iter iterator object.
Parameters
itr [out] The iterator to be closed.
Returns CS_SUCCESS on success.
Function cs_abs_loc_get_param
cs_result cs_abs_loc_get_param (
Retrieve $param_NUM: the cs_abs_loc representing the NUM'th formal parameter.
Parameters
num [in] The number of the parameter to be retrieved (counting from the left, starting from 1).
out [out] Set to the $param_num cs_abs_loc.
Returns A cs_result:
Notes The $param_n cs_abs_loc objects are 1-based. They have global scope, no type, and do not belong to any specific function.
Function cs_abs_loc_lookup
cs_result cs_abs_loc_lookup (
Retrieve the cs_abs_loc with the given name.
Parameters
aname [in] The name of a cs_abs_loc. Must be a string of the form varname-num, where:
  • varname is the name of the entity represented by the cs_abs_loc
  • num is a number such that varname-num uniquely identifies the cs_abs_loc
out_loc [out] The cs_abs_loc associated with name.
Returns A cs_result:
Function cs_abs_loc_lookup_in_file
cs_result cs_abs_loc_lookup_in_file (
Retrieve the cs_abs_loc with the given name in the given file.
Parameters
loc_name [in] The name of a cs_abs_loc. Must be a string of the form varname-num, where
  • varname is the name of the entity represented by the cs_abs_loc
  • num is a number such that varname-num uniquely identifies the cs_abs_loc
fname [in] The name of the file containing the local or static cs_abs_loc (NULL for a global cs_abs_loc).
out_loc [out] The cs_abs_loc associated with loc_name in the source file named fname.
Returns A cs_result:
Function cs_abs_loc_lookup_in_uid
cs_result cs_abs_loc_lookup_in_uid (
Retrieve the cs_abs_loc with the given name in the given compilation unit.
Parameters
loc_name [in] The name of the cs_abs_loc.
uid [in] The cs_uid of the compilation unit enclosing the cs_abs_loc.
out_loc [out] The cs_abs_loc associated with loc_name in the given uid.
Returns A cs_result:
Function cs_abs_loc_temp_source
cs_result cs_abs_loc_temp_source (
Given a temporary variable cs_abs_loc, get a cs_string containing the pretty-printed unnormalized C/C++ AST for that cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which to obtain the pretty-printed AST.
buf [out] A user-allocated cs_string to be populated with the pretty-printed AST.
capacity_bytes [in] The capacity of buf, measured in bytes.
bytes_needed [out] The number of bytes required to store the entire pretty-printed normalized C/C++ AST for abs_loc.
Returns A cs_result:
Notes Writes the pretty-printed unnormalized C/C++ AST for abs_loc to buf. If buf is not large enough to hold the entire string, the string is truncated to fit into buf.

Call this function with buf NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire pretty-printed AST for abs_loc.

Function cs_abs_loc_string
const char * cs_abs_loc_string (
Get the variable name of a cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc whose variable name is to be obtained.
Returns A pointer to a buffer containing the variable name of abs_loc (as a char*). The buffer is only valid until another API function is invoked. Note that this name may have a suffix of the form -i, where i is a unique integer.
Notes Do not modify or free the returned buffer.

This function entails less user overhead than cs_abs_loc_name(), and so can be more convenient to use; the tradeoff is that the returned value is not under user control and has a constrained lifetime.

Function cs_abs_loc_friendly_string
const char * cs_abs_loc_friendly_string (
Get the user-friendly variable name of a cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc whose variable name is to be obtained.
Returns A pointer to a buffer containing the variable name of abs_loc (as a char*). The buffer is only valid until another API function is invoked.
Notes Do not modify or free the returned buffer.

This function differs from cs_abs_loc_string() in only one respect: the returned name will never have a -i suffix (for integer i).

Function cs_abs_loc_temp_source_string
const char * cs_abs_loc_temp_source_string (
Given a temporary variable cs_abs_loc, get a string containing the pretty-printed unnormalized C/C++ AST for that cs_abs_loc.
Parameters
abs_loc [in] The cs_abs_loc for which to obtain the pretty-printed AST.
Returns A pointer to a buffer containing the pretty-printed AST (as a char*). The buffer is only valid until another API function is invoked.
Notes Do not modify or free the returned buffer.

This function entails less user overhead than cs_abs_loc_temp_source(), and so can be more convenient to use; the tradeoff is that the returned value is not under user control and has a constrained lifetime.

Function cs_abs_loc_represented_string_string
const char * cs_abs_loc_represented_string_string (
Get the string representation of a cs_abs_loc.
Parameters
abs_loc [in] The variable for which the string should be obtained.
Returns A pointer to a buffer containing the string that represents abs_loc (as a char*). The buffer is only valid until another API function is invoked.
Notes Do not modify or free the returned buffer.

This function entails less user overhead than cs_abs_loc_represented_string(), and so can be more convenient to use; the tradeoff is that the returned value is not under user control and has a constrained lifetime.

Function cs_abs_loc_stable_compare
int cs_abs_loc_stable_compare (
Compare two cs_abs_loc objects, with stable results across sufficiently-similar analyses.
Parameters
aloc_a [in] First cs_abs_loc to compare.
aloc_b [in] Second cs_abs_loc to compare.
Returns An integer N such that:
  • N<0 if aloc_a considered less than aloc_b
  • N==0 if aloc_a and aloc_b are the same cs_abs_loc
  • N>0 if aloc_a considered greater than aloc_b
Notes This function is provided so cs_abs_loc objects can be stored in ordered containers that provide stable iteration order.

The comparison is stable in the following sense. Suppose there are two analyses A1 and A2 generated with exactly the same inputs (including identical analyzed code, underlying build commands and ordering, command line and configuration settings, increment order and contents). Let a1 and b1 be two cs_abs_loc values in A1, and a2 and b2 be the cs_abs_loc values in A2 that correspond to a1 and b2 respectively. Then cs_abs_loc_stable_compare(a1,b1)==cs_abs_loc_stable_compare(a2,b2).

If you do not need comparison results to be stable across different analyses, use cs_abs_loc_compare(): it has better performance.

Function cs_abs_loc_stable_hash
cs_hash_t cs_abs_loc_stable_hash (
Get a hash value for a cs_abs_loc, with stable results across sufficiently-similar analyses.
Parameters
abs_loc [in] The variable for which the hash should be obtained.
Returns A hash derived from the contents of abs_loc.
Notes This hash value is stable in the following sense. Suppose there are two analyses A1 and A2 generated with exactly the same inputs (including identical analyzed code, underlying build commands and ordering, command line and configuration settings, increment order and contents). Let a1 be a cs_abs_loc in A1, and a2 be the cs_abs_loc in A2 that corresponds to a1. Then cs_abs_loc_stable_hash(a1)==cs_abs_loc_stable_hash(a2).

If you do not need hash values to be stable across analyses, use cs_abs_loc_hash(): it has better performance.

Function cs_abs_loc_get_handle
cs_result cs_abs_loc_get_handle (
Get a storable handle for a symbol (cs_abs_loc).
Parameters
abs_loc [in] The cs_abs_loc to return a handle for.
abs_loc_handle [out] The handle of the symbol.
capacity_bytes [in] The size of the provided buffer.
bytes_needed [out] Buffer size needed for the handle.
Returns A cs_result:
Notes This function returns a handle to the symbol which is suitable for storing externally, allowing the symbol to be retrieved whenever needed.
Function cs_abs_loc_lookup_handle
cs_result cs_abs_loc_lookup_handle (
Retrieve a symbol (cs_abs_loc) from a handle.
Parameters
abs_loc_handle [in] The handle of the symbol.
abs_loc [out] A cs_abs_loc matching the handle.
Returns A cs_result:
Notes This function uses the provided handle to retrieve a symbol.
Function cs_abs_loc_equal
cs_boolean cs_abs_loc_equal (
Check: are two cs_abs_loc objects equal?
Parameters
abs_loc1 [in] First cs_abs_loc to compare.
abs_loc2 [in] Second cs_abs_loc to compare.
Returns cs_true if abs_loc1 and abs_loc2 are equal; cs_false if not.
Function cs_abs_loc_compare
int cs_abs_loc_compare (
Compare two cs_abs_loc objects.
Parameters
aloc_a [in] First cs_abs_loc to compare.
aloc_b [in] Second cs_abs_loc to compare.
Returns An integer N such that:
  • N<0 if aloc_a considered less than aloc_b
  • N==0 if aloc_a considered equal to aloc_b
  • N>0 if aloc_a considered greater than aloc_b
Notes This function is provided so cs_abs_loc objects can be stored in ordered containers. It is not based on any user-perceivable order of cs_abs_loc objects.

For fixed cs_abs_loc values a and b in a single analysis, cs_abs_loc_compare(a,b) will always return the same value. However, cs_abs_loc_compare() will not necessarily return this same value when called on the corresponding cs_abs_loc values a' and b' in a different analysis. Function cs_abs_loc_stable_compare() provides some degree of stability across analyses, although restrictions still apply. If you do not need comparison results to be stable across different analyses, use cs_abs_loc_compare(): it has better performance.

Function cs_abs_loc_hash
cs_hash_t cs_abs_loc_hash (
Hash function for cs_abs_loc.
Parameters
abs_loc [in] A cs_abs_loc to hash.
Returns A hash of abs_loc.
Notes For a fixed cs_abs_loc a in a single analysis, cs_abs_loc_hash(a) will always return the same value. However, cs_abs_loc_hash() will not necessarily return this same value when called on the corresponding cs_abs_loc a' in a different analysis. Function cs_abs_loc_stable_hash() provides some degree of stability across analyses, although restrictions still apply. If you do not need hash values to be stable across different analyses, use cs_abs_loc_hash(): it has better performance.
Function cs_abs_loc_hash_seed
cs_hash_t cs_abs_loc_hash_seed (
Seeded hash function for cs_abs_loc.
Parameters
abs_loc [in] A cs_abs_loc to hash.
hash_seed [in] The hash seed to use, as a cs_hash_t.
Returns A hash of abs_loc with respect to hash_seed.
Function cs_abs_loc_is_null
cs_boolean cs_abs_loc_is_null (
Determine whether a cs_abs_loc is null.
Parameters
abs_loc [in] The cs_abs_loc to check for nullity.
Returns cs_true if all bits of abs_loc are zeroed; cs_false otherwise.
Notes No CodeSonar API function should ever return a null cs_abs_loc, with the exception of cs_abs_loc_get_null().
Function cs_abs_loc_get_null
cs_abs_loc cs_abs_loc_get_null ( )
Return a null cs_abs_loc.
Returns A null cs_abs_loc.
 

To report problems with this documentation, please visit https://support.codesecure.com/.