summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-06-24 17:55:48 -0400
committerAlexander Taylor <alex@vector35.com>2025-06-25 18:36:47 -0400
commitc41f264a1dba68c89b4a224a70e3a5783f7fa879 (patch)
tree00bb6e91d86b708bff7265ed7179a6ef2793b7fb
parentb1a7666164a000c5255f90568ed9597b58ce276a (diff)
Remove implicit conversions from Confidence to underlying type, these can cause bugs and also issues with C++20
-rw-r--r--arch/arm64/arch_arm64.cpp18
-rw-r--r--arch/armv7/arch_armv7.cpp2
-rw-r--r--arch/mips/arch_mips.cpp6
-rw-r--r--binaryninjaapi.h42
-rw-r--r--component.cpp4
-rw-r--r--defaultabb.cpp12
-rw-r--r--demangler/gnu3/demangle_gnu3.cpp4
-rw-r--r--examples/workflows/tailcall/tailcall.cpp4
-rw-r--r--function.cpp16
-rw-r--r--highlevelilinstruction.cpp4
-rw-r--r--lang/c/pseudoc.cpp63
-rw-r--r--lang/c/pseudoobjc.cpp6
-rw-r--r--lang/rust/pseudorust.cpp83
-rw-r--r--lang/rust/rusttypes.cpp20
-rw-r--r--mediumlevelilinstruction.cpp4
-rw-r--r--objectivec/objc.cpp6
-rw-r--r--plugins/rtti/itanium.cpp25
-rw-r--r--plugins/rtti/microsoft.cpp21
-rw-r--r--python/generator.cpp30
-rw-r--r--type.cpp8
-rw-r--r--view/elf/elfview.cpp9
-rw-r--r--view/elf/elfview.h2
-rw-r--r--view/kernelcache/api/python/generator.cpp32
-rw-r--r--view/macho/machoview.cpp2
-rw-r--r--view/md1rom/md1rom.cpp2
-rw-r--r--view/pe/peview.cpp2
-rw-r--r--view/sharedcache/api/python/generator.cpp32
27 files changed, 247 insertions, 212 deletions
diff --git a/arch/arm64/arch_arm64.cpp b/arch/arm64/arch_arm64.cpp
index 1032c15c..b0e97995 100644
--- a/arch/arm64/arch_arm64.cpp
+++ b/arch/arm64/arch_arm64.cpp
@@ -2358,7 +2358,7 @@ class Arm64ImportedFunctionRecognizer : public FunctionRecognizer
DataVariable var;
if (data->GetDataVariableAtAddress(extSym.front()->GetAddress(), var))
{
- func->ApplyImportedTypes(funcSym, var.type);
+ func->ApplyImportedTypes(funcSym, var.type.GetValue());
}
return true;
}
@@ -2431,12 +2431,12 @@ class Arm64ImportedFunctionRecognizer : public FunctionRecognizer
data->GetDataVariableAtAddress(loadAddrConstant.value, target);
Ref<Type> funcType = nullptr;
- if (target.type && target.type->GetClass() == PointerTypeClass &&
- target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
+ if (target.type.GetValue() && target.type->GetClass() == PointerTypeClass
+ && target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
{
target.type = target.type->GetChildType();
- if (target.type && target.type->GetClass() == FunctionTypeClass &&
- target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
+ if (target.type.GetValue() && target.type->GetClass() == FunctionTypeClass
+ && target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
funcType = target.type.GetValue();
}
@@ -2522,12 +2522,12 @@ class Arm64ImportedFunctionRecognizer : public FunctionRecognizer
data->GetDataVariableAtAddress(loadAddrConstant.value, target);
Ref<Type> funcType = nullptr;
- if (target.type && target.type->GetClass() == PointerTypeClass &&
- target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
+ if (target.type.GetValue() && target.type->GetClass() == PointerTypeClass
+ && target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
{
target.type = target.type->GetChildType();
- if (target.type && target.type->GetClass() == FunctionTypeClass &&
- target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
+ if (target.type.GetValue() && target.type->GetClass() == FunctionTypeClass
+ && target.type.GetConfidence() >= BN_MINIMUM_CONFIDENCE)
funcType = target.type.GetValue();
}
diff --git a/arch/armv7/arch_armv7.cpp b/arch/armv7/arch_armv7.cpp
index 5739a8bd..f27a3fb9 100644
--- a/arch/armv7/arch_armv7.cpp
+++ b/arch/armv7/arch_armv7.cpp
@@ -2231,7 +2231,7 @@ public:
return false;
Confidence<Ref<Type>> type = entryFunc->GetType();
- data->DefineImportedFunction(sym, func, type);
+ data->DefineImportedFunction(sym, func, type.GetValue());
return true;
}
}
diff --git a/arch/mips/arch_mips.cpp b/arch/mips/arch_mips.cpp
index 0c788133..4cd8b26c 100644
--- a/arch/mips/arch_mips.cpp
+++ b/arch/mips/arch_mips.cpp
@@ -2726,7 +2726,7 @@ private:
DataVariable var;
if (data->GetDataVariableAtAddress(extSym.front()->GetAddress(), var))
{
- func->ApplyImportedTypes(funcSym, var.type);
+ func->ApplyImportedTypes(funcSym, var.type.GetValue());
}
return true;
}
@@ -2799,7 +2799,7 @@ private:
DataVariable var;
if (data->GetDataVariableAtAddress(extSym.front()->GetAddress(), var))
{
- func->ApplyImportedTypes(pltSym, var.type);
+ func->ApplyImportedTypes(pltSym, var.type.GetValue());
}
return true;
}
@@ -2924,7 +2924,7 @@ private:
DataVariable var;
if (data->GetDataVariableAtAddress(extSym.front()->GetAddress(), var))
{
- func->ApplyImportedTypes(funcSym, var.type);
+ func->ApplyImportedTypes(funcSym, var.type.GetValue());
}
return true;
}
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 48f11f24..3cdb1498 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -366,6 +366,24 @@ namespace BinaryNinja {
T* GetPtr() const { return m_obj; }
};
+ template <class T>
+ bool operator==(T* a, const Ref<T>& b)
+ {
+ return a == b.GetPtr();
+ }
+
+ template <class T>
+ bool operator!=(T* a, const Ref<T>& b)
+ {
+ return a != b.GetPtr();
+ }
+
+ template <class T>
+ bool operator<(T* a, const Ref<T>& b)
+ {
+ return a < b.GetPtr();
+ }
+
/*!
\ingroup refcount
*/
@@ -389,8 +407,26 @@ namespace BinaryNinja {
T* GetPtr() const { return m_obj; }
};
+ template <class T>
+ bool operator==(T* a, const CallbackRef<T>& b)
+ {
+ return a == b.GetPtr();
+ }
+
+ template <class T>
+ bool operator!=(T* a, const CallbackRef<T>& b)
+ {
+ return a != b.GetPtr();
+ }
+
+ template <class T>
+ bool operator<(T* a, const CallbackRef<T>& b)
+ {
+ return a < b.GetPtr();
+ }
+
/*!
- \ingroup confidence
+ \ingroup confidence
*/
class ConfidenceBase
{
@@ -499,8 +535,6 @@ namespace BinaryNinja {
Confidence(const Confidence<Ref<T>>& v) : ConfidenceBase(v.m_confidence), m_value(v.m_value) {}
- operator Ref<T>() const { return m_value; }
- operator T*() const { return m_value.GetPtr(); }
T* operator->() const { return m_value.GetPtr(); }
bool operator!() const { return !m_value; }
@@ -4281,7 +4315,7 @@ namespace BinaryNinja {
struct DataVariable
{
DataVariable() {}
- DataVariable(uint64_t a, Type* t, bool d) : address(a), type(t), autoDiscovered(d) {}
+ DataVariable(uint64_t a, const Confidence<Ref<Type>>& t, bool d) : address(a), type(t), autoDiscovered(d) {}
uint64_t address;
Confidence<Ref<Type>> type;
diff --git a/component.cpp b/component.cpp
index 30431e90..0dd7db21 100644
--- a/component.cpp
+++ b/component.cpp
@@ -155,7 +155,7 @@ std::vector<DataVariable> Component::GetContainedDataVariables()
for (size_t i = 0; i < count; ++i)
{
result.emplace_back(variables[i].address,
- Confidence(new Type(BNNewTypeReference(variables[i].type)), variables[i].typeConfidence),
+ Confidence<Ref<Type>>(new Type(BNNewTypeReference(variables[i].type)), variables[i].typeConfidence),
variables[i].autoDiscovered);
}
@@ -196,7 +196,7 @@ std::vector<DataVariable> Component::GetReferencedDataVariables()
for (size_t i = 0; i < count; ++i)
{
result.emplace_back(variables[i].address,
- Confidence(new Type(BNNewTypeReference(variables[i].type)), variables[i].typeConfidence),
+ Confidence<Ref<Type>>(new Type(BNNewTypeReference(variables[i].type)), variables[i].typeConfidence),
variables[i].autoDiscovered);
}
diff --git a/defaultabb.cpp b/defaultabb.cpp
index 477e5722..00d0e560 100644
--- a/defaultabb.cpp
+++ b/defaultabb.cpp
@@ -337,9 +337,9 @@ void Architecture::DefaultAnalyzeBasicBlocks(Function* function, BasicBlockAnaly
{
// Deal with direct pointers into the extern section
DataVariable dataVar;
- if (data->GetDataVariableAtAddress(info.branchTarget[i], dataVar) &&
- (dataVar.address == info.branchTarget[i]) && dataVar.type &&
- (dataVar.type->GetClass() == FunctionTypeClass))
+ if (data->GetDataVariableAtAddress(info.branchTarget[i], dataVar)
+ && (dataVar.address == info.branchTarget[i]) && dataVar.type.GetValue()
+ && (dataVar.type->GetClass() == FunctionTypeClass))
{
directRefs[info.branchTarget[i]].emplace(location);
if (!dataVar.type->CanReturn())
@@ -414,9 +414,9 @@ void Architecture::DefaultAnalyzeBasicBlocks(Function* function, BasicBlockAnaly
{
// Deal with direct pointers into the extern section
DataVariable dataVar;
- if (data->GetDataVariableAtAddress(info.branchTarget[i], dataVar) &&
- (dataVar.address == info.branchTarget[i]) && dataVar.type &&
- (dataVar.type->GetClass() == FunctionTypeClass))
+ if (data->GetDataVariableAtAddress(info.branchTarget[i], dataVar)
+ && (dataVar.address == info.branchTarget[i]) && dataVar.type.GetValue()
+ && (dataVar.type->GetClass() == FunctionTypeClass))
{
directRefs[info.branchTarget[i]].emplace(location);
if (!dataVar.type->CanReturn())
diff --git a/demangler/gnu3/demangle_gnu3.cpp b/demangler/gnu3/demangle_gnu3.cpp
index d020ed72..9bf47f77 100644
--- a/demangler/gnu3/demangle_gnu3.cpp
+++ b/demangler/gnu3/demangle_gnu3.cpp
@@ -1960,7 +1960,7 @@ TypeBuilder DemangleGNU3::DemangleSymbol(QualifiedName& varName)
bool isReturnTypeUnknown = false;
TypeBuilder type;
vector<FunctionParameter> params;
- bool cnst = false, vltl = false, rstrct = false;
+ Confidence<bool> cnst = false, vltl = false, rstrct = false;
bool oldTopLevel;
QualifiedName name;
@@ -2222,7 +2222,7 @@ TypeBuilder DemangleGNU3::DemangleSymbol(QualifiedName& varName)
type.SetPointerSuffix(suffix);
type.SetConst(cnst);
type.SetVolatile(vltl);
- if (rstrct)
+ if (rstrct.GetValue())
type.SetPointerSuffix({RestrictSuffix});
// PrintTables();
diff --git a/examples/workflows/tailcall/tailcall.cpp b/examples/workflows/tailcall/tailcall.cpp
index 294b6471..0fed369d 100644
--- a/examples/workflows/tailcall/tailcall.cpp
+++ b/examples/workflows/tailcall/tailcall.cpp
@@ -74,8 +74,8 @@ extern "C"
DataVariable var;
if (data->GetDataVariableAtAddress(target.value, var))
{
- if (var.type && (var.type->GetClass() == PointerTypeClass)
- && (var.type->GetChildType()->GetClass() == FunctionTypeClass))
+ if (var.type.GetValue() && (var.type->GetClass() == PointerTypeClass)
+ && (var.type->GetChildType()->GetClass() == FunctionTypeClass))
canReturn = var.type->GetChildType()->CanReturn().GetValue();
}
}
diff --git a/function.cpp b/function.cpp
index 2f04af9a..bb5ae370 100644
--- a/function.cpp
+++ b/function.cpp
@@ -1031,7 +1031,7 @@ void Function::SetAutoType(Type* type)
void Function::SetAutoReturnType(const Confidence<Ref<Type>>& type)
{
BNTypeWithConfidence tc;
- tc.type = type ? type->GetObject() : nullptr;
+ tc.type = type.GetValue() ? type->GetObject() : nullptr;
tc.confidence = type.GetConfidence();
BNSetAutoFunctionReturnType(m_object, &tc);
}
@@ -1053,7 +1053,7 @@ void Function::SetAutoReturnRegisters(const Confidence<std::vector<uint32_t>>& r
void Function::SetAutoCallingConvention(const Confidence<Ref<CallingConvention>>& convention)
{
BNCallingConventionWithConfidence cc;
- cc.convention = convention ? convention->GetObject() : nullptr;
+ cc.convention = convention.GetValue() ? convention->GetObject() : nullptr;
cc.confidence = convention.GetConfidence();
BNSetAutoFunctionCallingConvention(m_object, &cc);
}
@@ -1160,7 +1160,7 @@ bool Function::HasUserType() const
void Function::SetReturnType(const Confidence<Ref<Type>>& type)
{
BNTypeWithConfidence tc;
- tc.type = type ? type->GetObject() : nullptr;
+ tc.type = type.GetValue() ? type->GetObject() : nullptr;
tc.confidence = type.GetConfidence();
BNSetUserFunctionReturnType(m_object, &tc);
}
@@ -1182,7 +1182,7 @@ void Function::SetReturnRegisters(const Confidence<std::vector<uint32_t>>& retur
void Function::SetCallingConvention(const Confidence<Ref<CallingConvention>>& convention)
{
BNCallingConventionWithConfidence cc;
- cc.convention = convention ? convention->GetObject() : nullptr;
+ cc.convention = convention.GetValue() ? convention->GetObject() : nullptr;
cc.confidence = convention.GetConfidence();
BNSetUserFunctionCallingConvention(m_object, &cc);
}
@@ -1872,9 +1872,9 @@ bool Function::HasUnresolvedIndirectBranches()
void Function::SetAutoCallTypeAdjustment(Architecture* arch, uint64_t addr, const Confidence<Ref<Type>>& adjust)
{
BNTypeWithConfidence apiObject;
- apiObject.type = adjust ? adjust->GetObject() : nullptr;
+ apiObject.type = adjust.GetValue() ? adjust->GetObject() : nullptr;
apiObject.confidence = adjust.GetConfidence();
- BNSetAutoCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust ? &apiObject : nullptr);
+ BNSetAutoCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust.GetValue() ? &apiObject : nullptr);
}
@@ -1912,9 +1912,9 @@ void Function::SetAutoCallRegisterStackAdjustment(
void Function::SetUserCallTypeAdjustment(Architecture* arch, uint64_t addr, const Confidence<Ref<Type>>& adjust)
{
BNTypeWithConfidence apiObject;
- apiObject.type = adjust ? adjust->GetObject() : nullptr;
+ apiObject.type = adjust.GetValue() ? adjust->GetObject() : nullptr;
apiObject.confidence = adjust.GetConfidence();
- BNSetUserCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust ? &apiObject : nullptr);
+ BNSetUserCallTypeAdjustment(m_object, arch->GetObject(), addr, adjust.GetValue() ? &apiObject : nullptr);
}
diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp
index 33c5db29..ce0e72ee 100644
--- a/highlevelilinstruction.cpp
+++ b/highlevelilinstruction.cpp
@@ -940,7 +940,7 @@ char* HighLevelILInstructionBase::Dump() const
{
text += "[instr " + to_string(instructionIndex) + "] ";
}
- Ref<Type> type = GetType();
+ Ref<Type> type = GetType().GetValue();
if (type)
{
text += "[type: " + type->GetString() + "] ";
@@ -3344,7 +3344,7 @@ fmt::format_context::iterator fmt::formatter<HighLevelILInstruction>::format(con
{
fmt::format_to(ctx.out(), "[instr {}] ", obj.instructionIndex);
}
- Ref<Type> type = obj.GetType();
+ Ref<Type> type = obj.GetType().GetValue();
if (type)
{
fmt::format_to(ctx.out(), "[type: {}] ", type->GetString());
diff --git a/lang/c/pseudoc.cpp b/lang/c/pseudoc.cpp
index 14a82e9e..86a7b9db 100644
--- a/lang/c/pseudoc.cpp
+++ b/lang/c/pseudoc.cpp
@@ -60,11 +60,11 @@ BNSymbolDisplayResult PseudoCFunction::AppendPointerTextToken(const HighLevelILI
vector<InstructionTextToken>& tokens, DisassemblySettings* settings, BNSymbolDisplayType symbolDisplay, BNOperatorPrecedence precedence)
{
Confidence<Ref<Type>> type = instr.GetType();
- if (type && (type->GetClass() == PointerTypeClass) && type->IsConst())
+ if (type.GetValue() && (type->GetClass() == PointerTypeClass) && type->IsConst())
{
string stringValue;
size_t childWidth = 0;
- if (auto child = type->GetChildType(); child)
+ if (auto child = type->GetChildType(); child.GetValue())
childWidth = child->GetWidth();
if (auto strType = GetFunction()->GetView()->CheckForStringAnnotationType(val, stringValue, false, false, childWidth); strType.has_value())
{
@@ -87,8 +87,9 @@ BNSymbolDisplayResult PseudoCFunction::AppendPointerTextToken(const HighLevelILI
{
// If the pointer has a value of 0, check if it points to a valid address by
// 1. If the binary is relocatable, assign the pointer as nullptr
- // 2. else, check if the constant zero which being referenced is a pointer(display as symbol) or not(display as nullptr)
- if(val == 0x0 && type && (type->GetClass() == PointerTypeClass))
+ // 2. else, check if the constant zero which being referenced is a pointer(display as symbol) or not(display as
+ // nullptr)
+ if (val == 0x0 && type.GetValue() && (type->GetClass() == PointerTypeClass))
{
if (GetFunction()->GetView()->IsRelocatable())
{
@@ -292,10 +293,10 @@ void PseudoCFunction::AppendTwoOperand(const string& operand, const HighLevelILI
if (leftExpr.operation == HLIL_VAR && (operand == " + " || operand == " - "))
{
const auto variableType = GetFunction()->GetVariableType(leftExpr.GetVariable());
- if (variableType)
+ if (variableType.GetValue())
{
const auto childType = variableType->GetChildType();
- if (variableType->IsPointer() && childType && childType->GetWidth() != 1)
+ if (variableType->IsPointer() && childType.GetValue() && childType->GetWidth() != 1)
{
emitter.AppendOpenParen();
emitter.Append(TypeNameToken, "char");
@@ -542,12 +543,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
// complex expression can cause the process to crash from a stack overflow.
auto exprGuard = tokens.SetCurrentExpr(instr);
- if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType())
+ if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType().GetValue())
{
tokens.AppendOpenParen();
tokens.AppendOpenParen();
auto typeTokens = GetTypePrinter()->GetTypeTokens(
- instr.GetType(), GetArchitecture()->GetStandalonePlatform(), QualifiedName());
+ instr.GetType().GetValue(), GetArchitecture()->GetStandalonePlatform(), QualifiedName());
for (auto& token: typeTokens)
{
tokens.Append(token);
@@ -1004,11 +1005,13 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
const auto variableType = GetHighLevelILFunction()->GetFunction()->GetVariableType(destExpr);
const auto platform = GetHighLevelILFunction()->GetFunction()->GetPlatform();
- const auto prevTypeTokens = variableType ?
- GetTypePrinter()->GetTypeTokensBeforeName(variableType, platform, variableType.GetConfidence()) :
+ const auto prevTypeTokens = variableType.GetValue() ?
+ GetTypePrinter()->GetTypeTokensBeforeName(
+ variableType.GetValue(), platform, variableType.GetConfidence()) :
vector<InstructionTextToken> {};
- const auto postTypeTokens = variableType ?
- GetTypePrinter()->GetTypeTokensAfterName(variableType, platform, variableType.GetConfidence()) :
+ const auto postTypeTokens = variableType.GetValue() ?
+ GetTypePrinter()->GetTypeTokensAfterName(
+ variableType.GetValue(), platform, variableType.GetConfidence()) :
vector<InstructionTextToken> {};
// Check to see if the variable appears live
@@ -1023,7 +1026,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
if (appearsDead)
tokens.BeginForceZeroConfidence();
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken: prevTypeTokens)
{
@@ -1034,7 +1037,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
tokens.Append(TextToken, " ");
}
tokens.AppendVarTextToken(destExpr, instr, instr.size);
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken: postTypeTokens)
{
@@ -1068,14 +1071,16 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
const auto variableType = GetHighLevelILFunction()->GetFunction()->GetVariableType(variable);
const auto platform = GetHighLevelILFunction()->GetFunction()->GetPlatform();
- const auto prevTypeTokens = variableType ?
- GetTypePrinter()->GetTypeTokensBeforeName(variableType, platform, variableType.GetConfidence()) :
+ const auto prevTypeTokens = variableType.GetValue() ?
+ GetTypePrinter()->GetTypeTokensBeforeName(
+ variableType.GetValue(), platform, variableType.GetConfidence()) :
vector<InstructionTextToken> {};
- const auto postTypeTokens = variableType ?
- GetTypePrinter()->GetTypeTokensAfterName(variableType, platform, variableType.GetConfidence()) :
+ const auto postTypeTokens = variableType.GetValue() ?
+ GetTypePrinter()->GetTypeTokensAfterName(
+ variableType.GetValue(), platform, variableType.GetConfidence()) :
vector<InstructionTextToken> {};
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken: prevTypeTokens)
{
@@ -1086,7 +1091,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
tokens.Append(TextToken, " ");
}
tokens.AppendVarTextToken(variable, instr, instr.size);
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken: postTypeTokens)
{
@@ -1549,7 +1554,8 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
}
else if ((!settings || settings->IsOptionSet(ShowTypeCasts)) && srcExpr.operation == HLIL_VAR)
{
- if (srcExpr.GetType() && srcExpr.GetType()->GetClass() != StructureTypeClass && srcExpr.size > instr.size)
+ if (srcExpr.GetType().GetValue() && srcExpr.GetType()->GetClass() != StructureTypeClass
+ && srcExpr.size > instr.size)
{
tokens.AppendOpenParen();
AppendSizeToken(instr.size, false, tokens);
@@ -1603,7 +1609,8 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
if (AppendPointerTextToken(instr, constant, pointerTokens, settings, DereferenceNonDataSymbols, precedence) == DataSymbolResult)
{
const auto type = srcExpr.GetType();
- if (type && type->GetClass() == PointerTypeClass && instr.size != type->GetChildType()->GetWidth())
+ if (type.GetValue() && type->GetClass() == PointerTypeClass
+ && instr.size != type->GetChildType()->GetWidth())
{
if (!settings || settings->IsOptionSet(ShowTypeCasts))
{
@@ -1948,9 +1955,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
auto var = left.GetVariable<HLIL_VAR>();
auto srcOffset = right.GetConstant<HLIL_CONST>();
auto varType = GetFunction()->GetVariableType(var);
- if (varType
- && varType->GetClass() == PointerTypeClass
- && varType->GetNamedTypeReference()
+ if (varType.GetValue() && varType->GetClass() == PointerTypeClass && varType->GetNamedTypeReference()
&& varType->GetOffset() == srcOffset)
{
// Yes
@@ -2743,7 +2748,7 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
break;
}
- if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType())
+ if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType().GetValue())
{
tokens.AppendCloseParen();
}
@@ -2757,7 +2762,7 @@ void PseudoCFunction::GetExpr_CALL_OR_TAILCALL(const BinaryNinja::HighLevelILIns
const auto parameterExprs = instr.GetParameterExprs();
vector<FunctionParameter> namedParams;
- Ref<Type> functionType = destExpr.GetType();
+ Ref<Type> functionType = destExpr.GetType().GetValue();
if (functionType && (functionType->GetClass() == PointerTypeClass)
&& (functionType->GetChildType()->GetClass() == FunctionTypeClass))
namedParams = functionType->GetChildType()->GetParameters();
@@ -2777,9 +2782,9 @@ void PseudoCFunction::GetExpr_CALL_OR_TAILCALL(const BinaryNinja::HighLevelILIns
if (index < namedParams.size() && parameterExprs[index].operation == HLIL_CONST_PTR)
{
auto exprType = namedParams[index].type;
- if (exprType && (exprType->GetClass() == PointerTypeClass))
+ if (exprType.GetValue() && (exprType->GetClass() == PointerTypeClass))
{
- if (auto child = exprType->GetChildType(); child)
+ if (auto child = exprType->GetChildType(); child.GetValue())
{
if ((child->IsInteger() && child->IsSigned() && child->GetWidth() == 1) || child->IsWideChar())
{
diff --git a/lang/c/pseudoobjc.cpp b/lang/c/pseudoobjc.cpp
index c832e388..c76eabac 100644
--- a/lang/c/pseudoobjc.cpp
+++ b/lang/c/pseudoobjc.cpp
@@ -21,7 +21,7 @@ bool ParameterIsString(const HighLevelILInstruction& expr)
if (!exprType || exprType->GetClass() != PointerTypeClass)
return false;
- if (auto child = exprType->GetChildType(); child)
+ if (auto child = exprType->GetChildType(); child.GetValue())
{
child = child->IsArray() ? child->GetChildType() : child;
return child->IsInteger() && child->IsSigned() && child->GetWidth() == 1;
@@ -215,7 +215,7 @@ bool VariableIsObjCSuperStruct(const Variable& variable, Function& function)
if (variableName != "super")
return false;
- const auto variableType = TypeResolvingNamedTypeReference(function.GetVariableType(variable), function);
+ const auto variableType = TypeResolvingNamedTypeReference(function.GetVariableType(variable).GetValue(), function);
if (!variableType || variableType->GetClass() != StructureTypeClass)
return false;
@@ -453,7 +453,7 @@ void PseudoObjCFunction::GetExpr_CONST_PTR(const BinaryNinja::HighLevelILInstruc
if (!hasVariable)
return PseudoCFunction::GetExpr_CONST_PTR(instr, tokens, settings, precedence, statement);
- auto type = TypeResolvingNamedTypeReference(variable.type, *GetFunction());
+ auto type = TypeResolvingNamedTypeReference(variable.type.GetValue(), *GetFunction());
if (!type || type->GetClass() != StructureTypeClass)
return PseudoCFunction::GetExpr_CONST_PTR(instr, tokens, settings, precedence, statement);
diff --git a/lang/rust/pseudorust.cpp b/lang/rust/pseudorust.cpp
index 380be7c6..2f9b751c 100644
--- a/lang/rust/pseudorust.cpp
+++ b/lang/rust/pseudorust.cpp
@@ -62,11 +62,11 @@ BNSymbolDisplayResult PseudoRustFunction::AppendPointerTextToken(const HighLevel
vector<InstructionTextToken>& tokens, DisassemblySettings* settings, BNSymbolDisplayType symbolDisplay, BNOperatorPrecedence precedence)
{
Confidence<Ref<Type>> type = instr.GetType();
- if (type && (type->GetClass() == PointerTypeClass) && type->IsConst())
+ if (type.GetValue() && (type->GetClass() == PointerTypeClass) && type->IsConst())
{
string stringValue;
size_t childWidth = 0;
- if (auto child = type->GetChildType(); child)
+ if (auto child = type->GetChildType(); child.GetValue())
childWidth = child->GetWidth();
if (auto strType = GetFunction()->GetView()->CheckForStringAnnotationType(val, stringValue, false, false, childWidth); strType.has_value())
{
@@ -89,8 +89,9 @@ BNSymbolDisplayResult PseudoRustFunction::AppendPointerTextToken(const HighLevel
{
// If the pointer has a value of 0, check if it points to a valid address by
// 1. If the binary is relocatable, assign the pointer as nullptr
- // 2. else, check if the constant zero which being referenced is a pointer(display as symbol) or not(display as nullptr)
- if(val == 0x0 && type && (type->GetClass() == PointerTypeClass))
+ // 2. else, check if the constant zero which being referenced is a pointer(display as symbol) or not(display as
+ // nullptr)
+ if (val == 0x0 && type.GetValue() && (type->GetClass() == PointerTypeClass))
{
if (GetFunction()->GetView()->IsRelocatable())
{
@@ -312,7 +313,7 @@ void PseudoRustFunction::AppendTwoOperand(const string& operand, const HighLevel
if (operand == " + " || operand == " - ")
{
const auto exprType = leftExpr.GetType();
- if (exprType && exprType->IsPointer())
+ if (exprType.GetValue() && exprType->IsPointer())
{
GetExprText(leftExpr, emitter, settings, MemberAndFunctionOperatorPrecedence);
emitter.Append(TextToken, ".");
@@ -597,16 +598,13 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
// complex expression can cause the process to crash from a stack overflow.
auto exprGuard = tokens.SetCurrentExpr(instr);
- if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType())
+ if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType().GetValue())
{
tokens.AppendOpenParen();
tokens.AppendOpenParen();
RustTypePrinter printer;
auto typeTokens = printer.GetTypeTokens(
- instr.GetType(),
- GetArchitecture()->GetStandalonePlatform(),
- QualifiedName()
- );
+ instr.GetType().GetValue(), GetArchitecture()->GetStandalonePlatform(), QualifiedName());
for (auto& token: typeTokens)
{
tokens.Append(token);
@@ -1035,7 +1033,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
tokens.AppendOpenParen();
vector<FunctionParameter> namedParams;
- Ref<Type> functionType = instr.GetDestExpr<HLIL_CALL>().GetType();
+ Ref<Type> functionType = instr.GetDestExpr<HLIL_CALL>().GetType().GetValue();
if (functionType && (functionType->GetClass() == PointerTypeClass)
&& (functionType->GetChildType()->GetClass() == FunctionTypeClass))
namedParams = functionType->GetChildType()->GetParameters();
@@ -1051,9 +1049,9 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
if (index < namedParams.size() && parameterExprs[index].operation == HLIL_CONST_PTR)
{
auto exprType = namedParams[index].type;
- if (exprType && (exprType->GetClass() == PointerTypeClass))
+ if (exprType.GetValue() && (exprType->GetClass() == PointerTypeClass))
{
- if (auto child = exprType->GetChildType(); child)
+ if (auto child = exprType->GetChildType(); child.GetValue())
{
if ((child->IsInteger() && child->IsSigned() && child->GetWidth() == 1)
|| child->IsWideChar())
@@ -1118,11 +1116,11 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
const auto variableType = GetHighLevelILFunction()->GetFunction()->GetVariableType(destExpr);
const auto platform = GetHighLevelILFunction()->GetFunction()->GetPlatform();
RustTypePrinter printer;
- const auto prevTypeTokens = variableType ?
- printer.GetTypeTokensBeforeName(variableType, platform, variableType.GetConfidence()) :
+ const auto prevTypeTokens = variableType.GetValue() ?
+ printer.GetTypeTokensBeforeName(variableType.GetValue(), platform, variableType.GetConfidence()) :
vector<InstructionTextToken> {};
- const auto postTypeTokens = variableType ?
- printer.GetTypeTokensAfterName(variableType, platform, variableType.GetConfidence()) :
+ const auto postTypeTokens = variableType.GetValue() ?
+ printer.GetTypeTokensAfterName(variableType.GetValue(), platform, variableType.GetConfidence()) :
vector<InstructionTextToken> {};
// Check to see if the variable appears live
@@ -1143,7 +1141,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
if (IsMutable(destExpr))
tokens.Append(KeywordToken, "mut ");
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken : prevTypeTokens)
{
@@ -1153,7 +1151,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
}
}
tokens.AppendVarTextToken(destExpr, instr, instr.size);
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken : postTypeTokens)
{
@@ -1188,14 +1186,12 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
const auto variableType = GetHighLevelILFunction()->GetFunction()->GetVariableType(variable);
const auto platform = GetHighLevelILFunction()->GetFunction()->GetPlatform();
RustTypePrinter printer;
- const auto prevTypeTokens =
- variableType ?
- printer.GetTypeTokensBeforeName(variableType, platform, variableType.GetConfidence()) :
- vector<InstructionTextToken>{};
- const auto postTypeTokens =
- variableType ?
- printer.GetTypeTokensAfterName(variableType, platform, variableType.GetConfidence()) :
- vector<InstructionTextToken>{};
+ const auto prevTypeTokens = variableType.GetValue() ?
+ printer.GetTypeTokensBeforeName(variableType.GetValue(), platform, variableType.GetConfidence()) :
+ vector<InstructionTextToken> {};
+ const auto postTypeTokens = variableType.GetValue() ?
+ printer.GetTypeTokensAfterName(variableType.GetValue(), platform, variableType.GetConfidence()) :
+ vector<InstructionTextToken> {};
tokens.Append(KeywordToken, "let ");
@@ -1203,7 +1199,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
if (IsMutable(variable))
tokens.Append(KeywordToken, "mut ");
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken: prevTypeTokens)
{
@@ -1213,7 +1209,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
}
}
tokens.AppendVarTextToken(variable, instr, instr.size);
- if (variableType)
+ if (variableType.GetValue())
{
for (auto typeToken: postTypeTokens)
{
@@ -1628,7 +1624,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
{
tokens.Append(KeywordToken, " as ");
tokens.Append(TextToken, "*");
- Ref<Type> srcType = srcExpr.GetType();
+ Ref<Type> srcType = srcExpr.GetType().GetValue();
if (srcType && srcType->IsPointer() && srcType->GetChildType()->IsConst())
tokens.Append(KeywordToken, "const ");
else
@@ -1658,7 +1654,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
{
tokens.Append(KeywordToken, " as ");
tokens.Append(TextToken, "*");
- Ref<Type> srcType = srcExpr.GetType();
+ Ref<Type> srcType = srcExpr.GetType().GetValue();
if (srcType && srcType->IsPointer() && srcType->GetChildType()->IsConst())
tokens.Append(KeywordToken, "const ");
else
@@ -1691,7 +1687,8 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
}
else if ((!settings || settings->IsOptionSet(ShowTypeCasts)) && srcExpr.operation == HLIL_VAR)
{
- if (srcExpr.GetType() && srcExpr.GetType()->GetClass() != StructureTypeClass && srcExpr.size > instr.size)
+ if (srcExpr.GetType().GetValue() && srcExpr.GetType()->GetClass() != StructureTypeClass
+ && srcExpr.size > instr.size)
{
GetExprText(srcExpr, tokens, settings, MemberAndFunctionOperatorPrecedence);
tokens.Append(KeywordToken, " as ");
@@ -1745,14 +1742,16 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
const auto type = srcExpr.GetType();
BNOperatorPrecedence srcPrecedence = UnaryOperatorPrecedence;
- if (type && type->GetClass() == PointerTypeClass && instr.size != type->GetChildType()->GetWidth() &&
- (!settings || settings->IsOptionSet(ShowTypeCasts)))
+ if (type.GetValue() && type->GetClass() == PointerTypeClass
+ && instr.size != type->GetChildType()->GetWidth()
+ && (!settings || settings->IsOptionSet(ShowTypeCasts)))
srcPrecedence = LowUnaryOperatorPrecedence;
vector<InstructionTextToken> pointerTokens{};
if (AppendPointerTextToken(instr, constant, pointerTokens, settings, DereferenceNonDataSymbols, srcPrecedence) == DataSymbolResult)
{
- if (type && type->GetClass() == PointerTypeClass && instr.size != type->GetChildType()->GetWidth())
+ if (type.GetValue() && type->GetClass() == PointerTypeClass
+ && instr.size != type->GetChildType()->GetWidth())
{
tokens.Append(OperationToken, "*");
if (!settings || settings->IsOptionSet(ShowTypeCasts))
@@ -1767,7 +1766,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
{
tokens.Append(KeywordToken, " as ");
tokens.Append(TextToken, "*");
- Ref<Type> srcType = srcExpr.GetType();
+ Ref<Type> srcType = srcExpr.GetType().GetValue();
if (srcType && srcType->IsPointer() && srcType->GetChildType()->IsConst())
tokens.Append(KeywordToken, "const ");
else
@@ -2052,7 +2051,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
const auto leftType = instr.GetLeftExpr().GetType();
bool parens;
BNOperatorPrecedence opPrecedence = AddOperatorPrecedence;
- if (leftType && leftType->IsPointer())
+ if (leftType.GetValue() && leftType->IsPointer())
{
parens = false;
opPrecedence = MemberAndFunctionOperatorPrecedence;
@@ -2084,9 +2083,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
auto var = left.GetVariable<HLIL_VAR>();
auto srcOffset = right.GetConstant<HLIL_CONST>();
auto varType = GetFunction()->GetVariableType(var);
- if (varType
- && varType->GetClass() == PointerTypeClass
- && varType->GetNamedTypeReference()
+ if (varType.GetValue() && varType->GetClass() == PointerTypeClass && varType->GetNamedTypeReference()
&& varType->GetOffset() == srcOffset)
{
// Yes
@@ -2101,7 +2098,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
const auto leftType = instr.GetLeftExpr().GetType();
bool parens;
BNOperatorPrecedence opPrecedence = SubOperatorPrecedence;
- if (leftType && leftType->IsPointer())
+ if (leftType.GetValue() && leftType->IsPointer())
{
parens = false;
opPrecedence = MemberAndFunctionOperatorPrecedence;
@@ -2659,7 +2656,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
{
tokens.Append(KeywordToken, " as ");
tokens.Append(TextToken, "*");
- Ref<Type> srcType = srcExpr.GetType();
+ Ref<Type> srcType = srcExpr.GetType().GetValue();
if (srcType && srcType->IsPointer() && srcType->GetChildType()->IsConst())
tokens.Append(KeywordToken, "const ");
else
@@ -2839,7 +2836,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe
break;
}
- if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType())
+ if (settings && settings->IsOptionSet(ShowILTypes) && instr.GetType().GetValue())
{
tokens.AppendCloseParen();
}
diff --git a/lang/rust/rusttypes.cpp b/lang/rust/rusttypes.cpp
index c43817ab..70bf3162 100644
--- a/lang/rust/rusttypes.cpp
+++ b/lang/rust/rusttypes.cpp
@@ -13,8 +13,8 @@ RustTypePrinter::RustTypePrinter(): TypePrinter("RustTypePrinter")
void RustTypePrinter::AppendCallingConventionTokens(Type* type, Platform* platform, uint8_t baseConfidence,
vector<InstructionTextToken>& tokens)
{
- if (type->GetCallingConvention() && platform &&
- type->GetCallingConvention().GetValue() != platform->GetDefaultCallingConvention())
+ if (type->GetCallingConvention().GetValue() && platform
+ && type->GetCallingConvention().GetValue() != platform->GetDefaultCallingConvention())
{
uint8_t ccConfidence = type->GetCallingConvention().GetCombinedConfidence(baseConfidence);
tokens.emplace_back(baseConfidence, KeywordToken, "extern");
@@ -83,7 +83,7 @@ void RustTypePrinter::GetStructureMemberTokens(Platform* platform, Type* type, u
}
vector<InstructionTextToken> after =
- GetTypeTokensAfterName(members[i].type, platform, BN_FULL_CONFIDENCE, nullptr, escaping);
+ GetTypeTokensAfterName(members[i].type.GetValue(), platform, BN_FULL_CONFIDENCE, nullptr, escaping);
out.emplace_back(baseConfidence, FieldNameToken,
NameList::EscapeTypeName(members[i].name, escaping));
@@ -144,7 +144,7 @@ vector<InstructionTextToken> RustTypePrinter::GetTypeTokensAfterNameInternal(
if (i != 0)
tokens.emplace_back(baseConfidence, TextToken, ", ");
- vector<InstructionTextToken> paramTokens = GetTypeTokensAfterName(params[i].type, platform,
+ vector<InstructionTextToken> paramTokens = GetTypeTokensAfterName(params[i].type.GetValue(), platform,
params[i].type.GetCombinedConfidence(baseConfidence), type, escaping);
if (functionHeader)
@@ -219,10 +219,10 @@ vector<InstructionTextToken> RustTypePrinter::GetTypeTokensAfterNameInternal(
tokens.emplace_back(baseConfidence, TextToken, " -> ");
tokens.emplace_back(type->CanReturn().GetCombinedConfidence(baseConfidence), TextToken, "!");
}
- else if (type->GetChildType() && type->GetChildType()->GetClass() != VoidTypeClass)
+ else if (type->GetChildType().GetValue() && type->GetChildType()->GetClass() != VoidTypeClass)
{
tokens.emplace_back(baseConfidence, TextToken, " -> ");
- vector<InstructionTextToken> retn = GetTypeTokensAfterName(type->GetChildType(), platform,
+ vector<InstructionTextToken> retn = GetTypeTokensAfterName(type->GetChildType().GetValue(), platform,
type->GetChildType().GetCombinedConfidence(baseConfidence), type, escaping);
if (functionHeader)
{
@@ -287,8 +287,8 @@ vector<InstructionTextToken> RustTypePrinter::GetTypeTokensAfterNameInternal(
{
if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
- vector<InstructionTextToken> inner = GetTypeTokensAfterName(
- type->GetChildType(), platform, baseConfidence, type, escaping);
+ vector<InstructionTextToken> inner =
+ GetTypeTokensAfterName(type->GetChildType().GetValue(), platform, baseConfidence, type, escaping);
tokens.insert(tokens.end(), inner.begin(), inner.end());
return tokens;
}
@@ -299,7 +299,7 @@ vector<InstructionTextToken> RustTypePrinter::GetTypeTokensAfterNameInternal(
else
tokens.emplace_back(baseConfidence, KeywordToken, "mut");
tokens.emplace_back(baseConfidence, TextToken, " ");
- vector<InstructionTextToken> inner = GetTypeTokensAfterName(type->GetChildType(), platform,
+ vector<InstructionTextToken> inner = GetTypeTokensAfterName(type->GetChildType().GetValue(), platform,
type->GetChildType().GetCombinedConfidence(baseConfidence), type, escaping);
tokens.insert(tokens.end(), inner.begin(), inner.end());
break;
@@ -307,7 +307,7 @@ vector<InstructionTextToken> RustTypePrinter::GetTypeTokensAfterNameInternal(
case ArrayTypeClass:
{
tokens.emplace_back(baseConfidence, BraceToken, "[");
- vector<InstructionTextToken> inner = GetTypeTokensAfterName(type->GetChildType(), platform,
+ vector<InstructionTextToken> inner = GetTypeTokensAfterName(type->GetChildType().GetValue(), platform,
type->GetChildType().GetCombinedConfidence(baseConfidence), type, escaping);
tokens.insert(tokens.end(), inner.begin(), inner.end());
tokens.emplace_back(baseConfidence, TextToken, "; ");
diff --git a/mediumlevelilinstruction.cpp b/mediumlevelilinstruction.cpp
index ecdac2e8..5e5c28fb 100644
--- a/mediumlevelilinstruction.cpp
+++ b/mediumlevelilinstruction.cpp
@@ -1116,7 +1116,7 @@ char* MediumLevelILInstructionBase::Dump() const
{
text += "[instr " + to_string(instructionIndex) + "] ";
}
- Ref<Type> type = GetType();
+ Ref<Type> type = GetType().GetValue();
if (type)
{
text += "[type: " + type->GetString() + "] ";
@@ -3196,7 +3196,7 @@ fmt::format_context::iterator fmt::formatter<MediumLevelILInstruction>::format(c
{
fmt::format_to(ctx.out(), "[instr {}] ", obj.instructionIndex);
}
- Ref<Type> type = obj.GetType();
+ Ref<Type> type = obj.GetType().GetValue();
if (type)
{
fmt::format_to(ctx.out(), "[type: {}] ", type->GetString());
diff --git a/objectivec/objc.cpp b/objectivec/objc.cpp
index da531e80..a34cffe1 100644
--- a/objectivec/objc.cpp
+++ b/objectivec/objc.cpp
@@ -343,7 +343,7 @@ void ObjCProcessor::DefineObjCSymbol(
new Symbol(type, shortName, fullName, name, addr, LocalBinding, nameSpace), typeRef);
};
- auto defineSymbol = [this](Ref<Symbol> symbol, Ref<Type> type) {
+ auto defineSymbol = [this](Ref<Symbol> symbol, const Confidence<Ref<Type>>& type) {
uint64_t symbolAddress = symbol->GetAddress();
// Armv7/Thumb: This will rewrite the symbol's address.
// e.g. We pass in 0xc001, it will rewrite it to 0xc000 and create the function w/ the "thumb2" arch.
@@ -354,8 +354,8 @@ void ObjCProcessor::DefineObjCSymbol(
{
// For thumb2 we want to get the adjusted address, we can do that using the target function.
Ref<Function> targetFunction = m_data->GetAnalysisFunction(targetPlatform, symbolAddress);
- if (targetFunction && type)
- targetFunction->ApplyAutoDiscoveredType(type);
+ if (targetFunction && type.GetValue())
+ targetFunction->ApplyAutoDiscoveredType(type.GetValue());
auto adjustedSym = new Symbol(FunctionSymbol, symbol->GetShortName(), symbol->GetFullName(), symbol->GetRawName(), symbolAddress);
m_data->DefineAutoSymbol(adjustedSym);
diff --git a/plugins/rtti/itanium.cpp b/plugins/rtti/itanium.cpp
index bd031f6a..b8320ec8 100644
--- a/plugins/rtti/itanium.cpp
+++ b/plugins/rtti/itanium.cpp
@@ -691,20 +691,19 @@ std::optional<VirtualFunctionTableInfo> ItaniumRTTIProcessor::ProcessVFT(uint64_
Type::PointerType(addrSize, vFuncType, true), vFuncName, vFuncOffset);
vFuncIdx++;
}
- m_view->DefineType(typeId, vftTypeName,
- Confidence(TypeBuilder::StructureType(vftBuilder.Finalize()).Finalize(), RTTI_CONFIDENCE));
- }
+ m_view->DefineType(typeId, vftTypeName, TypeBuilder::StructureType(vftBuilder.Finalize()).Finalize());
+ }
- auto vftName = fmt::format("_vtable_for_{}", classInfo.className);
- // TODO: How to display base classes?
- if (baseClassInfo.has_value())
- vftName += fmt::format("{{for `{}'}}", baseClassInfo->className);
- auto vftSymbol = m_view->GetSymbolByAddress(vftAddr);
- if (vftSymbol != nullptr)
- m_view->UndefineAutoSymbol(vftSymbol);
- m_view->DefineAutoSymbol(new Symbol{DataSymbol, vftName, vftAddr});
- m_view->DefineDataVariable(vftAddr, Confidence(Type::NamedType(m_view, vftTypeName), RTTI_CONFIDENCE));
- return vftInfo;
+ auto vftName = fmt::format("_vtable_for_{}", classInfo.className);
+ // TODO: How to display base classes?
+ if (baseClassInfo.has_value())
+ vftName += fmt::format("{{for `{}'}}", baseClassInfo->className);
+ auto vftSymbol = m_view->GetSymbolByAddress(vftAddr);
+ if (vftSymbol != nullptr)
+ m_view->UndefineAutoSymbol(vftSymbol);
+ m_view->DefineAutoSymbol(new Symbol {DataSymbol, vftName, vftAddr});
+ m_view->DefineDataVariable(vftAddr, Confidence(Type::NamedType(m_view, vftTypeName), RTTI_CONFIDENCE));
+ return vftInfo;
}
diff --git a/plugins/rtti/microsoft.cpp b/plugins/rtti/microsoft.cpp
index d5e14648..856661b4 100644
--- a/plugins/rtti/microsoft.cpp
+++ b/plugins/rtti/microsoft.cpp
@@ -601,18 +601,17 @@ std::optional<VirtualFunctionTableInfo> MicrosoftRTTIProcessor::ProcessVFT(uint6
auto redirectTypeId = Type::GenerateAutoDebugTypeId(rootRedirectName);
// This will now create the redirect type MyClass::VTable for uninformed analysis to use.
// MyClass -> MyBase::MyClass::VTable (when MyBase offset is 0).
- m_view->DefineType(redirectTypeId, rootRedirectName, rootRedirectType);
- }
- m_view->DefineType(typeId, vftTypeName,
- Confidence(TypeBuilder::StructureType(vftBuilder.Finalize()).Finalize(), RTTI_CONFIDENCE));
- }
+ m_view->DefineType(redirectTypeId, rootRedirectName, rootRedirectType.GetValue());
+ }
+ m_view->DefineType(typeId, vftTypeName, TypeBuilder::StructureType(vftBuilder.Finalize()).Finalize());
+ }
- auto vftName = fmt::format("{}::`vftable'", classInfo.className);
- if (baseClassInfo.has_value())
- vftName += fmt::format("{{for `{}'}}", baseClassInfo->className);
- m_view->DefineAutoSymbol(new Symbol{DataSymbol, vftName, vftAddr});
- m_view->DefineDataVariable(vftAddr, Confidence(Type::NamedType(m_view, vftTypeName), RTTI_CONFIDENCE));
- return vftInfo;
+ auto vftName = fmt::format("{}::`vftable'", classInfo.className);
+ if (baseClassInfo.has_value())
+ vftName += fmt::format("{{for `{}'}}", baseClassInfo->className);
+ m_view->DefineAutoSymbol(new Symbol {DataSymbol, vftName, vftAddr});
+ m_view->DefineDataVariable(vftAddr, Confidence(Type::NamedType(m_view, vftTypeName), RTTI_CONFIDENCE));
+ return vftInfo;
}
diff --git a/python/generator.cpp b/python/generator.cpp
index 626efa12..3fdd2fe4 100644
--- a/python/generator.cpp
+++ b/python/generator.cpp
@@ -138,21 +138,21 @@ void OutputType(FILE* out, Type* type, bool isReturnType = false, bool isCallbac
else if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
fprintf(out, "ctypes.CFUNCTYPE(");
- OutputType(out, type->GetChildType()->GetChildType(), true, true);
+ OutputType(out, type->GetChildType()->GetChildType().GetValue(), true, true);
for (auto& i : type->GetChildType()->GetParameters())
{
fprintf(out, ", ");
- OutputType(out, i.type);
+ OutputType(out, i.type.GetValue());
}
fprintf(out, ")");
break;
}
fprintf(out, "ctypes.POINTER(");
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, ")");
break;
case ArrayTypeClass:
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, " * %" PRId64, type->GetElementCount());
break;
default:
@@ -203,21 +203,21 @@ void OutputSwizzledType(FILE* out, Type* type)
else if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
fprintf(out, "ctypes.CFUNCTYPE(");
- OutputType(out, type->GetChildType()->GetChildType(), true, true);
+ OutputType(out, type->GetChildType()->GetChildType().GetValue(), true, true);
for (auto& i : type->GetChildType()->GetParameters())
{
fprintf(out, ", ");
- OutputType(out, i.type);
+ OutputType(out, i.type.GetValue());
}
fprintf(out, ")");
break;
}
fprintf(out, "ctypes.POINTER(");
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, ")");
break;
case ArrayTypeClass:
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, " * %" PRId64, type->GetElementCount());
break;
default:
@@ -394,7 +394,7 @@ int main(int argc, char* argv[])
}
else
fprintf(out, "\t\t(\"%s\", ", j.name.c_str());
- OutputType(out, j.type);
+ OutputType(out, j.type.GetValue());
fprintf(out, "),\n");
}
fprintf(out, "\t]\n");
@@ -459,7 +459,7 @@ int main(int argc, char* argv[])
fprintf(out, "# %s\n\n", funcName.c_str());
fprintf(out, "%s = core.%s\n", funcName.c_str(), name.c_str());
fprintf(out, "%s.restype = ", funcName.c_str());
- OutputType(out, i.second->GetChildType(), true, callbackConvention);
+ OutputType(out, i.second->GetChildType().GetValue(), true, callbackConvention);
fprintf(out, "\n");
if (!i.second->HasVariableArguments())
{
@@ -472,11 +472,11 @@ int main(int argc, char* argv[])
// BNFreeString expects a pointer to a string allocated by the core, so do not use
// a c_char_p here, as that would be allocated by the Python runtime. This can
// be enforced by outputting like a return value.
- OutputType(out, j.type, true);
+ OutputType(out, j.type.GetValue(), true);
}
else
{
- OutputType(out, j.type);
+ OutputType(out, j.type.GetValue());
}
fprintf(out, ",\n");
}
@@ -521,16 +521,16 @@ int main(int argc, char* argv[])
fprintf(out, "\n\t\t");
fprintf(out, "%s: ", argName.c_str());
if (swizzleArgs)
- OutputSwizzledType(out, arg.type);
+ OutputSwizzledType(out, arg.type.GetValue());
else
- OutputType(out, arg.type);
+ OutputType(out, arg.type.GetValue());
argN++;
}
}
fprintf(out, "\n\t\t) -> ");
if (stringResult || pointerResult)
fprintf(out, "Optional[");
- OutputSwizzledType(out, i.second->GetChildType());
+ OutputSwizzledType(out, i.second->GetChildType().GetValue());
if (stringResult || pointerResult)
fprintf(out, "]");
fprintf(out, ":\n");
diff --git a/type.cpp b/type.cpp
index 4de8fc91..9dccede1 100644
--- a/type.cpp
+++ b/type.cpp
@@ -976,7 +976,7 @@ Ref<Type> Type::FunctionType(const Confidence<Ref<Type>>& returnValue,
returnValueConf.confidence = returnValue.GetConfidence();
BNCallingConventionWithConfidence callingConventionConf;
- callingConventionConf.convention = callingConvention ? callingConvention->GetObject() : nullptr;
+ callingConventionConf.convention = callingConvention.GetValue() ? callingConvention->GetObject() : nullptr;
callingConventionConf.confidence = callingConvention.GetConfidence();
BNFunctionParameter* paramArray = new BNFunctionParameter[params.size()];
@@ -1036,7 +1036,7 @@ Ref<Type> Type::FunctionType(const Confidence<Ref<Type>>& returnValue,
returnValueConf.confidence = returnValue.GetConfidence();
BNCallingConventionWithConfidence callingConventionConf;
- callingConventionConf.convention = callingConvention ? callingConvention->GetObject() : nullptr;
+ callingConventionConf.convention = callingConvention.GetValue() ? callingConvention->GetObject() : nullptr;
callingConventionConf.confidence = callingConvention.GetConfidence();
BNFunctionParameter* paramArray = new BNFunctionParameter[params.size()];
@@ -1981,7 +1981,7 @@ TypeBuilder TypeBuilder::FunctionType(const Confidence<Ref<Type>>& returnValue,
returnValueConf.confidence = returnValue.GetConfidence();
BNCallingConventionWithConfidence callingConventionConf;
- callingConventionConf.convention = callingConvention ? callingConvention->GetObject() : nullptr;
+ callingConventionConf.convention = callingConvention.GetValue() ? callingConvention->GetObject() : nullptr;
callingConventionConf.confidence = callingConvention.GetConfidence();
size_t paramCount = 0;
@@ -2032,7 +2032,7 @@ TypeBuilder TypeBuilder::FunctionType(const Confidence<Ref<Type>>& returnValue,
returnValueConf.confidence = returnValue.GetConfidence();
BNCallingConventionWithConfidence callingConventionConf;
- callingConventionConf.convention = callingConvention ? callingConvention->GetObject() : nullptr;
+ callingConventionConf.convention = callingConvention.GetValue() ? callingConvention->GetObject() : nullptr;
callingConventionConf.confidence = callingConvention.GetConfidence();
BNFunctionParameter* paramArray = new BNFunctionParameter[params.size()];
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index d8a0a112..b8dd1aaa 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -2396,7 +2396,8 @@ bool ElfView::Init()
);
/* create type, associate it with RTL_Resolve */
- Ref<Type> ptr_type = Type::PointerType(m_arch, Type::VoidType())->WithConfidence(BN_FULL_CONFIDENCE);
+ Confidence<Ref<Type>> ptr_type =
+ Type::PointerType(m_arch, Type::VoidType())->WithConfidence(BN_FULL_CONFIDENCE);
Ref<CallingConvention> cc = m_arch->GetCallingConventionByName("linux-rtlresolve");
@@ -2452,20 +2453,20 @@ bool ElfView::Init()
void ElfView::DefineElfSymbol(BNSymbolType type, const string& incomingName, uint64_t addr, bool gotEntry,
- BNSymbolBinding binding, size_t size, Ref<Type> typeObj)
+ BNSymbolBinding binding, size_t size, const Confidence<Ref<Type>>& typeObj)
{
// Ensure symbol is within the executable
if (type != ExternalSymbol && !IsValidOffset(addr))
return;
string name = incomingName;
- Ref<Type> symbolTypeRef;
+ Confidence<Ref<Type>> symbolTypeRef;
if ((type == ExternalSymbol) || (type == ImportAddressSymbol) || (type == ImportedDataSymbol))
{
QualifiedName n(name);
Ref<TypeLibrary> lib = nullptr;
symbolTypeRef = ImportTypeLibraryObject(lib, n);
- if (symbolTypeRef)
+ if (symbolTypeRef.GetValue())
{
m_logger->LogDebug("elf: type Library '%s' found hit for '%s'", lib->GetName().c_str(), name.c_str());
if (type != ExternalSymbol || addr != 0)
diff --git a/view/elf/elfview.h b/view/elf/elfview.h
index 23a5021a..a43716b7 100644
--- a/view/elf/elfview.h
+++ b/view/elf/elfview.h
@@ -518,7 +518,7 @@ namespace BinaryNinja
SymbolQueue* m_symbolQueue = nullptr;
void DefineElfSymbol(BNSymbolType type, const std::string& name, uint64_t addr, bool gotEntry,
- BNSymbolBinding binding, size_t size=0, Ref<Type> typeObj=nullptr);
+ BNSymbolBinding binding, size_t size = 0, const Confidence<Ref<Type>>& typeObj = nullptr);
void ApplyTypesToParentStringTable(const Elf64SectionHeader& section, const bool offset = true);
void ApplyTypesToStringTable(const Elf64SectionHeader& section, const int64_t imageBaseAdjustment, const bool offset = true);
diff --git a/view/kernelcache/api/python/generator.cpp b/view/kernelcache/api/python/generator.cpp
index 89a187fa..31d5432c 100644
--- a/view/kernelcache/api/python/generator.cpp
+++ b/view/kernelcache/api/python/generator.cpp
@@ -142,21 +142,21 @@ void OutputType(FILE* out, Type* type, bool isReturnType = false, bool isCallbac
else if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
fprintf(out, "ctypes.CFUNCTYPE(");
- OutputType(out, type->GetChildType()->GetChildType(), true, true);
+ OutputType(out, type->GetChildType()->GetChildType().GetValue(), true, true);
for (auto& i : type->GetChildType()->GetParameters())
{
fprintf(out, ", ");
- OutputType(out, i.type);
+ OutputType(out, i.type.GetValue());
}
fprintf(out, ")");
break;
}
fprintf(out, "ctypes.POINTER(");
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, ")");
break;
case ArrayTypeClass:
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, " * %" PRId64, type->GetElementCount());
break;
default:
@@ -213,21 +213,21 @@ void OutputSwizzledType(FILE* out, Type* type)
else if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
fprintf(out, "ctypes.CFUNCTYPE(");
- OutputType(out, type->GetChildType()->GetChildType(), true, true);
+ OutputType(out, type->GetChildType()->GetChildType().GetValue(), true, true);
for (auto& i : type->GetChildType()->GetParameters())
{
fprintf(out, ", ");
- OutputType(out, i.type);
+ OutputType(out, i.type.GetValue());
}
fprintf(out, ")");
break;
}
fprintf(out, "ctypes.POINTER(");
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, ")");
break;
case ArrayTypeClass:
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, " * %" PRId64, type->GetElementCount());
break;
default:
@@ -397,7 +397,7 @@ int main(int argc, char* argv[])
}
else
fprintf(out, "\t\t(\"%s\", ", j.name.c_str());
- OutputType(out, j.type);
+ OutputType(out, j.type.GetValue());
fprintf(out, "),\n");
}
fprintf(out, "\t]\n");
@@ -467,7 +467,7 @@ int main(int argc, char* argv[])
fprintf(out, "# %s\n\n", funcName.c_str());
fprintf(out, "%s = core.%s\n", funcName.c_str(), name.c_str());
fprintf(out, "%s.restype = ", funcName.c_str());
- OutputType(out, i.second->GetChildType(), true, callbackConvention);
+ OutputType(out, i.second->GetChildType().GetValue(), true, callbackConvention);
fprintf(out, "\n");
if (!i.second->HasVariableArguments())
{
@@ -480,11 +480,11 @@ int main(int argc, char* argv[])
// BNDebuggerFreeString expects a pointer to a string allocated by the core, so do not use
// a c_char_p here, as that would be allocated by the Python runtime. This can
// be enforced by outputting like a return value.
- OutputType(out, j.type, true);
+ OutputType(out, j.type.GetValue(), true);
}
else
{
- OutputType(out, j.type);
+ OutputType(out, j.type.GetValue());
}
fprintf(out, ",\n");
}
@@ -528,9 +528,9 @@ int main(int argc, char* argv[])
fprintf(out, "\n\t\t");
fprintf(out, "%s: ", argName.c_str());
if (swizzleArgs)
- OutputSwizzledType(out, arg.type);
+ OutputSwizzledType(out, arg.type.GetValue());
else
- OutputType(out, arg.type);
+ OutputType(out, arg.type.GetValue());
argN ++;
}
}
@@ -539,13 +539,13 @@ int main(int argc, char* argv[])
{
if (stringResult || pointerResult)
fprintf(out, "Optional[");
- OutputSwizzledType(out, i.second->GetChildType());
+ OutputSwizzledType(out, i.second->GetChildType().GetValue());
if (stringResult || pointerResult)
fprintf(out, "]");
}
else
{
- OutputType(out, i.second->GetChildType());
+ OutputType(out, i.second->GetChildType().GetValue());
}
fprintf(out, ":\n");
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp
index 26839c93..3d8b0186 100644
--- a/view/macho/machoview.cpp
+++ b/view/macho/machoview.cpp
@@ -2478,7 +2478,7 @@ Ref<Symbol> MachoView::DefineMachoSymbol(
if (deferred)
{
- m_symbolQueue->Append(process, [this](Symbol* symbol, Type* type) {
+ m_symbolQueue->Append(process, [this](Symbol* symbol, const Confidence<Ref<Type>>& type) {
DefineAutoSymbolAndVariableOrFunction(GetDefaultPlatform(), symbol, type);
});
return nullptr;
diff --git a/view/md1rom/md1rom.cpp b/view/md1rom/md1rom.cpp
index 1d8da293..b302cfb0 100644
--- a/view/md1rom/md1rom.cpp
+++ b/view/md1rom/md1rom.cpp
@@ -230,7 +230,7 @@ void Md1romView::DefineMd1RomSymbol(BNSymbolType type, const string& name, uint6
if (m_symbolQueue)
{
- m_symbolQueue->Append(process, [this](Symbol* symbol, Type* type) {
+ m_symbolQueue->Append(process, [this](Symbol* symbol, const Confidence<Ref<Type>>& type) {
DefineAutoSymbolAndVariableOrFunction(GetDefaultPlatform(), symbol, type);
});
}
diff --git a/view/pe/peview.cpp b/view/pe/peview.cpp
index 6c852bca..e45edd05 100644
--- a/view/pe/peview.cpp
+++ b/view/pe/peview.cpp
@@ -3003,7 +3003,7 @@ void PEView::AddPESymbol(BNSymbolType type, const string& dll, const string& nam
new Symbol(type, shortName, fullName, rawName, address, binding, ns, ordinal),
typeRef);
},
- [this](Symbol* symbol, Type* type) {
+ [this](Symbol* symbol, const Confidence<Ref<Type>>& type) {
DefineAutoSymbolAndVariableOrFunction(GetDefaultPlatform(), symbol, type);
});
}
diff --git a/view/sharedcache/api/python/generator.cpp b/view/sharedcache/api/python/generator.cpp
index 89a187fa..31d5432c 100644
--- a/view/sharedcache/api/python/generator.cpp
+++ b/view/sharedcache/api/python/generator.cpp
@@ -142,21 +142,21 @@ void OutputType(FILE* out, Type* type, bool isReturnType = false, bool isCallbac
else if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
fprintf(out, "ctypes.CFUNCTYPE(");
- OutputType(out, type->GetChildType()->GetChildType(), true, true);
+ OutputType(out, type->GetChildType()->GetChildType().GetValue(), true, true);
for (auto& i : type->GetChildType()->GetParameters())
{
fprintf(out, ", ");
- OutputType(out, i.type);
+ OutputType(out, i.type.GetValue());
}
fprintf(out, ")");
break;
}
fprintf(out, "ctypes.POINTER(");
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, ")");
break;
case ArrayTypeClass:
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, " * %" PRId64, type->GetElementCount());
break;
default:
@@ -213,21 +213,21 @@ void OutputSwizzledType(FILE* out, Type* type)
else if (type->GetChildType()->GetClass() == FunctionTypeClass)
{
fprintf(out, "ctypes.CFUNCTYPE(");
- OutputType(out, type->GetChildType()->GetChildType(), true, true);
+ OutputType(out, type->GetChildType()->GetChildType().GetValue(), true, true);
for (auto& i : type->GetChildType()->GetParameters())
{
fprintf(out, ", ");
- OutputType(out, i.type);
+ OutputType(out, i.type.GetValue());
}
fprintf(out, ")");
break;
}
fprintf(out, "ctypes.POINTER(");
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, ")");
break;
case ArrayTypeClass:
- OutputType(out, type->GetChildType());
+ OutputType(out, type->GetChildType().GetValue());
fprintf(out, " * %" PRId64, type->GetElementCount());
break;
default:
@@ -397,7 +397,7 @@ int main(int argc, char* argv[])
}
else
fprintf(out, "\t\t(\"%s\", ", j.name.c_str());
- OutputType(out, j.type);
+ OutputType(out, j.type.GetValue());
fprintf(out, "),\n");
}
fprintf(out, "\t]\n");
@@ -467,7 +467,7 @@ int main(int argc, char* argv[])
fprintf(out, "# %s\n\n", funcName.c_str());
fprintf(out, "%s = core.%s\n", funcName.c_str(), name.c_str());
fprintf(out, "%s.restype = ", funcName.c_str());
- OutputType(out, i.second->GetChildType(), true, callbackConvention);
+ OutputType(out, i.second->GetChildType().GetValue(), true, callbackConvention);
fprintf(out, "\n");
if (!i.second->HasVariableArguments())
{
@@ -480,11 +480,11 @@ int main(int argc, char* argv[])
// BNDebuggerFreeString expects a pointer to a string allocated by the core, so do not use
// a c_char_p here, as that would be allocated by the Python runtime. This can
// be enforced by outputting like a return value.
- OutputType(out, j.type, true);
+ OutputType(out, j.type.GetValue(), true);
}
else
{
- OutputType(out, j.type);
+ OutputType(out, j.type.GetValue());
}
fprintf(out, ",\n");
}
@@ -528,9 +528,9 @@ int main(int argc, char* argv[])
fprintf(out, "\n\t\t");
fprintf(out, "%s: ", argName.c_str());
if (swizzleArgs)
- OutputSwizzledType(out, arg.type);
+ OutputSwizzledType(out, arg.type.GetValue());
else
- OutputType(out, arg.type);
+ OutputType(out, arg.type.GetValue());
argN ++;
}
}
@@ -539,13 +539,13 @@ int main(int argc, char* argv[])
{
if (stringResult || pointerResult)
fprintf(out, "Optional[");
- OutputSwizzledType(out, i.second->GetChildType());
+ OutputSwizzledType(out, i.second->GetChildType().GetValue());
if (stringResult || pointerResult)
fprintf(out, "]");
}
else
{
- OutputType(out, i.second->GetChildType());
+ OutputType(out, i.second->GetChildType().GetValue());
}
fprintf(out, ":\n");