From 95b849d05d05ae9e55eb839508536d5af314d331 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Wed, 10 Dec 2025 15:20:25 -0800 Subject: Use bn::base::function_ref instead of std::function for parameters that are not stored This avoids the overhead of constructing a `std::function`, which may require a heap allocation, when calling functions that immediately invokes a function object. --- lowlevelilinstruction.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lowlevelilinstruction.h') diff --git a/lowlevelilinstruction.h b/lowlevelilinstruction.h index 37d0d30a..da2de8dc 100644 --- a/lowlevelilinstruction.h +++ b/lowlevelilinstruction.h @@ -20,9 +20,6 @@ #pragma once -#include -#include -#include #ifdef BINARYNINJACORE_LIBRARY #include "ilsourcelocation.h" #include "type.h" @@ -30,6 +27,11 @@ #include "binaryninjaapi.h" #endif +#include "base/function_ref.h" + +#include +#include + #ifdef BINARYNINJACORE_LIBRARY namespace BinaryNinjaCore #else @@ -866,11 +868,11 @@ namespace BinaryNinja LowLevelILFunction* func, const BNLowLevelILInstruction& instr, size_t expr, size_t instrIdx); LowLevelILInstruction(const LowLevelILInstructionBase& instr); - void VisitExprs(const std::function& func) const; + void VisitExprs(bn::base::function_ref func) const; ExprId CopyTo(LowLevelILFunction* dest, const ILSourceLocation& sourceLocation = {}) const; ExprId CopyTo(LowLevelILFunction* dest, - const std::function& subExprHandler, + bn::base::function_ref subExprHandler, const ILSourceLocation& sourceLocation = {}) const; // Templated accessors for instruction operands, use these for efficient access to a known instruction -- cgit v1.3.1