@@ -8,7 +8,8 @@ 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
{
13
14
}
14
15
@@ -177,11 +178,7 @@ BNSymbolDisplayResult PseudoCFunction::AppendPointerTextToken(const HighLevelILI
177
178
178
179
string PseudoCFunction::GetSizeToken (size_t size, bool isSigned)
179
180
{
180
- return TypePrinter::GetDefault ()->GetTypeString (
181
- Type::IntegerType (size, isSigned),
182
- nullptr ,
183
- QualifiedName ()
184
- );
181
+ return GetTypePrinter ()->GetTypeString (Type::IntegerType (size, isSigned), nullptr , QualifiedName ());
185
182
}
186
183
187
184
@@ -546,11 +543,8 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
546
543
{
547
544
tokens.AppendOpenParen ();
548
545
tokens.AppendOpenParen ();
549
- auto typeTokens = TypePrinter::GetDefault ()->GetTypeTokens (
550
- instr.GetType (),
551
- GetArchitecture ()->GetStandalonePlatform (),
552
- QualifiedName ()
553
- );
546
+ auto typeTokens = GetTypePrinter ()->GetTypeTokens (
547
+ instr.GetType (), GetArchitecture ()->GetStandalonePlatform (), QualifiedName ());
554
548
for (auto & token: typeTokens)
555
549
{
556
550
tokens.Append (token);
@@ -1004,14 +998,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
1004
998
1005
999
const auto variableType = GetHighLevelILFunction ()->GetFunction ()->GetVariableType (destExpr);
1006
1000
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>{};
1001
+ const auto prevTypeTokens = variableType ?
1002
+ GetTypePrinter ()->GetTypeTokensBeforeName (variableType, platform, variableType.GetConfidence ()) :
1003
+ vector<InstructionTextToken> {};
1004
+ const auto postTypeTokens = variableType ?
1005
+ GetTypePrinter ()->GetTypeTokensAfterName (variableType, platform, variableType.GetConfidence ()) :
1006
+ vector<InstructionTextToken> {};
1015
1007
1016
1008
// Check to see if the variable appears live
1017
1009
bool appearsDead = false ;
@@ -1070,14 +1062,12 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H
1070
1062
1071
1063
const auto variableType = GetHighLevelILFunction ()->GetFunction ()->GetVariableType (variable);
1072
1064
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>{};
1065
+ const auto prevTypeTokens = variableType ?
1066
+ GetTypePrinter ()->GetTypeTokensBeforeName (variableType, platform, variableType.GetConfidence ()) :
1067
+ vector<InstructionTextToken> {};
1068
+ const auto postTypeTokens = variableType ?
1069
+ GetTypePrinter ()->GetTypeTokensAfterName (variableType, platform, variableType.GetConfidence ()) :
1070
+ vector<InstructionTextToken> {};
1081
1071
1082
1072
if (variableType)
1083
1073
{
@@ -2848,6 +2838,11 @@ string PseudoCFunction::GetAnnotationEndString() const
2848
2838
return " */" ;
2849
2839
}
2850
2840
2841
+ TypePrinter* PseudoCFunction::GetTypePrinter () const
2842
+ {
2843
+ return m_typePrinter;
2844
+ }
2845
+
2851
2846
2852
2847
PseudoCFunctionType::PseudoCFunctionType (): LanguageRepresentationFunctionType(" Pseudo C" )
2853
2848
{
0 commit comments