@@ -8,8 +8,12 @@ using namespace BinaryNinja;
8
8
9
9
PseudoCFunction::PseudoCFunction (LanguageRepresentationFunctionType* type, Architecture* arch, Function* owner,
10
10
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 ())
12
13
{
14
+ if (!m_typePrinter) {
15
+ m_typePrinter = TypePrinter::GetDefault ();
16
+ }
13
17
}
14
18
15
19
@@ -177,11 +181,7 @@ BNSymbolDisplayResult PseudoCFunction::AppendPointerTextToken(const HighLevelILI
177
181
178
182
string PseudoCFunction::GetSizeToken (size_t size, bool isSigned)
179
183
{
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 ());
185
185
}
186
186
187
187
@@ -546,11 +546,8 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
546
546
{
547
547
tokens.AppendOpenParen ();
548
548
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 ());
554
551
for (auto & token: typeTokens)
555
552
{
556
553
tokens.Append (token);
@@ -1004,14 +1001,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
1004
1001
1005
1002
const auto variableType = GetHighLevelILFunction ()->GetFunction ()->GetVariableType (destExpr);
1006
1003
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> {};
1015
1010
1016
1011
// Check to see if the variable appears live
1017
1012
bool appearsDead = false ;
@@ -1070,14 +1065,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
1070
1065
1071
1066
const auto variableType = GetHighLevelILFunction ()->GetFunction ()->GetVariableType (variable);
1072
1067
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> {};
1081
1074
1082
1075
if (variableType)
1083
1076
{
@@ -2848,6 +2841,11 @@ string PseudoCFunction::GetAnnotationEndString() const
2848
2841
return " */" ;
2849
2842
}
2850
2843
2844
+ TypePrinter* PseudoCFunction::GetTypePrinter () const
2845
+ {
2846
+ return m_typePrinter;
2847
+ }
2848
+
2851
2849
2852
2850
PseudoCFunctionType::PseudoCFunctionType (): LanguageRepresentationFunctionType(" Pseudo C" )
2853
2851
{
0 commit comments