diff options
| author | Glenn Smith <glenn@vector35.com> | 2023-07-06 13:40:52 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2023-07-07 17:42:18 -0400 |
| commit | 7598688466960427890036590239565364310171 (patch) | |
| tree | 1c8680da5ef239926c9dbd78345c4083aed95aba /python/function.py | |
| parent | 94e476e947cf4cb0734fbd0563286e8443c75b96 (diff) | |
Expose function "pure" flag to api and typesystem
Diffstat (limited to 'python/function.py')
| -rw-r--r-- | python/function.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py index 42e5ea44..97655e41 100644 --- a/python/function.py +++ b/python/function.py @@ -546,6 +546,22 @@ class Function: core.BNSetUserFunctionCanReturn(self.handle, bc) @property + def is_pure(self) -> 'types.BoolWithConfidence': + """Whether function is pure""" + result = core.BNIsFunctionPure(self.handle) + return types.BoolWithConfidence(result.value, confidence=result.confidence) + + @is_pure.setter + def is_pure(self, value: 'types.BoolWithConfidence') -> None: + bc = core.BNBoolWithConfidence() + bc.value = bool(value) + if hasattr(value, 'confidence'): + bc.confidence = value.confidence + else: + bc.confidence = core.max_confidence + core.BNSetUserFunctionPure(self.handle, bc) + + @property @deprecation.deprecated(deprecated_in="3.4.4049", details="Use Function.has_explicitly_defined_type instead.") def explicitly_defined_type(self) -> bool: """Whether function has explicitly defined types (read-only)""" @@ -2592,6 +2608,15 @@ class Function: bc.confidence = core.max_confidence core.BNSetAutoFunctionCanReturn(self.handle, bc) + def set_auto_pure(self, value: Union[bool, 'types.BoolWithConfidence']) -> None: + bc = core.BNBoolWithConfidence() + bc.value = bool(value) + if isinstance(value, types.BoolWithConfidence): + bc.confidence = value.confidence + else: + bc.confidence = core.max_confidence + core.BNSetAutoFunctionPure(self.handle, bc) + def set_auto_stack_adjustment(self, value: Union[int, 'types.OffsetWithConfidence']) -> None: oc = core.BNOffsetWithConfidence() oc.value = int(value) |
