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. --- highlevelilinstruction.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'highlevelilinstruction.cpp') diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp index 55df8d21..37504253 100644 --- a/highlevelilinstruction.cpp +++ b/highlevelilinstruction.cpp @@ -1342,7 +1342,7 @@ void HighLevelILInstruction::CollectSubExprs(stack& toProcess) const } -void HighLevelILInstruction::VisitExprs(const std::function& func) const +void HighLevelILInstruction::VisitExprs(bn::base::function_ref func) const { stack toProcess; toProcess.push(exprIndex); @@ -1357,8 +1357,8 @@ void HighLevelILInstruction::VisitExprs(const std::function& preFunc, - const std::function& postFunc) const +void HighLevelILInstruction::VisitExprs(bn::base::function_ref preFunc, + bn::base::function_ref postFunc) const { stack>> toProcess; HighLevelILInstruction cur = *this; @@ -1404,7 +1404,7 @@ ExprId HighLevelILInstruction::CopyTo(HighLevelILFunction* dest, const ILSourceL ExprId HighLevelILInstruction::CopyTo( - HighLevelILFunction* dest, const std::function& subExprHandler, const ILSourceLocation& sourceLocation) const + HighLevelILFunction* dest, bn::base::function_ref subExprHandler, const ILSourceLocation& sourceLocation) const { vector output, params; -- cgit v1.3.1