From 7598688466960427890036590239565364310171 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 6 Jul 2023 13:40:52 -0400 Subject: Expose function "pure" flag to api and typesystem --- python/function.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'python/function.py') diff --git a/python/function.py b/python/function.py index 42e5ea44..97655e41 100644 --- a/python/function.py +++ b/python/function.py @@ -545,6 +545,22 @@ class Function: bc.confidence = core.max_confidence 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: @@ -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) -- cgit v1.3.1