summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-09-26 01:33:07 -0400
committerGlenn Smith <glenn@vector35.com>2024-10-14 16:59:09 -0400
commit2161816481322887864999289688022906323855 (patch)
tree0b8ab579b7b288af71dbbf446fc54a9142c5236b
parent8747681904104688158650354128100257896501 (diff)
Add various missing Type/TypeBuilder getters and settersa
-rw-r--r--binaryninjaapi.h15
-rw-r--r--binaryninjacore.h5
-rw-r--r--type.cpp35
3 files changed, 55 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 7bbd2d48..04d8bd6d 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -8721,6 +8721,12 @@ namespace BinaryNinja {
*/
Confidence<Ref<CallingConvention>> GetCallingConvention() const;
+ /*! For Function Types, get the calling convention name
+
+ \return The calling convention name
+ */
+ BNCallingConventionName GetCallingConventionName() const;
+
/*! For Function Types, get a list of parameters
\return A vector of FunctionParameters
@@ -8733,6 +8739,12 @@ namespace BinaryNinja {
*/
Confidence<bool> HasVariableArguments() const;
+ /*! Has no effect currently, just used by the demangler
+
+ \return If the type has the "has template arguments" flag set
+ */
+ bool HasTemplateArguments() const;
+
/*! For Function Types, whether a function can return (is not marked noreturn)
\return Whether the function can return
@@ -9142,6 +9154,7 @@ namespace BinaryNinja {
Confidence<Ref<Type>> GetChildType() const;
Confidence<Ref<CallingConvention>> GetCallingConvention() const;
+ BNCallingConventionName GetCallingConventionName() const;
std::vector<FunctionParameter> GetParameters() const;
Confidence<bool> HasVariableArguments() const;
Confidence<bool> CanReturn() const;
@@ -9159,6 +9172,8 @@ namespace BinaryNinja {
TypeBuilder& SetConst(const Confidence<bool>& cnst);
TypeBuilder& SetVolatile(const Confidence<bool>& vltl);
TypeBuilder& SetChildType(const Confidence<Ref<Type>>& child);
+ TypeBuilder& SetCallingConvention(const Confidence<Ref<CallingConvention>>& cc);
+ TypeBuilder& SetCallingConventionName(BNCallingConventionName cc);
TypeBuilder& SetSigned(const Confidence<bool>& vltl);
TypeBuilder& SetTypeName(const QualifiedName& name);
TypeBuilder& SetAlternateName(const std::string& name);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index a80f0a20..45c06e4d 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -5966,9 +5966,11 @@ extern "C"
BINARYNINJACOREAPI bool BNIsTypeFloatingPoint(BNType* type);
BINARYNINJACOREAPI BNTypeWithConfidence BNGetChildType(BNType* type);
BINARYNINJACOREAPI BNCallingConventionWithConfidence BNGetTypeCallingConvention(BNType* type);
+ BINARYNINJACOREAPI BNCallingConventionName BNGetTypeCallingConventionName(BNType* type);
BINARYNINJACOREAPI BNFunctionParameter* BNGetTypeParameters(BNType* type, size_t* count);
BINARYNINJACOREAPI void BNFreeTypeParameterList(BNFunctionParameter* types, size_t count);
BINARYNINJACOREAPI BNBoolWithConfidence BNTypeHasVariableArguments(BNType* type);
+ BINARYNINJACOREAPI bool BNTypeHasTemplateArguments(BNType* type);
BINARYNINJACOREAPI BNBoolWithConfidence BNFunctionTypeCanReturn(BNType* type);
BINARYNINJACOREAPI BNBoolWithConfidence BNIsTypePure(BNType* type);
BINARYNINJACOREAPI BNStructure* BNGetTypeStructure(BNType* type);
@@ -6023,6 +6025,7 @@ extern "C"
BINARYNINJACOREAPI bool BNIsTypeBuilderFloatingPoint(BNTypeBuilder* type);
BINARYNINJACOREAPI BNTypeWithConfidence BNGetTypeBuilderChildType(BNTypeBuilder* type);
BINARYNINJACOREAPI BNCallingConventionWithConfidence BNGetTypeBuilderCallingConvention(BNTypeBuilder* type);
+ BINARYNINJACOREAPI BNCallingConventionName BNGetTypeBuilderCallingConventionName(BNTypeBuilder* type);
BINARYNINJACOREAPI BNFunctionParameter* BNGetTypeBuilderParameters(BNTypeBuilder* type, size_t* count);
BINARYNINJACOREAPI BNBoolWithConfidence BNTypeBuilderHasVariableArguments(BNTypeBuilder* type);
BINARYNINJACOREAPI BNBoolWithConfidence BNFunctionTypeBuilderCanReturn(BNTypeBuilder* type);
@@ -6045,6 +6048,8 @@ extern "C"
BINARYNINJACOREAPI void BNTypeBuilderSetVolatile(BNTypeBuilder* type, BNBoolWithConfidence* vltl);
BINARYNINJACOREAPI void BNTypeBuilderSetSigned(BNTypeBuilder* type, BNBoolWithConfidence* sign);
BINARYNINJACOREAPI void BNTypeBuilderSetChildType(BNTypeBuilder* type, BNTypeWithConfidence* child);
+ BINARYNINJACOREAPI void BNTypeBuilderSetCallingConvention(BNTypeBuilder* type, BNCallingConventionWithConfidence* cc);
+ BINARYNINJACOREAPI void BNTypeBuilderSetCallingConventionName(BNTypeBuilder* type, BNCallingConventionName cc);
BINARYNINJACOREAPI BNOffsetWithConfidence BNGetTypeBuilderStackAdjustment(BNTypeBuilder* type);
BINARYNINJACOREAPI BNQualifiedName BNTypeBuilderGetStructureName(BNTypeBuilder* type);
BINARYNINJACOREAPI BNReferenceType BNTypeBuilderGetReferenceType(BNTypeBuilder* type);
diff --git a/type.cpp b/type.cpp
index 42ef40b9..45e20463 100644
--- a/type.cpp
+++ b/type.cpp
@@ -602,6 +602,12 @@ Confidence<Ref<CallingConvention>> Type::GetCallingConvention() const
}
+BNCallingConventionName Type::GetCallingConventionName() const
+{
+ return BNGetTypeCallingConventionName(m_object);
+}
+
+
vector<FunctionParameter> Type::GetParameters() const
{
size_t count;
@@ -633,6 +639,12 @@ Confidence<bool> Type::HasVariableArguments() const
}
+bool Type::HasTemplateArguments() const
+{
+ return BNTypeHasTemplateArguments(m_object);
+}
+
+
Confidence<bool> Type::CanReturn() const
{
BNBoolWithConfidence result = BNFunctionTypeCanReturn(m_object);
@@ -1491,6 +1503,23 @@ TypeBuilder& TypeBuilder::SetChildType(const Confidence<Ref<Type>>& child)
}
+TypeBuilder& TypeBuilder::SetCallingConvention(const Confidence<Ref<CallingConvention>>& cc)
+{
+ BNCallingConventionWithConfidence ccwc;
+ ccwc.convention = cc->GetObject();
+ ccwc.confidence = cc.GetConfidence();
+ BNTypeBuilderSetCallingConvention(m_object, &ccwc);
+ return *this;
+}
+
+
+TypeBuilder& TypeBuilder::SetCallingConventionName(BNCallingConventionName cc)
+{
+ BNTypeBuilderSetCallingConventionName(m_object, cc);
+ return *this;
+}
+
+
Confidence<Ref<CallingConvention>> TypeBuilder::GetCallingConvention() const
{
BNCallingConventionWithConfidence cc = BNGetTypeBuilderCallingConvention(m_object);
@@ -1500,6 +1529,12 @@ Confidence<Ref<CallingConvention>> TypeBuilder::GetCallingConvention() const
}
+BNCallingConventionName TypeBuilder::GetCallingConventionName() const
+{
+ return BNGetTypeBuilderCallingConventionName(m_object);
+}
+
+
vector<FunctionParameter> TypeBuilder::GetParameters() const
{
size_t count;