summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2023-07-06 13:40:52 -0400
committerGlenn Smith <glenn@vector35.com>2023-07-07 17:42:18 -0400
commit7598688466960427890036590239565364310171 (patch)
tree1c8680da5ef239926c9dbd78345c4083aed95aba /rust/src
parent94e476e947cf4cb0734fbd0563286e8443c75b96 (diff)
Expose function "pure" flag to api and typesystem
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/types.rs28
1 files changed, 28 insertions, 0 deletions
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<T: Into<Conf<bool>>>(&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<T: Into<Conf<bool>>>(&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<T: Into<Conf<bool>>>(&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<bool> {
+ unsafe { BNFunctionTypeBuilderCanReturn(self.handle).into() }
+ }
+
+ pub fn pure(&self) -> Conf<bool> {
+ unsafe { BNIsTypeBuilderPure(self.handle).into() }
+ }
+
pub fn get_structure(&self) -> Result<Ref<Structure>> {
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<bool> {
+ unsafe { BNIsTypePure(self.handle).into() }
+ }
+
pub fn get_structure(&self) -> Result<Ref<Structure>> {
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,
))
}
}