Skip to content

Commit 795b622

Browse files
committed
Expose auto-discovered param for function creation in Rust API
1 parent c0813b6 commit 795b622

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

rust/src/binary_view.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,17 +1262,22 @@ pub trait BinaryViewExt: BinaryViewBase {
12621262
address: u64,
12631263
platform: &Platform,
12641264
) -> Option<Ref<Function>> {
1265-
self.add_auto_function_ext(address, platform, None)
1265+
self.add_auto_function_ext(address, platform, None, false)
12661266
}
12671267

12681268
/// Add an auto function at the given `address` with the `platform` and function type.
12691269
///
1270+
/// The `auto_discovered` flag is used to prevent or allow this created function to be deleted if
1271+
/// it is never used (the function has no xrefs), if you are confident that this is a valid function
1272+
/// set this to `false`.
1273+
///
12701274
/// NOTE: If the view's default platform is not set, this will set it to `platform`.
12711275
fn add_auto_function_ext(
12721276
&self,
12731277
address: u64,
12741278
platform: &Platform,
12751279
func_type: Option<&Type>,
1280+
auto_discovered: bool,
12761281
) -> Option<Ref<Function>> {
12771282
unsafe {
12781283
let func_type = match func_type {
@@ -1284,7 +1289,7 @@ pub trait BinaryViewExt: BinaryViewBase {
12841289
self.as_ref().handle,
12851290
platform.handle,
12861291
address,
1287-
true,
1292+
auto_discovered,
12881293
func_type,
12891294
);
12901295

0 commit comments

Comments
 (0)