class func_attrs

Flag class: describes the attributes of a symbol of kind symbol_kind.FUNCTION.

(Attributes for symbols of all other kinds are described by objects of class var_attrs .)

func_attrs Details

class cs.func_attrs

Flag class: describes the attributes of a symbol of kind symbol_kind.FUNCTION.

static from_integer(_inner)

Construct an instance from an integer representation.

Parameters:_inner (int) – The integer representation, as returned by func_attrs.as_integer().
Return type:func_attrs
Raises:result.ERROR_INVALID_ARGUMENT if _inner is not a valid integer representation for a func_attrs instance.

Invariant: For func_attrs x, func_attrs.from_integer(x.as_integer()) == x

>>> fa = (func_attrs.WEAK|func_attrs.MAIN).as_integer()
>>> fa
8193
>>> func_attrs.from_integer(fa)
<cs.func_attrs weak|main>
__and__(b)

AND operator for func_attrs .

Parameters:b (func_attrs) – AND operand.
Return type:func_attrs
Returns:A func_attrs object containing all flags that are in both self and b.
>>> func_attrs.WEAK & func_attrs.COMPILER_GENERATED
<cs.func_attrs none>
__cmp__(other)

Comparison function for func_attrs , with respect to a stable overall ordering.

Parameters:other (func_attrs) – The func_attrs object to compare against.
Return type:int
Returns:An integer N such that:
  • N==0 if the two objects compare equal
  • N<0 if self < other
  • N>0 if self > other
>>> func_attrs.MAIN.__cmp__(func_attrs.LIBRARY)
1
__eq__(b)

Equality operator for func_attrs .

Parameters:b (func_attrs) – The func_attrs object to compare against.
Return type:bool
Returns:True if self and b compare equal, False otherwise.
>>> func_attrs.MULTI_DEFINE == func_attrs.INITIALIZATION
False
__ge__(b)

Greater-than-or-equal operator for func_attrs .

Parameters:b (func_attrs) – The func_attrs object to compare against.
Return type:bool
Returns:True if self >= b , False otherwise.
>>> func_attrs.NONE >= func_attrs.CSONAR_LIBRARY_REFINE
False
__gt__(b)

Greater-than operator for func_attrs .

Parameters:b (func_attrs) – The func_attrs object to compare against.
Return type:bool
Returns:True if self > b , False otherwise.
>>> func_attrs.FINALIZATION > func_attrs.ASSIGNMENT_OPERATOR
False
__hash__()

Hash function for func_attrs .

Return type:int
>>> hash(func_attrs.CS_GENERATED)
64
__invert__()

Complementation operator.

Return type:func_attrs
Returns:A func_attrs object containing the flags that are NOT contained in self.
>>> ~func_attrs.CSONAR_LIBRARY_REFINE
<cs.func_attrs weak|inline|initialization|finalization|library|compiler-generated|cs-generated|constructor|destructor|assignment-operator|template|multi-define|main|method|declared-static>
__le__(b)

Less-than-or-equal operator for func_attrs .

Parameters:b (func_attrs) – The func_attrs object to compare against.
Return type:bool
Returns:True if self <= b , False otherwise.
>>> func_attrs.INITIALIZATION <= func_attrs.ASSIGNMENT_OPERATOR
True
__lt__(b)

Less-than operator for func_attrs .

Parameters:b (func_attrs) – The func_attrs object to compare against.
Return type:bool
Returns:True if self < b , False otherwise.
>>> func_attrs.INLINE_FUNCTION < func_attrs.COMPILER_GENERATED
True
__ne__(b)

Inequality operator for func_attrs .

Parameters:b (func_attrs) – The func_attrs object to compare against.
Return type:bool
Returns:False if self and b compare equal, True otherwise.
>>> func_attrs.TEMPLATE != func_attrs.DESTRUCTOR
True
__or__(b)

OR operator for func_attrs .

Parameters:b (func_attrs) – OR operand.
Return type:func_attrs
Returns:A func_attrs object containing all flags that are in at least one of self, b.
>>> func_attrs.LIBRARY | func_attrs.CONSTRUCTOR
<cs.func_attrs library|constructor>
__repr__()

Get a representation of a func_attrs object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> repr(func_attrs.INLINE_FUNCTION)
'<cs.func_attrs inline>'
__str__()

Get a simple string representation of a func_attrs object.

Return type:str
Returns:The string representation.
>>> str(func_attrs.CS_GENERATED)
'cs-generated'
as_integer()

Get an integer representation of self.

Return type:int
Returns:An integer suitable for use with func_attrs.from_integer().

Invariant: For func_attrs x, func_attrs.from_integer(x.as_integer()) == x

>>> fa = (func_attrs.WEAK|func_attrs.MAIN).as_integer()
>>> fa
8193
>>> func_attrs.from_integer(fa)
<cs.func_attrs weak|main>
name()

Get the name of a func_attrs object.

Return type:str
>>> func_attrs.ASSIGNMENT_OPERATOR.name()
'assignment-operator'
ASSIGNMENT_OPERATOR

Singleton set containing the “assignment operator” flag: the function is an operator= overload.

>>> func_attrs.ASSIGNMENT_OPERATOR
<cs.func_attrs assignment-operator>
COMPILER_GENERATED

Singleton set containing the “compiler-generated” flag: the function is synthesized by the compiler; its definition does not appear in the source code.

>>> func_attrs.COMPILER_GENERATED
<cs.func_attrs compiler-generated>
CONSTRUCTOR

Singleton set containing the “constructor” flag: the function is a constructor.

>>> func_attrs.CONSTRUCTOR
<cs.func_attrs constructor>
CSONAR_LIBRARY_REFINE

Singleton set containing the “CodeSonar library refine” flag: 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.

>>> func_attrs.CSONAR_LIBRARY_REFINE
<cs.func_attrs csonar-library-refine>
CS_GENERATED

Singleton set containing the “CS-generated” flag: the function is synthesized by CodeSonar/CodeSurfer.

>>> func_attrs.CS_GENERATED
<cs.func_attrs cs-generated>
DECLARED_STATIC

Singleton set containing the “declared-static” flag: this was declared with the keyword static.

>>> func_attrs.DECLARED_STATIC
<cs.func_attrs declared-static>
DESTRUCTOR

Singleton set containing the “destructor” flag: the function is a destructor.

>>> func_attrs.DESTRUCTOR
<cs.func_attrs destructor>
FINALIZATION

Singleton set containing the “finalization” flag: the function is declared with __attribute__((destructor)).

>>> func_attrs.FINALIZATION
<cs.func_attrs finalization>
INITIALIZATION

Singleton set containing the “initialization” flag: the function is declared with __attribute__((constructor)) or is a C++/CLI “static constructor”.

>>> func_attrs.INITIALIZATION
<cs.func_attrs initialization>
INLINE_FUNCTION

Singleton set containing the “inline function” flag: the function has inline linkage.

>>> func_attrs.INLINE_FUNCTION
<cs.func_attrs inline>
LIBRARY

Singleton set containing the “library” flag: __CSURF_MARKER_LIBRARY_FUNCTION__ was #define’d to 1 at the definition site of the function.

>>> func_attrs.LIBRARY
<cs.func_attrs library>
MAIN

Singleton set containing the “main” flag: this is a main or WinMain function.

>>> func_attrs.MAIN
<cs.func_attrs main>
METHOD

Singleton set containing the “method” flag: this is a method.

>>> func_attrs.METHOD
<cs.func_attrs method>
MULTI_DEFINE

Singleton set containing the “multi-define” flag: the linkage for this function permits multiple definitions.

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

>>> func_attrs.MULTI_DEFINE
<cs.func_attrs multi-define>
NONE

Empty set: contains no flags.

>>> func_attrs.NONE
<cs.func_attrs none>
TEMPLATE

Singleton set containing the “template” flag: the function is the result of a template instantiation.

>>> func_attrs.TEMPLATE
<cs.func_attrs template>
WEAK

Singleton set containing the “weak” flag: the function has weak linkage (e.g., __attribute__((weak))).

>>> func_attrs.WEAK
<cs.func_attrs weak>