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 --- rust/src/types.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'rust/src') diff --git a/rust/src/types.rs b/rust/src/types.rs index c899b474..717972b9 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -323,6 +323,18 @@ impl TypeBuilder { // Settable properties + pub fn set_can_return>>(&self, value: T) -> &Self { + let mut bool_with_confidence = value.into().into(); + unsafe { BNSetFunctionTypeBuilderCanReturn(self.handle, &mut bool_with_confidence) }; + self + } + + pub fn set_pure>>(&self, value: T) -> &Self { + let mut bool_with_confidence = value.into().into(); + unsafe { BNSetTypeBuilderPure(self.handle, &mut bool_with_confidence) }; + self + } + pub fn set_const>>(&self, value: T) -> &Self { let mut bool_with_confidence = value.into().into(); unsafe { BNTypeBuilderSetConst(self.handle, &mut bool_with_confidence) }; @@ -426,6 +438,14 @@ impl TypeBuilder { unsafe { BNTypeBuilderHasVariableArguments(self.handle).into() } } + pub fn can_return(&self) -> Conf { + unsafe { BNFunctionTypeBuilderCanReturn(self.handle).into() } + } + + pub fn pure(&self) -> Conf { + unsafe { BNIsTypeBuilderPure(self.handle).into() } + } + pub fn get_structure(&self) -> Result> { let result = unsafe { BNGetTypeBuilderStructure(self.handle) }; if result.is_null() { @@ -794,6 +814,10 @@ impl Type { unsafe { BNFunctionTypeCanReturn(self.handle).into() } } + pub fn pure(&self) -> Conf { + unsafe { BNIsTypePure(self.handle).into() } + } + pub fn get_structure(&self) -> Result> { let result = unsafe { BNGetTypeStructure(self.handle) }; if result.is_null() { @@ -969,6 +993,7 @@ impl Type { let mut return_type = return_type.into().into(); let mut variable_arguments = Conf::new(variable_arguments, max_confidence()).into(); let mut can_return = Conf::new(true, min_confidence()).into(); + let mut pure = Conf::new(false, min_confidence()).into(); let mut raw_calling_convention: BNCallingConventionWithConfidence = BNCallingConventionWithConfidence { @@ -1018,6 +1043,7 @@ impl Type { 0, &mut return_regs, BNNameType::NoNameType, + &mut pure, ))) } } @@ -1038,6 +1064,7 @@ impl Type { let mut return_type = return_type.into().into(); let mut variable_arguments = Conf::new(variable_arguments, max_confidence()).into(); let mut can_return = Conf::new(true, min_confidence()).into(); + let mut pure = Conf::new(false, min_confidence()).into(); let mut raw_calling_convention: BNCallingConventionWithConfidence = calling_convention.into().into(); let mut stack_adjust = stack_adjust.into(); @@ -1090,6 +1117,7 @@ impl Type { 0, &mut return_regs, BNNameType::NoNameType, + &mut pure, )) } } -- cgit v1.3.1