class var_attrs

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

(Attributes for symbols of kind symbol_kind.FUNCTION are described by objects of class func_attrs .)

var_attrs Details

class cs.var_attrs

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

static from_integer(_inner)

Construct an instance from an integer representation.

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

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

>>> va = (var_attrs.WEAK | var_attrs.THREADLOCAL).as_integer()
>>> va
3
>>> var_attrs.from_integer(va)
<cs.var_attrs weak|threadlocal>
__and__(b)

AND operator for var_attrs .

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

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

Parameters:other (var_attrs) – The var_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
>>> var_attrs.WEAK.__cmp__(var_attrs.THREADLOCAL)
-1
__eq__(b)

Equality operator for var_attrs .

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

Greater-than-or-equal operator for var_attrs .

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

Greater-than operator for var_attrs .

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

Hash function for var_attrs .

Return type:int
>>> hash(var_attrs.NONE)
0
__invert__()

Complementation operator.

Return type:var_attrs
Returns:A var_attrs object containing the flags that are NOT contained in self.
>>> ~var_attrs.WEAK
<cs.var_attrs threadlocal>
__le__(b)

Less-than-or-equal operator for var_attrs .

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

Less-than operator for var_attrs .

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

Inequality operator for var_attrs .

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

OR operator for var_attrs .

Parameters:b (var_attrs) – OR operand.
Return type:var_attrs
Returns:A var_attrs object containing all flags that are in at least one of self, b.
>>> var_attrs.NONE | var_attrs.THREADLOCAL
<cs.var_attrs threadlocal>
__repr__()

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

Return type:str
Returns:The string representation.
>>> repr(var_attrs.WEAK)
'<cs.var_attrs weak>'
__str__()

Get a simple string representation of a var_attrs object.

Return type:str
Returns:The string representation.
>>> str(var_attrs.NONE)
'none'
as_integer()

Get an integer representation of self.

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

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

>>> va = (var_attrs.WEAK | var_attrs.THREADLOCAL).as_integer()
>>> va
3
>>> var_attrs.from_integer(va)
<cs.var_attrs weak|threadlocal>
name()

Get the name of a var_attrs object.

Return type:str
>>> var_attrs.NONE.name()
'none'
NONE

Empty set: contains no flags.

>>> var_attrs.NONE
<cs.var_attrs none>
THREADLOCAL

Singleton set containing the “thread local” flag: the variable has thread-local storage (e.g., __thread).

>>> var_attrs.THREADLOCAL
<cs.var_attrs threadlocal>
WEAK

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

>>> var_attrs.WEAK
<cs.var_attrs weak>