From 7598688466960427890036590239565364310171 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 6 Jul 2023 13:40:52 -0400 Subject: Expose function "pure" flag to api and typesystem --- binaryninjaapi.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index a06d4bf7..ef47dc23 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -7272,6 +7272,12 @@ namespace BinaryNinja { */ Confidence CanReturn() const; + /*! For Function Types, whether a function is pure (has no observable side-effects) + + \return Whether the function is pure + */ + Confidence IsPure() const; + /*! For Structure Types, the underlying Structure \return The underlying structure @@ -7472,7 +7478,8 @@ namespace BinaryNinja { const Confidence& stackAdjust, const std::map>& regStackAdjust = std::map>(), const Confidence>& returnRegs = Confidence>(std::vector(), 0), - BNNameType ft = NoNameType); + BNNameType ft = NoNameType, + const Confidence& pure = Confidence(false, 0)); static std::string GenerateAutoTypeId(const std::string& source, const QualifiedName& name); static std::string GenerateAutoDemangledTypeId(const QualifiedName& name); @@ -7661,6 +7668,7 @@ namespace BinaryNinja { std::vector GetParameters() const; Confidence HasVariableArguments() const; Confidence CanReturn() const; + Confidence IsPure() const; Ref GetStructure() const; Ref GetEnumeration() const; Ref GetNamedTypeReference() const; @@ -7683,6 +7691,7 @@ namespace BinaryNinja { TypeBuilder& SetOffset(uint64_t offset); TypeBuilder& SetFunctionCanReturn(const Confidence& canReturn); + TypeBuilder& SetPure(const Confidence& pure); TypeBuilder& SetParameters(const std::vector& params); std::string GetString(Platform* platform = nullptr) const; @@ -7736,7 +7745,8 @@ namespace BinaryNinja { const Confidence& stackAdjust, const std::map>& regStackAdjust = std::map>(), const Confidence>& returnRegs = Confidence>(std::vector(), 0), - BNNameType ft = NoNameType); + BNNameType ft = NoNameType, + const Confidence& pure = Confidence(false, 0)); bool IsReferenceOfType(BNNamedTypeReferenceClass refType); bool IsStructReference() { return IsReferenceOfType(StructNamedTypeClass); } @@ -8959,6 +8969,12 @@ namespace BinaryNinja { */ Confidence CanReturn() const; + /*! Whether this function is pure + + \return Whether this function is pure + */ + Confidence IsPure() const; + /*! Whether this function has an explicitly defined type \return Whether this function has an explicitly defined type @@ -9233,6 +9249,7 @@ namespace BinaryNinja { void SetAutoParameterVariables(const Confidence>& vars); void SetAutoHasVariableArguments(const Confidence& varArgs); void SetAutoCanReturn(const Confidence& returns); + void SetAutoPure(const Confidence& pure); void SetAutoStackAdjustment(const Confidence& stackAdjust); void SetAutoRegisterStackAdjustments(const std::map>& regStackAdjust); void SetAutoClobberedRegisters(const Confidence>& clobbered); @@ -9244,6 +9261,7 @@ namespace BinaryNinja { void SetParameterVariables(const Confidence>& vars); void SetHasVariableArguments(const Confidence& varArgs); void SetCanReturn(const Confidence& returns); + void SetPure(const Confidence& pure); void SetStackAdjustment(const Confidence& stackAdjust); void SetRegisterStackAdjustments(const std::map>& regStackAdjust); void SetClobberedRegisters(const Confidence>& clobbered); -- cgit v1.3.1