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.0p0 Hot Tips | CONFIDENTIAL | CodeSecure Inc |
Defines a set of operations on points (cs_pdg_vertex) for CodeSonar.
Internal representation for points is available for C/C++ and binary analyses only. For C# and Java analyses, plug-ins that rely on point properties and relationships will generally not produce useful information.| #define CS_PDG_VERTEX_H | ||
| #define CS_PDG_VERTEX_NULL | (cs_pdg_vertex_get_null()) | The null cs_pdg_vertex. |
| #define CS_PDG_VERTEX_INL_H |
| cs_result | cs_pdg_vertex_kind_name ( cs_vertex_kind kind, cs_const_string * out_string )
Retrieve the name of a cs_vertex_kind.
|
| csint64 | cs_pdg_vertex_id ( cs_pdg_vertex pv )
Find the unique identifier of a given cs_pdg_vertex.
|
| cs_vertex_kind | cs_pdg_vertex_kind ( cs_pdg_vertex pv )
Determine the kind of a cs_pdg_vertex.
|
| cs_vertex_syntax_kind | cs_pdg_vertex_syntax_kind ( cs_pdg_vertex pv )
Determine the syntax kind of a cs_pdg_vertex.
|
| cs_vertex_syntax_element | cs_pdg_vertex_syntax_element ( cs_pdg_vertex pv )
Determine the syntax element of a cs_pdg_vertex.
|
| cs_boolean | cs_vertex_kind_participates_in_cfg ( cs_vertex_kind k )
Determine whether vertices of a given cs_vertex_kind appear in a CFG.
|
| cs_result | cs_pdg_vertex_pdg ( cs_pdg_vertex pv, cs_pdg * out_pdg )
Retrieve the cs_pdg containing a given cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_ast ( cs_pdg_vertex pv, cs_ast_family ast_family, cs_ast * out_ast )
Retrieve the cs_ast associated with a given cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_charpos ( cs_pdg_vertex pv, cs_sfid * out_sfid, cs_const_int_pair_set * out_set )
Find the character positions (in the source code) for a given cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_file_line ( cs_pdg_vertex pv, cs_sfid * out_sfid, cs_line * out_line )
Find the file instance and line of the smallest offset for a given cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_characters ( cs_pdg_vertex pv, cs_string out_string, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Construct a cs_string representation of a given cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_rank ( cs_pdg_vertex pv, cs_size_t * out )
Retrieve the rank of a cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_cfg_inter_targets ( cs_pdg_vertex pv, cs_cfg_edge_set * out_set )
Retrieve the inter-procedural successors of a cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_cfg_targets ( cs_pdg_vertex pv, cs_const_cfg_edge_set * out_set )
Retrieve the intra-procedural successors of a cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_solitary_cfg_target ( cs_pdg_vertex pv, cs_pdg_vertex * out_vertex )
Retrieve the CFG successor of a cs_pdg_vertex that has exactly one successor CFG edge.
|
| cs_result | cs_pdg_vertex_actual_to_formals ( cs_pdg_vertex pv, cs_pdg_vertex_set * out_set ) |
| cs_result | cs_pdg_vertex_actuals_in ( cs_pdg_vertex pv, cs_pdg_vertex_set * out_set )
Retrieve the actual-in and global-actual-in points (cs_pdg_vertex) associated with a given call site cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_actuals_out ( cs_pdg_vertex pv, cs_pdg_vertex_set * out_set )
Retrieve the actual-out and global-actual-out points (cs_pdg_vertex) associated with a given call site cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_actuals_in_as_list ( cs_pdg_vertex pv, cs_pdg_vertex actual_ins[], cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Retrieve a list of the actual-in and global-actual-in points (cs_pdg_vertex) associated with a given call site cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_actuals_out_as_list ( cs_pdg_vertex pv, cs_pdg_vertex actual_outs[], cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Retrieve a list of the actual-out points (cs_pdg_vertex) associated with a given call site cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_actual_in ( cs_pdg_vertex pv, cs_size_t rank, cs_pdg_vertex * ai_vertex )
Retrieve the actual-in points (cs_pdg_vertex), having the specified rank, associated with a given call site cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_actual_out ( cs_pdg_vertex pv, cs_size_t rank, cs_pdg_vertex * ao_vertex )
Retrieve the actual-out points (cs_pdg_vertex), having the specified rank, associated with a given call site cs_pdg_vertex.
|
| cs_result | cs_pdg_vertex_call_site ( cs_pdg_vertex pv, cs_pdg_vertex * out_vertex )
Retrieve the call site of a subordinate vertex.
|
| cs_result | cs_pdg_vertex_callee ( cs_pdg_vertex call_site, cs_pdg * out_pdg )
Retrieve the callee cs_pdg for a call site.
|
| cs_boolean | cs_pdg_vertex_is_inside_macro ( cs_pdg_vertex v )
Determine whether a cs_pdg_vertex is entirely contained inside a macro.
|
| cs_boolean | cs_pdg_vertex_is_implicit_actual_in ( cs_pdg_vertex v )
Determine whether a cs_pdg_vertex is an actual-in that is implicitly generated.
|
| cs_result | cs_pdg_vertex_source_pp ( cs_pdg_vertex pv, cs_string buf, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
[CodeSonar only] Given a cs_pdg_vertex, get a cs_string containing a pretty printed version of the vertex.
|
| csuint64 | cs_pdg_vertex_condition_number ( cs_pdg_vertex pv )
[CodeSonar only] Given a cs_pdg_vertex, get its condition number.
|
| const char * | cs_pdg_vertex_source_pp_string ( cs_pdg_vertex pv )
[CodeSonar only] Given a cs_pdg_vertex, get a string containing a pretty printed version of the vertex.
|
| const char * | cs_pdg_vertex_string ( cs_pdg_vertex pv )
Get a string representation of a cs_pdg_vertex containing information useful for debugging.
|
| cs_hash_t | cs_pdg_vertex_stable_hash ( cs_pdg_vertex pv )
Get a hash value for a cs_pdg_vertex, with stable results across sufficiently-similar analyses.
|
| int | cs_pdg_vertex_stable_compare ( cs_pdg_vertex pv_a, cs_pdg_vertex pv_b )
Compare two cs_pdg_vertex objects, with stable results across sufficiently-similar analyses.
|
| cs_result | cs_pdg_vertex_get_handle ( cs_pdg_vertex pdg_vertex, cs_string pdg_vertex_handle, cs_size_t capacity_bytes, cs_size_t * bytes_needed )
Get a storable handle for a point (cs_pdg_vertex).
|
| cs_result | cs_pdg_vertex_lookup_handle ( cs_const_string pdg_vertex_handle, cs_pdg_vertex * pdg_vertex )
Retrieve a point (cs_pdg_vertex) from a handle.
|
| cs_boolean | cs_pdg_vertex_equal ( cs_pdg_vertex pv1, cs_pdg_vertex pv2 )
Check: are two cs_pdg_vertex objects equal?
|
| int | cs_pdg_vertex_compare ( cs_pdg_vertex pv_a, cs_pdg_vertex pv_b )
Compare two cs_pdg_vertex objects.
|
| cs_hash_t | cs_pdg_vertex_hash ( cs_pdg_vertex pv )
Hash function for cs_pdg_vertex.
|
| cs_hash_t | cs_pdg_vertex_hash_seed ( cs_pdg_vertex pv, cs_hash_t hashseed )
Seeded hash function for cs_pdg_vertex.
|
| cs_boolean | cs_pdg_vertex_is_null ( cs_pdg_vertex pv )
Determine whether a cs_pdg_vertex is null.
|
| cs_pdg_vertex | cs_pdg_vertex_get_null ( )
Return a null cs_pdg_vertex.
|
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Time-Complexity | O(1) |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | The unique identifier of pv. | |||
| Time-Complexity | O(1) | |||
| Notes | Return the unique identifier of pv.
To get a cs_pdg_vertex given its ID, use cs_pdg_retrieve_vertex(). |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | The kind of pv. | |||
| Time-Complexity | O(1) |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | The syntax kind of pv. | |||
| Time-Complexity | O(1) |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | The syntax element of pv. | |||
| Time-Complexity | O(1) |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | cs_true iff a vertex of kind k can ever appear in a CFG, cs_false otherwise. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Time-Complexity | O(1) |
| Parameters |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
|||||||||
| Time-Complexity | O(1) |
| Parameters |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
|||||||||
| Time-Complexity | O(1) |
| Parameters |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
|||||||||
| Time-Complexity | O(n), where n is the number of pairs in cs_pdg_vertex_charpos( pv,... ) |
| Parameters |
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||||||||
| Time-Complexity | O(*bytes_needed) time on a 'hit'. If the compilation unit and/or source file involved have not been accessed recently, then the running time will be worse. | ||||||||||||
| Notes | Construct a cs_string representation of a given cs_pdg_vertex. The string is formed by concatenating all characters in the source file that are associated with pv.
Call this function with out_string NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire representation. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Time-Complexity | O(1) | ||||||
| Notes | Retrieve the rank of a cs_pdg_vertex. Rank starts at 1, with globals coming first, followed by non-globals. For non-globals, rank shows the order they appear in the source. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Notes | See CFG Edges for more information. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Time-Complexity | O(1) | ||||||
| Notes | See CFG Edges for more information. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Time-Complexity | O(1) | ||||||
| Notes | Note that if pv has one CFG successor vertex but there are multiple CFG edges from pv to that successor, this function will return CS_PDG_VERTEX_HAS_ZERO_OR_MULTIPLE_SUCCESSORS.
See CFG Edges for more information. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Notes | Retrieve the formal-in points (cs_pdg_vertex) associated with a given actual-in point. If pv has kind cs_vertex_kind_actual_in and is a call to a defined function, then return a cs_pdg_vertex_set containing the formal-in vertex associated with pv.
The modeling of the GNU extension __builtin_apply leads to the possibility that more than one formal can be associated with a given actual. In this case, the cs_pdg_vertex_set returned will contain several formals. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
| Parameters |
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||||||||
| Notes | Call this function with actual_ins NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire list. |
| Parameters |
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||||||||
| Notes | Call this function with actual_outs NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire list. |
| Parameters |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
| Parameters |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
|||||||||
| Notes | In most languages (including C and C++), only an actual-out of rank 1 can exist. It corresponds to the return value of a function. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
|
||||||
| Notes | Some cs_vertex_kind_indirect_call vertices will not have a corresponding call-site; CS_ELEMENT_NOT_PRESENT will be returned both in this case and when a vertex of the wrong kind is supplied. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Time-Complexity | O(1) |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns |
A cs_boolean:
|
|||
| Notes | This function will return cs_false if only part of the cs_pdg_vertex is inside a macro expansion. For example, if pv is the vertex corresponding to the assignment "p = NULL", cs_pdg_vertex_is_inside_macro(pv) will return cs_false. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns |
A cs_boolean:
|
|||
| Notes | An implicit actual-in can occur in C++ code where the callee returns a non-trivial C++ object. For example: std::string s = std::to_string(1) [actual-in] $param_1 = &s [actual-in] $param_2 = 1 |
| Parameters |
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||||||||
| Notes | Call this function with buf NULL and capacity_bytes 0 (zero) to determine the memory needed to hold the entire string. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | The condition number or 0 on failure. | |||
| Notes | Each group of vertices in the same conditional will share the same condition number. The value has no meaning, beyond grouping vertices by conditional. A conditional is defined as the predicate of one if statement or loop. Multiple vertices can arise from one conditional because normalizations decompose a single if statement into many vertices in the presence of language features such as short-circuiting connectives. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | The empty string if this vertex does not have this information, otherwise a string with the pretty printed version of the vertex. | |||
| Notes | Aborts if the cs_vertex_kind of pv is not one of cs_vertex_kind_actual_in, cs_vertex_kind_expression, cs_vertex_kind_call_site, or cs_vertex_kind_control_point.
Do not modify or free the returned buffer. This function entails less user overhead than cs_pdg_vertex_source_pp(), 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. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | A pointer to a buffer containing the representation of v (as a char*). The buffer is only valid until another API function is invoked. | |||
| Notes | Do not modify or free the returned buffer. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | A hash derived from pv. | |||
| 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 v1 be a cs_pdg_vertex in A1, and v2 be the cs_pdg_vertex in A2 that corresponds to v1. Then cs_pdg_vertex_stable_hash(v1)==cs_pdg_vertex_stable_hash(v2).
If you do not need hash values to be stable across analyses, use cs_pdg_vertex_hash(): it has better performance. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
An integer N, such that:
|
||||||
| Notes | This function is provided so cs_pdg_vertex 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_pdg_vertex values in A1, and a2 and b2 be the cs_pdg_vertex values in A2 that correspond to a1 and b1 respectively. Then cs_pdg_vertex_stable_compare(a1,b1)==cs_pdg_vertex_stable_compare(a2,b2). If you do not need comparison results to be stable across different analyses, use cs_pdg_vertex_compare(): it has better performance. |
| Parameters |
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||||||||
| Notes | This function returns a handle to the point which is suitable for storing externally, allowing the point to be retrieved whenever needed. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
A cs_result:
|
||||||
| Notes | This function uses the provided handle to retrieve a point. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns | cs_true if pv1 and pv2 are the same cs_pdg_vertex; cs_false if not. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns |
An integer N, such that:
|
||||||
| Notes | This function is provided so cs_pdg_vertex objects can be stored in ordered containers. It is not based on any user-perceivable order of cs_pdg_vertex objects.
For fixed cs_pdg_vertex values a and b in a single analysis, cs_pdg_vertex_compare(a,b) will always return the same value. However, cs_pdg_vertex_compare() will not necessarily return this same value when called on the corresponding cs_pdg_vertex values a' and b' in a different analysis. Function cs_pdg_vertex_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_pdg_vertex_compare(): it has better performance. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | A hash of pv. | |||
| Notes | For a fixed cs_pdg_vertex v in a single analysis, cs_pdg_vertex_hash(v) will always return the same value. However, cs_pdg_vertex_hash() will not necessarily return this same value when called on the corresponding cs_pdg_vertex v' in a different analysis. Function cs_pdg_vertex_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_pdg_vertex_hash(): it has better performance. |
| Parameters |
|
||||||
|---|---|---|---|---|---|---|---|
| Returns | A hash of pv, seeded by hashseed. |
| Parameters |
|
|||
|---|---|---|---|---|
| Returns | cs_true if all bits of pv are zeroed; cs_false otherwise. | |||
| Notes | No CodeSonar API function should ever return a null cs_pdg_vertex, with the exception of cs_pdg_vertex_get_null(). |
| Returns | A null cs_pdg_vertex. |
|---|