diff options
| author | Mark Rowe <mark@vector35.com> | 2025-12-10 15:20:25 -0800 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-12-15 20:25:23 -0800 |
| commit | 95b849d05d05ae9e55eb839508536d5af314d331 (patch) | |
| tree | f06fc6ea5c13cc4972fe8b9fdd5c30d94779b045 /highlevelilinstruction.cpp | |
| parent | 2f1150703636b2b06d84bb66853fce7382bf6f29 (diff) | |
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.
Diffstat (limited to 'highlevelilinstruction.cpp')
| -rw-r--r-- | highlevelilinstruction.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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<size_t>& toProcess) const } -void HighLevelILInstruction::VisitExprs(const std::function<bool(const HighLevelILInstruction& expr)>& func) const +void HighLevelILInstruction::VisitExprs(bn::base::function_ref<bool(const HighLevelILInstruction& expr)> func) const { stack<size_t> toProcess; toProcess.push(exprIndex); @@ -1357,8 +1357,8 @@ void HighLevelILInstruction::VisitExprs(const std::function<bool(const HighLevel } -void HighLevelILInstruction::VisitExprs(const std::function<bool(const HighLevelILInstruction& expr)>& preFunc, - const std::function<void(const HighLevelILInstruction& expr)>& postFunc) const +void HighLevelILInstruction::VisitExprs(bn::base::function_ref<bool(const HighLevelILInstruction& expr)> preFunc, + bn::base::function_ref<void(const HighLevelILInstruction& expr)> postFunc) const { stack<std::pair<HighLevelILInstruction, stack<size_t>>> toProcess; HighLevelILInstruction cur = *this; @@ -1404,7 +1404,7 @@ ExprId HighLevelILInstruction::CopyTo(HighLevelILFunction* dest, const ILSourceL ExprId HighLevelILInstruction::CopyTo( - HighLevelILFunction* dest, const std::function<ExprId(const HighLevelILInstruction& subExpr)>& subExprHandler, const ILSourceLocation& sourceLocation) const + HighLevelILFunction* dest, bn::base::function_ref<ExprId(const HighLevelILInstruction& subExpr)> subExprHandler, const ILSourceLocation& sourceLocation) const { vector<ExprId> output, params; |
