Marshaling of hasThisPointer property

This commit is contained in:
caheckman 2020-07-23 14:48:03 -04:00
parent afa4994576
commit db139d2b81
4 changed files with 32 additions and 20 deletions

View file

@ -3683,8 +3683,6 @@ void FuncProto::saveXml(ostream &s) const
a_v_b(s,"constructor",true);
if (isDestructor())
a_v_b(s,"destructor",true);
if (hasThisPointer())
a_v_b(s,"hasthis",true);
s << ">\n";
ProtoParameter *outparam = store->getOutput();
s << " <returnsym";
@ -3828,10 +3826,6 @@ void FuncProto::restoreXml(const Element *el,Architecture *glb)
if (xml_readbool(el->getAttributeValue(i)))
flags |= is_destructor;
}
else if (attrname == "hasthis") {
if (xml_readbool(el->getAttributeValue(i)))
flags |= has_thisptr;
}
}
if (mod != (ProtoModel *)0) // If a model was specified
setModel(mod); // This sets extrapop to model default

View file

@ -37,7 +37,7 @@ PrintLanguage *PrintJavaCapability::buildLanguage(Architecture *glb)
PrintJava::PrintJava(Architecture *glb,const string &nm) : PrintC(glb,nm)
{
option_NULL = true; // Automatically use 'null' token
resetDefaultsPrintJava();
nullToken = "null"; // Java standard lower-case 'null'
mods |= hide_thisparam; // turn on hiding of 'this' parameter
if (castStrategy != (CastStrategy *)0)
@ -46,6 +46,13 @@ PrintJava::PrintJava(Architecture *glb,const string &nm) : PrintC(glb,nm)
castStrategy = new CastStrategyJava();
}
void PrintJava::resetDefaults(void)
{
PrintC::resetDefaults();
resetDefaultsPrintJava();
}
void PrintJava::docFunction(const Funcdata *fd)
{
@ -148,6 +155,13 @@ bool PrintJava::isArrayType(const Datatype *ct)
return false;
}
void PrintJava::resetDefaultsPrintJava(void)
{
option_NULL = true; // Automatically use 'null' token
option_convention = false; // Automatically hide convention name
}
/// Assuming the given Varnode is a dereferenced pointer, determine whether
/// it needs to be represented using '[0]' syntax.
/// \param vn is the given Varnode

View file

@ -56,9 +56,11 @@ class PrintJava : public PrintC {
static OpToken instanceof; ///< The \b instanceof keyword
static bool isArrayType(const Datatype *ct); ///< Does the given data-type reference a java array
static bool needZeroArray(const Varnode *vn); ///< Do we need '[0]' syntax.
void resetDefaultsPrintJava(void); ///< Set options that are specific to Java
virtual void printUnicode(ostream &s,int4 onechar) const;
public:
PrintJava(Architecture *g,const string &nm="java-language"); ///< Constructor
virtual void resetDefaults(void);
virtual void docFunction(const Funcdata *fd);
virtual void pushTypeStart(const Datatype *ct,bool noident);
virtual void pushTypeEnd(const Datatype *ct);