CodeSonar C++ API
Classes | Typedefs | Functions
cs Namespace Reference

Namespace for CodeSonar/CodeSurfer API. More...

Classes

class  access_path
 An access path describes a memory location as a sequence of steps from some base symbol, with each step represented by a access_path object. More...
 
class  analysis
 Manages the warning classes (warningclass) and visitors (visitor) for the analysis. More...
 
class  analysis_mode
 Enumeration class describing the mode of a CodeSonar analysis process. More...
 
class  ast
 An Abstract Syntax Tree (AST). More...
 
class  ast_bindings
 The result of an ast_pattern::match() query: bindings from ast_pattern variables to AST fields (ast_field). More...
 
class  ast_class
 Enumeration class for AST classes. More...
 
class  ast_family
 Enumeration class for AST family. More...
 
class  ast_field
 A field (child or attribute) of an Abstract Syntax Tree (class ast). More...
 
class  ast_field_not_found_error
 Describe an error where an ast_field lookup failed. More...
 
class  ast_field_type
 Enumeration class for AST field (child or attribute; ast_field) types. More...
 
class  ast_iterator
 Iterator over the Abstract Syntax Trees (ASTs, ast) in the tree rooted at a particular ast. More...
 
class  ast_ordinal
 Enumeration class for AST ordinals: used to designate a field (ast_field) of an ast. More...
 
class  ast_pattern
 An AST Pattern. More...
 
class  ast_pattern_compilation_error
 Describe an error in compiling an ast_pattern. More...
 
class  ast_traverse_directives
 Flag class: specifies behavior during traversal with an ast_iterator. More...
 
class  ast_traverse_flags
 Flag class: specifies what kind of traversal an ast_iterator will carry out. More...
 
class  cfg_edge_set
 A set of cfg_edge. More...
 
class  cfg_edge_set_iterator
 Iterator over the cfg_edge elements of a cfg_edge_set. More...
 
class  cfg_path_node
 A node on a CFG path. More...
 
class  cfg_path_node_flags
 Flag class: characterizes a cfg_path_node. More...
 
class  compunit
 A compilation unit. More...
 
class  compunit_global_iterator
 Iterator over the global symbols (symbol) in a compilation unit (compunit). More...
 
class  compunit_metricclass
 A compunit granularity metric class. More...
 
class  compunit_metricclass_iterator
 Iterator over the compunit-granularity metric classes (compunit_metricclass) managed by a compunit_metricclass_manager. More...
 
class  compunit_metricclass_manager
 Manages the compunit granularity metric classes (compunit_metricclass) associated with an analysis. More...
 
class  compunit_procedure_iterator
 Iterator over the procedures (procedure) in a compilation unit (compunit). More...
 
class  csurf_info
 Information about the CodeSurfer installation. More...
 
class  directory
 A directory. More...
 
class  directory_children_iterator
 Iterator over the immediate subdirectories (directory) of a directory (directory). More...
 
class  directory_files_iterator
 Iterator over the files (sfile) immediately contained in a directory (directory). More...
 
class  edge_label
 Denotes the conditions under which control can flow along an edge: a component of a cfg_edge. More...
 
class  func_attrs
 Flag class: describes the attributes of a symbol of kind symbol_kind::FUNCTION. More...
 
class  int_pair_set
 Used to store pairs of integers, each of which represents a range of locations in a source file. More...
 
class  int_pair_set_iterator
 Iterator over the int_pair elements of a int_pair_set. More...
 
class  int_pairs_to_points_map
 A map int_pair_set -> point_set, where each entry represents the mapping from a source position to the set of points at that source position. More...
 
class  language
 Enumeration class: identifies the source language the compilation unit is in. More...
 
class  line_counts
 A collection of line count statistics. More...
 
class  locations_node
 Used by warningclass report() and report_return_warnings() methods that report a warning with a list of code locations. More...
 
class  locations_node_flags
 Flag class: describes properties of a locations_node. More...
 
class  metric_function
 The calculation function for a metric class. More...
 
class  metricclass_flags
 Flag class: characterizes a metric class (procedure_metricclass, sfile_metricclass, compunit_metricclass, project_metricclass). More...
 
class  multiprocess_mode
 Enumeration class describing the multiprocess mode of a CodeSonar analysis process. More...
 
class  object_pager
 Management for IO buffering. More...
 
class  point
 A single program point. More...
 
class  point_adjusted_callees_iterator
 An iterator over the callee procedures (procedure) from a specific point, taking into account any translations incurred by csonar_replace_*() calls and the FUNCTION_MAP configuration file variable. More...
 
class  point_adjusted_callees_no_reroute_iterator
 An iterator over the callee procedures (procedure) from a specific point, ignoring any translations incurred by csonar_replace_*() calls and the FUNCTION_MAP configuration file variable. More...
 
class  point_kind
 Enumeration class: program point (point) kind. More...
 
class  point_set
 A set of points (point). More...
 
class  point_set_iterator
 Iterator over the point elements of a point_set. More...
 
class  point_syntax_element
 Enumeration class: the element of source code statement from which a point was generated. More...
 
class  point_syntax_kind
 Enumeration class: the syntax kind associated with a program point (point), indicating the kind of source code statement from which the point was generated. More...
 
class  procedure
 A single procedure/function/method. More...
 
class  procedure_adjusted_callers_iterator
 An iterator over the direct and indirect call sites (point of kind point_kind::CALL_SITE or point_kind::INDIRECT_CALL) whose target is a particular procedure, taking into account any translations incurred by csonar_replace_*() calls and the FUNCTION_MAP configuration file variable. More...
 
class  procedure_call_sites_flags
 Flag class: specifies call site types. More...
 
class  procedure_call_sites_iterator
 Iterator over the call sites (point of kind point_kind::CALL_SITE) in a procedure. More...
 
class  procedure_callers_iterator
 Iterator over the call sites (point of kind point_kind::CALL_SITE) whose target is a particular procedure. More...
 
class  procedure_kind
 Enumeration class: the "kind" of a procedure. More...
 
class  procedure_locals_iterator
 Iterator over the local variables (symbol) that are declared in a procedure. More...
 
class  procedure_metricclass
 A procedure granularity metric class. More...
 
class  procedure_metricclass_iterator
 Iterator over the procedure-granularity metric classes (procedure_metricclass) managed by a procedure_metricclass_manager. More...
 
class  procedure_metricclass_manager
 Manages the procedure granularity metric classes (procedure_metricclass) associated with an analysis. More...
 
class  project
 A CodeSonar or CodeSurfer project. More...
 
class  project_compunits_iterator
 Iterator over all the compilation units (compunit) in a project. More...
 
class  project_metricclass
 A project granularity metric class. More...
 
class  project_metricclass_iterator
 Iterator over the project-granularity metric classes (project_metricclass) managed by a project_metricclass_manager. More...
 
class  project_metricclass_manager
 Manages the project granularity metric classes (project_metricclass) associated with an analysis. More...
 
class  project_procedures_iterator
 Iterator over all the procedures (procedure) in a project. More...
 
class  project_root_directories_iterator
 Iterator over the set of root directories(directory) in a project (deduced by inspecting all source file paths in the project). More...
 
class  project_sfiles_iterator
 Iterator over all the source files (sfile) in a project. More...
 
class  report_flags
 Flag class used by a number of warningclass report() and report_return_warning() methods. More...
 
class  result
 The result of an API operation. More...
 
class  rpc_handler
 Handles remote procedure calls (RPCs). More...
 
class  set_kind
 Enumeration class: the kind of a set. More...
 
class  sfile
 A source file. More...
 
class  sfile_instance_iterator
 Iterator over the instances (sfileinst) of a source file (sfile). More...
 
class  sfile_metricclass
 A sfile granularity metric class. More...
 
class  sfile_metricclass_iterator
 Iterator over the sfile-granularity metric classes (sfile_metricclass) managed by a sfile_metricclass_manager. More...
 
class  sfile_metricclass_manager
 Manages the sfile granularity metric classes (sfile_metricclass) associated with an analysis. More...
 
class  sfileinst
 A source file instance. More...
 
class  sfileinst_children_iterator
 Iterator over the include-tree children (sfileinst) of a source file instance. More...
 
class  sfileinst_color_map_iterator
 Iterator over the spans (position_range) of a specific syntax_kind within a source file instance (sfileinst). More...
 
class  sfileinst_range
 A range of (contiguous) locations in a single source file instance. More...
 
class  step_path
 Used by the warningclass report() and report_return_warnings() methods that report a warning with a step path, and by step visitors (step_state), as added with analysis::add_step_bottom_up_visitor(). More...
 
class  step_state
 Abstract base class for step visitors, as added with analysis::add_step_bottom_up_visitor(): subclass to define your own step visitors. More...
 
class  step_xform
 A program state transform along a path in the CFG. More...
 
struct  string_pair
 A pair of strings. More...
 
class  symbol
 A function or variable. More...
 
class  symbol_kind
 Enumeration class: the kind of a symbol. More...
 
class  symbol_set
 A set of symbols (symbol). More...
 
class  symbol_set_iterator
 Iterator over the symbol elements of a symbol_set. More...
 
class  symbol_universe_iterator
 Iterator over all the symbols (symbol) in a project. More...
 
class  syntax_kind
 Enumeration class: the kind of a span within a source file instance (sfileinst). More...
 
class  sysinfo
 Information about the local system. More...
 
class  var_attrs
 Flag class: describes the attributes of a symbol of any kind EXCEPT symbol_kind::FUNCTION. More...
 
class  visitor
 Abstract base class for visitors: functors that carry out actions on elements of the internal representation (IR) at various stages of the analysis. More...
 
class  warning
 A warning instance. More...
 
class  warning_retraction_info
 Describes the cases in which a warning instance should be retracted. More...
 
class  warning_significance
 Enumeration class describing the significance setting for a warning class. More...
 
class  warningclass
 A warning class. More...
 
class  warningclass_flags
 Flag class: describes properties of a warningclass. More...
 
class  xform_expr
 Specifies parts of a query expression for step_xform::query() or step_xform::query_bounds(). More...
 
class  xform_expr_mode
 Enumeration class: the evaluation mode for an xform_expr. More...
 
class  xform_operator
 Enumeration class: an operator that can be used in a transform query with step_xform::query(). More...
 
class  xform_query_bounds_result
 The return type of step_xform::query_bounds() More...
 
class  xform_query_result
 Enumeration class: the possible outcomes of a transform query with step_xform::query(). More...
 
class  xr_def_iter_flags
 Flag class: properties for an xr_definition_iterator. More...
 
class  xr_definition_iterator
 Iterator over the definitions (xr_tuple) of a token. More...
 
class  xr_file_query
 A collection of filters used to restrict a xr_query. More...
 
class  xr_homonym_iterator
 Iterator over the homonyms (xr_tuple) of a token. More...
 
class  xr_intra_definition_iterator
 Iterator over the definitions (xr_tuple) of a token. More...
 
class  xr_kind
 Enumeration class: describes the kind of a (non-keyword) token. More...
 
class  xr_kind_role
 Enumeration class: describes a valid token kind-role (kind-usage) pair. More...
 
class  xr_occ_iter_flags
 Flag class: properties for xr_occurrence_iterator and xr_homonym_iterator iterators. More...
 
class  xr_occurrence_iterator
 Iterator over the occurrences (xr_tuple) of a token. More...
 
class  xr_query
 Fully specifies a cross-referencing query over the tokens in an analyzed project. More...
 
class  xr_query_flags
 Flag class: additional properties for an xr_query. More...
 
class  xr_query_iterator
 Iterator over the results (xr_tuple) of an xr_query. More...
 
class  xr_role
 Enumeration class: describes the role that a token is playing at a particular occurrence of that token. More...
 
class  xr_tuple
 Describes an occurrence of a token in a particular kind-role and the definition corresponding to that occurrence. More...
 
class  xr_tuple_comparator
 Abstract base class for xref_tuple comparators: functors that specify an ordering on the results (xr_tuple) of an xr_query. More...
 
class  xtype_render_style
 Flag class for selecting type rendering styles. More...
 

Typedefs

typedef std::vector< cs::string_ast_field_pairast_binding_vector
 A std::vector of ast_binding.
 
typedef std::vector< cs::ast_classast_class_vector
 A std::vector of ast_class.
 
typedef std::vector< cs::ast_fieldast_field_vector
 A std::vector of ast_field.
 
typedef std::vector< cs::astast_vector
 A std::vector of ast.
 
typedef std::pair< cs::point, cs::edge_labelcfg_edge
 A std::pair (p, el) where:
 
typedef std::vector< cfg_edge_setcfg_edge_set_vector
 A std::vector of cfg_edge_set.
 
typedef std::vector< cfg_edgecfg_edge_vector
 A std::vector of cfg_edge .
 
typedef std::vector< cs::cfg_path_nodecfg_path_node_vector
 A std::vector of cs::cfg_path_node.
 
typedef cs_column column_number
 A character position in a line (line_number) of a source file instance (sfileinst).
 
typedef std::pair< cs::compunit, cs::procedure_and_points_vectorcompunit_points
 A std::pair (c, ppv) where:
 
typedef std::pair< cs::compunit, cs::point_setcompunit_points_pair
 A std::pair (c, ps) where:
 
typedef std::vector< cs::compunit_points_paircompunit_points_pair_vector
 A std::vector of compunit_points_pair.
 
typedef std::vector< cs::compunit_pointscompunit_points_vector
 A std::vector of compunit_points.
 
typedef std::vector< cs::compunitcompunit_vector
 A std::vector of compilation units (compunit).
 
typedef cs_ea effective_address
 An effective address: used for binary analyses to hold the address of an entity such as a point or symbol.
 
typedef exceptional_return exceptional_exit
 A std::pair (p, s) where:
 
typedef std::vector< cs::exceptional_exitexceptional_exit_vector
 A std::vector of exceptional_exit.
 
typedef std::pair< cs::point, std::string > exceptional_return
 A std::pair (p, s) where:
 
typedef std::vector< cs::exceptional_returnexceptional_return_vector
 A std::vector of exceptional_return.
 
typedef cs_file_offset file_offset
 A character position in a source file (sfile).
 
typedef std::pair< csuint32, csuint32 > int_pair
 A std::pair of integers, used to represent a range of locations in a compilation unit.
 
typedef std::vector< int_pair_setint_pair_set_vector
 A std::vector of int_pair_set.
 
typedef std::vector< int_pairint_pair_vector
 A std::vector of int_pair .
 
typedef std::vector< cs::languagelanguage_vector
 A std::vector of language.
 
typedef int_pair line_and_column_number
 An int_pair in which the first element represents a line number in a source file instance, and the second element represents a column (that is, character position) in that line.
 
typedef cs_line line_number
 A line number in a source file (sfile) or source file instance (sfileinst).
 
typedef std::vector< cs::line_numberline_number_vector
 A std::vector of line_number.
 
typedef std::vector< cs::locations_nodelocations_node_vector
 A std::vector of cs::locations_node.
 
typedef std::vector< point_setpoint_set_vector
 A std::vector of point_set.
 
typedef std::vector< pointpoint_vector
 A std::vector of point .
 
typedef std::pair< std::pair< csuint32, csuint32 >, std::pair< csuint32, csuint32 > > position_range
 A std::pair of line_and_column_number, designating the beginning and end of a span in a source file instance (sfileinst).
 
typedef std::pair< cs::procedure, cs::point_setprocedure_and_points
 A std::pair (p, ps) where:
 
typedef std::vector< cs::procedure_and_pointsprocedure_and_points_vector
 A std::vector of procedure_and_points.
 
typedef std::vector< cs::string_pairprocedure_name_to_model_vector
 A std::vector of string_pair, representing a map from a function name or call address to the way that function should be modeled.
 
typedef std::vector< cs::procedureprocedure_vector
 A std::vector of procedure.
 
typedef std::vector< std::vector< cs::procedure > > procedure_vector_vector
 A std::vector of procedure_vector.
 
typedef std::pair< cs::sfile, cs::line_numbersfile_line_pair
 A std::pair (sf, line) where:
 
typedef std::pair< cs::sfileinst, cs::int_pair_setsfileinst_int_pair_set_pair
 std::pair (sfi, ips) where:
 
typedef std::pair< cs::sfileinst, std::pair< cs::line_number, cs::column_number > > sfileinst_line_column
 A std::pair (sfi, loc) where:
 
typedef std::pair< cs::sfileinst, cs::line_numbersfileinst_line_pair
 A std::pair (sfi, line) where:
 
typedef std::vector< cs::sfileinstsfileinst_vector
 A std::vector of sfileinst.
 
typedef std::pair< std::string, cs::ast_fieldstring_ast_field_pair
 A std::pair (name, field) representing a binding from one pattern variable to an ast_field.
 
typedef std::vector< std::string > string_vector
 A std::vector of std::string.
 
typedef std::vector< symbol_setsymbol_set_vector
 A std::vector of symbol_set.
 
typedef std::vector< symbolsymbol_vector
 A std::vector of symbol .
 
typedef std::pair< cs::xr_kind, cs::xr_rolexr_kind_role_pair
 A std::pair (k, r) where:
 
typedef std::vector< cs::xr_kind_rolexr_kind_role_vector
 A std::vector of xr_kind_role.
 
typedef std::vector< cs::xr_kindxr_kind_vector
 A std::vector of xr_kind.
 
typedef std::vector< cs::xr_rolexr_role_vector
 A std::vector of xr_role.
 

Functions

csuint64 string_hash (const std::string &s)
 Get a hash of a std::string.
 
std::string xmldecode (const std::string &s)
 XML-decode a std::string.
 
std::string xmlencode (const std::string &s, bool use_private_use_area=true)
 XML-encode a std::string.
 
csuint64 xr_namehash (const std::string &s)
 Hash a token name.
 

Detailed Description

Namespace for CodeSonar/CodeSurfer API.

Typedef Documentation

◆ ast_binding_vector

A std::vector of ast_binding.

◆ ast_class_vector

typedef std::vector<cs::ast_class> cs::ast_class_vector

◆ ast_field_vector

typedef std::vector<cs::ast_field> cs::ast_field_vector

◆ ast_vector

typedef std::vector<cs::ast> cs::ast_vector

◆ cfg_edge

typedef std::pair<cs::point, cs::edge_label> cs::cfg_edge

A std::pair (p, el) where:

Indicates that there is a control flow edge labeled el between some point P of interest and p. The direction of that edge depends on the context in which the containing cfg_edge_set was retrieved: for edges in predecessor query results for P the edge is p->P, in successor query results for P the edge is P->p.

For more information, see CFG Edges.

◆ cfg_edge_set_vector

typedef std::vector< cfg_edge_set> cs::cfg_edge_set_vector

◆ cfg_edge_vector

typedef std::vector< cfg_edge > cs::cfg_edge_vector

◆ cfg_path_node_vector

◆ column_number

typedef cs_column cs::column_number

A character position in a line (line_number) of a source file instance (sfileinst).

◆ compunit_points

A std::pair (c, ppv) where:

Used when categorizing points by compilation unit and, within compilation unit, by procedure.

◆ compunit_points_pair

A std::pair (c, ps) where:

Used when categorizing points according to the compilation unit they belong to.

◆ compunit_points_pair_vector

◆ compunit_points_vector

◆ compunit_vector

typedef std::vector<cs::compunit> cs::compunit_vector

A std::vector of compilation units (compunit).

◆ effective_address

typedef cs_ea cs::effective_address

An effective address: used for binary analyses to hold the address of an entity such as a point or symbol.

◆ exceptional_exit

A std::pair (p, s) where:

Used to describe an exceptional return point, with p a point of kind point_kind::EXCPT_EXIT and s a label for p.

◆ exceptional_exit_vector

◆ exceptional_return

typedef std::pair<cs::point, std::string> cs::exceptional_return

A std::pair (p, s) where:

Used to describe an exceptional return point, with p a point of kind point_kind::EXCPT_RETURN and s a label for p.

◆ exceptional_return_vector

◆ file_offset

typedef cs_file_offset cs::file_offset

A character position in a source file (sfile).

◆ int_pair

typedef std::pair<csuint32, csuint32> cs::int_pair

A std::pair of integers, used to represent a range of locations in a compilation unit.

◆ int_pair_set_vector

typedef std::vector< int_pair_set> cs::int_pair_set_vector

◆ int_pair_vector

typedef std::vector< int_pair > cs::int_pair_vector

◆ language_vector

typedef std::vector<cs::language> cs::language_vector

◆ line_and_column_number

An int_pair in which the first element represents a line number in a source file instance, and the second element represents a column (that is, character position) in that line.

◆ line_number

typedef cs_line cs::line_number

A line number in a source file (sfile) or source file instance (sfileinst).

◆ line_number_vector

◆ locations_node_vector

◆ point_set_vector

typedef std::vector< point_set> cs::point_set_vector

◆ point_vector

typedef std::vector< point > cs::point_vector

◆ position_range

typedef std::pair< std::pair<csuint32, csuint32>, std::pair<csuint32, csuint32> > cs::position_range

A std::pair of line_and_column_number, designating the beginning and end of a span in a source file instance (sfileinst).

This is the element type for a sfileinst_color_map_iterator.

◆ procedure_and_points

A std::pair (p, ps) where:

Used when categorizing points (point) according to the procedure they belong to.

◆ procedure_and_points_vector

◆ procedure_name_to_model_vector

A std::vector of string_pair, representing a map from a function name or call address to the way that function should be modeled.

project::run_multiinterval_analysis() takes an argument of this type.

◆ procedure_vector

typedef std::vector<cs::procedure> cs::procedure_vector

◆ procedure_vector_vector

typedef std::vector<std::vector<cs::procedure> > cs::procedure_vector_vector

◆ sfile_line_pair

A std::pair (sf, line) where:

  • sf is a source file (sfile).
  • line is a line_number.

◆ sfileinst_int_pair_set_pair

std::pair (sfi, ips) where:

Used to describe a set of substrings in a source file instance.

Return type for point::charpos().

◆ sfileinst_line_column

A std::pair (sfi, loc) where:

  • sfi is a source file instance (sfileinst).
  • loc is a std::pair (line, col), where:
    • line is a line_number.
    • line is a column number.

◆ sfileinst_line_pair

A std::pair (sfi, line) where:

  • sfi is a source file instance (sfileinst).
  • line is a line_number.

◆ sfileinst_vector

typedef std::vector<cs::sfileinst> cs::sfileinst_vector

◆ string_ast_field_pair

typedef std::pair<std::string, cs::ast_field> cs::string_ast_field_pair

A std::pair (name, field) representing a binding from one pattern variable to an ast_field.

  • name is always set to the name of a variable in the pattern.
  • field The ast_field to which the variable with the specified name is bound. Its type is set to ast_field_type::NULL_ if the variable is unbound.

◆ string_vector

typedef std::vector<std::string> cs::string_vector

A std::vector of std::string.

◆ symbol_set_vector

typedef std::vector< symbol_set> cs::symbol_set_vector

◆ symbol_vector

typedef std::vector< symbol > cs::symbol_vector

◆ xr_kind_role_pair

A std::pair (k, r) where:

Return type for xr_kind_role::decompose().

◆ xr_kind_role_vector

◆ xr_kind_vector

typedef std::vector<cs::xr_kind> cs::xr_kind_vector

◆ xr_role_vector

typedef std::vector<cs::xr_role> cs::xr_role_vector

Function Documentation

◆ string_hash()

csuint64 cs::string_hash ( const std::string &  s)
inline

Get a hash of a std::string.

Parameters
[in]sthe std::string to hash.
Returns
The hash value.

Use to produce a hash value for use with sfile::procedures_on_line_fast(line_number, cs_hash_t, bool).

◆ xmldecode()

std::string cs::xmldecode ( const std::string &  s)
inline

XML-decode a std::string.

Parameters
[in]sthe std::string to decode.
Returns
The std::string, after decoding from XML.

◆ xmlencode()

std::string cs::xmlencode ( const std::string &  s,
bool  use_private_use_area = true 
)
inline

XML-encode a std::string.

Parameters
[in]sthe std::string to encode.
[in]use_private_use_areaShould the private-use-area be used?

When parsing source code, CodeSonar may encounter code using an unspecified encoding. In general, CodeSonar's strategy for dealing with this ambiguity is to forward the bit stream as-is all the way to the UI (typically a web browser).

When use_private_use_area is true, bytes 128 or higher will be escaped as code point 0xe000 + byte. They will appear in the XML as &#xe080..&#xe0ff. The CodeSonar hub expects XML to be encoded in this fashion.

If use_private_use_area is false, the bytes will appear as-is in the XML. XML parsers will reject this XML if they do not use a character encoding matching the data.

Returns
The std::string, after encoding to XML.

◆ xr_namehash()

csuint64 xr_namehash ( const std::string &  s)
inline

Hash a token name.

Parameters
[in]sThe token name.
Returns
A hash of s, as a csuint64