summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-02-16 19:12:43 -0500
committerRusty Wagner <rusty@vector35.com>2017-02-16 19:18:55 -0500
commit57c08987ee10af0b52d5c3fd44739a3935f9efa7 (patch)
tree248c70d5d1891855c8947d0c6bb395c00d063079 /binaryninjaapi.h
parent6ac3ea169e980b86c45c017892ef8a76fe5fb95d (diff)
Basic blocks have incoming and outgoing edges with basic block references, use core object identity for equality
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h42
1 files changed, 38 insertions, 4 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 370a9ae2..7004501c 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -51,6 +51,8 @@ namespace BinaryNinja
RefCountObject(): m_refs(0) {}
virtual ~RefCountObject() {}
+ RefCountObject* GetObject() { return this; }
+
void AddRef()
{
#ifdef WIN32
@@ -101,7 +103,7 @@ namespace BinaryNinja
CoreRefCountObject(): m_refs(0), m_object(nullptr) {}
virtual ~CoreRefCountObject() {}
- T* GetObject() { return m_object; }
+ T* GetObject() const { return m_object; }
void AddRef()
{
@@ -158,7 +160,7 @@ namespace BinaryNinja
StaticCoreRefCountObject(): m_refs(0), m_object(nullptr) {}
virtual ~StaticCoreRefCountObject() {}
- T* GetObject() { return m_object; }
+ T* GetObject() const { return m_object; }
void AddRef()
{
@@ -246,6 +248,36 @@ namespace BinaryNinja
return m_obj == NULL;
}
+ bool operator==(const T* obj) const
+ {
+ return m_obj->GetObject() == obj->GetObject();
+ }
+
+ bool operator==(const Ref<T>& obj) const
+ {
+ return m_obj->GetObject() == obj.m_obj->GetObject();
+ }
+
+ bool operator!=(const T* obj) const
+ {
+ return m_obj->GetObject() != obj->GetObject();
+ }
+
+ bool operator!=(const Ref<T>& obj) const
+ {
+ return m_obj->GetObject() != obj.m_obj->GetObject();
+ }
+
+ bool operator<(const T* obj) const
+ {
+ return m_obj->GetObject() < obj->GetObject();
+ }
+
+ bool operator<(const Ref<T>& obj) const
+ {
+ return m_obj->GetObject() < obj.m_obj->GetObject();
+ }
+
T* GetPtr() const
{
return m_obj;
@@ -1728,8 +1760,7 @@ namespace BinaryNinja
struct BasicBlockEdge
{
BNBranchType type;
- uint64_t target;
- Ref<Architecture> arch;
+ Ref<BasicBlock> target;
};
class BasicBlock: public CoreRefCountObject<BNBasicBlock, BNNewBasicBlockReference, BNFreeBasicBlock>
@@ -1744,7 +1775,10 @@ namespace BinaryNinja
uint64_t GetEnd() const;
uint64_t GetLength() const;
+ size_t GetIndex() const;
+
std::vector<BasicBlockEdge> GetOutgoingEdges() const;
+ std::vector<BasicBlockEdge> GetIncomingEdges() const;
bool HasUndeterminedOutgoingEdges() const;
void MarkRecentUse();