diff options
Diffstat (limited to 'rust/src/low_level_il/instruction.rs')
| -rw-r--r-- | rust/src/low_level_il/instruction.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/src/low_level_il/instruction.rs b/rust/src/low_level_il/instruction.rs index ba8184e4..652706ea 100644 --- a/rust/src/low_level_il/instruction.rs +++ b/rust/src/low_level_il/instruction.rs @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::basic_block::BasicBlock; +use crate::rc::Ref; + +use super::block::LowLevelILBlock; use super::operation; use super::operation::Operation; use super::VisitorAction; @@ -99,6 +103,12 @@ where pub fn into_raw(&self) -> BNLowLevelILInstruction { unsafe { BNGetLowLevelILByIndex(self.function.handle, self.expr_idx().0) } } + + /// Returns the [`BasicBlock`] containing the given [`LowLevelILInstruction`]. + pub fn basic_block(&self) -> Option<Ref<BasicBlock<LowLevelILBlock<'func, M, F>>>> { + // TODO: We might be able to .expect this if we guarantee that self.index is valid. + self.function.basic_block_containing_index(self.index) + } } impl<'func, M> LowLevelILInstruction<'func, M, NonSSA> |
