summaryrefslogtreecommitdiff
path: root/lowlevelilinstruction.h
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-12-10 15:20:25 -0800
committerMark Rowe <mark@vector35.com>2025-12-15 20:25:23 -0800
commit95b849d05d05ae9e55eb839508536d5af314d331 (patch)
treef06fc6ea5c13cc4972fe8b9fdd5c30d94779b045 /lowlevelilinstruction.h
parent2f1150703636b2b06d84bb66853fce7382bf6f29 (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 'lowlevelilinstruction.h')
-rw-r--r--lowlevelilinstruction.h12
1 files changed, 7 insertions, 5 deletions
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 <functional>
-#include <unordered_map>
-#include <vector>
#ifdef BINARYNINJACORE_LIBRARY
#include "ilsourcelocation.h"
#include "type.h"
@@ -30,6 +27,11 @@
#include "binaryninjaapi.h"
#endif
+#include "base/function_ref.h"
+
+#include <unordered_map>
+#include <vector>
+
#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<bool(const LowLevelILInstruction& expr)>& func) const;
+ void VisitExprs(bn::base::function_ref<bool(const LowLevelILInstruction& expr)> func) const;
ExprId CopyTo(LowLevelILFunction* dest, const ILSourceLocation& sourceLocation = {}) const;
ExprId CopyTo(LowLevelILFunction* dest,
- const std::function<ExprId(const LowLevelILInstruction& subExpr)>& subExprHandler,
+ bn::base::function_ref<ExprId(const LowLevelILInstruction& subExpr)> subExprHandler,
const ILSourceLocation& sourceLocation = {}) const;
// Templated accessors for instruction operands, use these for efficient access to a known instruction