@@ -4,11 +4,10 @@ use std::ffi::CStr;
44use binaryninjacore_sys:: * ;
55
66use crate :: architecture:: CoreArchitecture ;
7- use crate :: binary_view:: BinaryViewExt ;
87use crate :: high_level_il:: HighLevelILFunction ;
9- use crate :: low_level_il:: function :: { Finalized , LowLevelILFunction , NonSSA , RegularNonSSA } ;
8+ use crate :: low_level_il:: RegularLowLevelILFunction ;
109use crate :: medium_level_il:: MediumLevelILFunction ;
11- use crate :: rc:: { Array , CoreArrayProvider , CoreArrayProviderInner } ;
10+ use crate :: rc:: { Array , CoreArrayProvider , CoreArrayProviderInner , Ref } ;
1211use crate :: string:: BnStrCompatible ;
1312use crate :: { BinaryView , Function } ;
1413
@@ -217,20 +216,19 @@ define_enum! {
217216 } ,
218217 BNGetValidPluginCommandsForLowLevelILFunction , BNRegisterPluginCommandForLowLevelILFunction , LowLevelILFunctionPluginCommand , CustomLowLevelILFunctionPluginCommand {
219218 lowLevelILFunctionCommand:: lowLevelILFunctionIsValid(
220- // TODO I don't know what Generics should be used here
221- func: * mut BNLowLevelILFunction : & LowLevelILFunction <CoreArchitecture , Finalized , NonSSA <RegularNonSSA >> =
222- func. handle => & LowLevelILFunction :: from_raw(
223- BinaryView :: from_raw( view) . default_arch( ) . unwrap( ) ,
224- func,
219+ llil: * mut BNLowLevelILFunction : & RegularLowLevelILFunction <CoreArchitecture > =
220+ llil. handle => & RegularLowLevelILFunction :: from_raw(
221+ get_function_from_llil( llil) . arch( ) ,
222+ llil,
225223 ) ,
226224 ) ,
227225 } ,
228226 BNGetValidPluginCommandsForLowLevelILInstruction , BNRegisterPluginCommandForLowLevelILInstruction , LowLevelILInstructionPluginCommand , CustomLowLevelILInstructionPluginCommand {
229227 lowLevelILInstructionCommand:: lowLevelILInstructionIsValid(
230- func : * mut BNLowLevelILFunction : & LowLevelILFunction <CoreArchitecture , Finalized , NonSSA < RegularNonSSA > > =
231- func . handle => & LowLevelILFunction :: from_raw(
232- BinaryView :: from_raw ( view ) . default_arch ( ) . unwrap ( ) ,
233- func ,
228+ llil : * mut BNLowLevelILFunction : & RegularLowLevelILFunction <CoreArchitecture > =
229+ llil . handle => & RegularLowLevelILFunction :: from_raw(
230+ get_function_from_llil ( llil ) . arch ( ) ,
231+ llil ,
234232 ) ,
235233 instr: usize : usize = instr => instr,
236234 ) ,
@@ -259,3 +257,9 @@ define_enum! {
259257 ) ,
260258 } ,
261259}
260+
261+ // TODO merge this into the low_level_il module
262+ unsafe fn get_function_from_llil ( llil : * mut BNLowLevelILFunction ) -> Ref < Function > {
263+ let func = BNGetLowLevelILOwnerFunction ( llil) ;
264+ Function :: ref_from_raw ( func)
265+ }
0 commit comments