@@ -8,8 +8,12 @@ using namespace BinaryNinja;
88
99PseudoCFunction::PseudoCFunction (LanguageRepresentationFunctionType* type, Architecture* arch, Function* owner,
1010 HighLevelILFunction* highLevelILFunction) :
11- LanguageRepresentationFunction(type, arch, owner, highLevelILFunction), m_highLevelIL(highLevelILFunction)
11+ LanguageRepresentationFunction(type, arch, owner, highLevelILFunction), m_highLevelIL(highLevelILFunction),
12+ m_typePrinter(type->GetTypePrinter ())
1213{
14+ if (!m_typePrinter) {
15+ m_typePrinter = TypePrinter::GetDefault ();
16+ }
1317}
1418
1519
@@ -177,11 +181,7 @@ BNSymbolDisplayResult PseudoCFunction::AppendPointerTextToken(const HighLevelILI
177181
178182string PseudoCFunction::GetSizeToken (size_t size, bool isSigned)
179183{
180- return TypePrinter::GetDefault ()->GetTypeString (
181- Type::IntegerType (size, isSigned),
182- nullptr ,
183- QualifiedName ()
184- );
184+ return GetTypePrinter ()->GetTypeString (Type::IntegerType (size, isSigned), nullptr , QualifiedName ());
185185}
186186
187187
@@ -546,11 +546,8 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
546546 {
547547 tokens.AppendOpenParen ();
548548 tokens.AppendOpenParen ();
549- auto typeTokens = TypePrinter::GetDefault ()->GetTypeTokens (
550- instr.GetType (),
551- GetArchitecture ()->GetStandalonePlatform (),
552- QualifiedName ()
553- );
549+ auto typeTokens = GetTypePrinter ()->GetTypeTokens (
550+ instr.GetType (), GetArchitecture ()->GetStandalonePlatform (), QualifiedName ());
554551 for (auto & token: typeTokens)
555552 {
556553 tokens.Append (token);
@@ -1004,14 +1001,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
10041001
10051002 const auto variableType = GetHighLevelILFunction ()->GetFunction ()->GetVariableType (destExpr);
10061003 const auto platform = GetHighLevelILFunction ()->GetFunction ()->GetPlatform ();
1007- const auto prevTypeTokens =
1008- variableType ?
1009- TypePrinter::GetDefault ()->GetTypeTokensBeforeName (variableType, platform, variableType.GetConfidence ()) :
1010- vector<InstructionTextToken>{};
1011- const auto postTypeTokens =
1012- variableType ?
1013- TypePrinter::GetDefault ()->GetTypeTokensAfterName (variableType, platform, variableType.GetConfidence ()) :
1014- vector<InstructionTextToken>{};
1004+ const auto prevTypeTokens = variableType ?
1005+ GetTypePrinter ()->GetTypeTokensBeforeName (variableType, platform, variableType.GetConfidence ()) :
1006+ vector<InstructionTextToken> {};
1007+ const auto postTypeTokens = variableType ?
1008+ GetTypePrinter ()->GetTypeTokensAfterName (variableType, platform, variableType.GetConfidence ()) :
1009+ vector<InstructionTextToken> {};
10151010
10161011 // Check to see if the variable appears live
10171012 bool appearsDead = false ;
@@ -1070,14 +1065,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
10701065
10711066 const auto variableType = GetHighLevelILFunction ()->GetFunction ()->GetVariableType (variable);
10721067 const auto platform = GetHighLevelILFunction ()->GetFunction ()->GetPlatform ();
1073- const auto prevTypeTokens =
1074- variableType ?
1075- TypePrinter::GetDefault ()->GetTypeTokensBeforeName (variableType, platform, variableType.GetConfidence ()) :
1076- vector<InstructionTextToken>{};
1077- const auto postTypeTokens =
1078- variableType ?
1079- TypePrinter::GetDefault ()->GetTypeTokensAfterName (variableType, platform, variableType.GetConfidence ()) :
1080- vector<InstructionTextToken>{};
1068+ const auto prevTypeTokens = variableType ?
1069+ GetTypePrinter ()->GetTypeTokensBeforeName (variableType, platform, variableType.GetConfidence ()) :
1070+ vector<InstructionTextToken> {};
1071+ const auto postTypeTokens = variableType ?
1072+ GetTypePrinter ()->GetTypeTokensAfterName (variableType, platform, variableType.GetConfidence ()) :
1073+ vector<InstructionTextToken> {};
10811074
10821075 if (variableType)
10831076 {
@@ -2848,6 +2841,11 @@ string PseudoCFunction::GetAnnotationEndString() const
28482841 return " */" ;
28492842}
28502843
2844+ TypePrinter* PseudoCFunction::GetTypePrinter () const
2845+ {
2846+ return m_typePrinter;
2847+ }
2848+
28512849
28522850PseudoCFunctionType::PseudoCFunctionType (): LanguageRepresentationFunctionType(" Pseudo C" )
28532851{
0 commit comments