2018-09-15 14:29:18 +01:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
public enum CV
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
|
|
|
None,
|
|
|
|
Const,
|
|
|
|
Volatile,
|
|
|
|
Restricted = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum Reference
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
RValue,
|
|
|
|
LValue
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public class CVType : ParentNode
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
public CV Qualifier;
|
2018-09-15 14:29:18 +01:00
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public CVType(CV Qualifier, BaseNode Child) : base(NodeType.CVQualifierType, Child)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
this.Qualifier = Qualifier;
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public void PrintQualifier(TextWriter Writer)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
if ((Qualifier & CV.Const) != 0)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write(" const");
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
if ((Qualifier & CV.Volatile) != 0)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write(" volatile");
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
if ((Qualifier & CV.Restricted) != 0)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write(" restrict");
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public override void PrintLeft(TextWriter Writer)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Child.PrintLeft(Writer);
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
PrintQualifier(Writer);
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool HasRightPart()
|
|
|
|
{
|
|
|
|
return Child != null && Child.HasRightPart();
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public override void PrintRight(TextWriter Writer)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Child.PrintRight(Writer);
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class SimpleReferenceType : ParentNode
|
|
|
|
{
|
|
|
|
public Reference Qualifier;
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public SimpleReferenceType(Reference Qualifier, BaseNode Child) : base(NodeType.SimpleReferenceType, Child)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
this.Qualifier = Qualifier;
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public void PrintQualifier(TextWriter Writer)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
|
|
|
if ((Qualifier & Reference.LValue) != 0)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write("&");
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((Qualifier & Reference.RValue) != 0)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write("&&");
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public override void PrintLeft(TextWriter Writer)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Child.PrintLeft(Writer);
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
else if (Qualifier != Reference.None)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write(" ");
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
PrintQualifier(Writer);
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool HasRightPart()
|
|
|
|
{
|
|
|
|
return Child != null && Child.HasRightPart();
|
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public override void PrintRight(TextWriter Writer)
|
2018-09-15 14:29:18 +01:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Child.PrintRight(Writer);
|
2018-09-15 14:29:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|