From 290374ed95c31744ded99280af99bb1f2ec5a37f Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 17 Oct 2025 10:20:44 -0400 Subject: Add Type::SetIgnored API --- binaryninjaapi.h | 5 +++++ binaryninjacore.h | 1 + type.cpp | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index ecdeabdf..90ee2585 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -10348,6 +10348,11 @@ namespace BinaryNinja { Ref Duplicate() const; + /*! Call this with setIgnored=True if this Type object is expected to be always resident. + * This prevents the type object from showing up in the results of GetMemoryUsageInfo + */ + Type* SetIgnored(bool setIgnored); + /*! Create a "void" type diff --git a/binaryninjacore.h b/binaryninjacore.h index 3e34662c..f19d57d5 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -6799,6 +6799,7 @@ extern "C" BINARYNINJACOREAPI char* BNGetTypeAndName(BNType* type, BNQualifiedName* name, BNTokenEscapingType escaping); BINARYNINJACOREAPI void BNFreeType(BNType* type); BINARYNINJACOREAPI void BNFreeTypeList(BNType** types, size_t count); + BINARYNINJACOREAPI BNType* BNTypeSetIgnored(BNType* type, bool ignored); BINARYNINJACOREAPI BNTypeBuilder* BNCreateTypeBuilderFromType(BNType* type); BINARYNINJACOREAPI BNTypeBuilder* BNCreateVoidTypeBuilder(void); diff --git a/type.cpp b/type.cpp index 6ee0e1cb..8739055e 100644 --- a/type.cpp +++ b/type.cpp @@ -793,6 +793,8 @@ string Type::GetTypeAndName(const QualifiedName& nameList, BNTokenEscapingType e return outName; } + + string Type::GetStringBeforeName(Platform* platform, BNTokenEscapingType escaping) const { char* str = BNGetTypeStringBeforeName(m_object, platform ? platform->GetObject() : nullptr, escaping); @@ -846,6 +848,13 @@ Ref Type::Duplicate() const } +Type* Type::SetIgnored(bool setIgnored) +{ + BNTypeSetIgnored(m_object, setIgnored); + return this; +} + + Ref Type::VoidType() { return new Type(BNCreateVoidType()); -- cgit v1.3.1