summaryrefslogtreecommitdiff
path: root/type.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2017-08-29 20:13:57 -0400
committerRusty Wagner <rusty@vector35.com>2017-08-29 20:15:48 -0400
commit47333ef2460edfa9b5ba5be26fd19f80c0d8d8b6 (patch)
tree65eb1e071548ca49b6dff6866fba922fed004cbe /type.cpp
parent09af54fba214ee5e0baf6a9bacce0ceebbd34deb (diff)
Updating APIs to deal with stack adjustment
Diffstat (limited to 'type.cpp')
-rw-r--r--type.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/type.cpp b/type.cpp
index aa891557..40a69ae2 100644
--- a/type.cpp
+++ b/type.cpp
@@ -425,6 +425,13 @@ uint64_t Type::GetOffset() const
}
+Confidence<size_t> Type::GetStackAdjustment() const
+{
+ BNSizeWithConfidence result = BNGetTypeStackAdjustment(m_object);
+ return Confidence<size_t>(result.value, result.confidence);
+}
+
+
string Type::GetString(Platform* platform) const
{
char* str = BNGetTypeString(m_object, platform ? platform->GetObject() : nullptr);
@@ -663,7 +670,8 @@ Ref<Type> Type::ArrayType(const Confidence<Ref<Type>>& type, uint64_t elem)
Ref<Type> Type::FunctionType(const Confidence<Ref<Type>>& returnValue,
const Confidence<Ref<CallingConvention>>& callingConvention,
- const std::vector<FunctionParameter>& params, const Confidence<bool>& varArg)
+ const std::vector<FunctionParameter>& params, const Confidence<bool>& varArg,
+ const Confidence<size_t>& stackAdjust)
{
BNTypeWithConfidence returnValueConf;
returnValueConf.type = returnValue->GetObject();
@@ -689,8 +697,12 @@ Ref<Type> Type::FunctionType(const Confidence<Ref<Type>>& returnValue,
varArgConf.value = varArg.GetValue();
varArgConf.confidence = varArg.GetConfidence();
+ BNSizeWithConfidence stackAdjustConf;
+ stackAdjustConf.value = stackAdjust.GetValue();
+ stackAdjustConf.confidence = stackAdjust.GetConfidence();
+
Type* type = new Type(BNCreateFunctionType(&returnValueConf, &callingConventionConf,
- paramArray, params.size(), &varArgConf));
+ paramArray, params.size(), &varArgConf, &stackAdjustConf));
delete[] paramArray;
return type;
}