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 /mediumlevelilinstruction.h | |
| 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 'mediumlevelilinstruction.h')
| -rw-r--r-- | mediumlevelilinstruction.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h index b3965a63..97e44a81 100644 --- a/mediumlevelilinstruction.h +++ b/mediumlevelilinstruction.h @@ -20,9 +20,6 @@ #pragma once -#include <functional> -#include <unordered_map> -#include <vector> #ifdef BINARYNINJACORE_LIBRARY #include "constantdata.h" #include "variable.h" @@ -31,6 +28,11 @@ #include "binaryninjaapi.h" #endif +#include "base/function_ref.h" + +#include <unordered_map> +#include <vector> + #ifdef BINARYNINJACORE_LIBRARY namespace BinaryNinjaCore #else @@ -617,11 +619,11 @@ namespace BinaryNinja MediumLevelILFunction* func, const BNMediumLevelILInstruction& instr, size_t expr, size_t instrIdx); MediumLevelILInstruction(const MediumLevelILInstructionBase& instr); - void VisitExprs(const std::function<bool(const MediumLevelILInstruction& expr)>& func) const; + void VisitExprs(bn::base::function_ref<bool(const MediumLevelILInstruction& expr)> func) const; ExprId CopyTo(MediumLevelILFunction* dest, const ILSourceLocation& sourceLocation = {}) const; ExprId CopyTo(MediumLevelILFunction* dest, - const std::function<ExprId(const MediumLevelILInstruction& subExpr)>& subExprHandler, + bn::base::function_ref<ExprId(const MediumLevelILInstruction& subExpr)> subExprHandler, const ILSourceLocation& sourceLocation = {}) const; // Templated accessors for instruction operands, use these for efficient access to a known instruction |
