Rewrite the C++ Demangler (#416)
* Rewrite the C++ Demangler This new Demangler provides support to almost every possible mangled symbols and should behaves like GNU c++filt. It works on 98.9% of the sdk's symbols and 99.5% of Puyo Puyo Tetris's symbols. * Fix code style * Fix noexcept enclosed expression parsing issues * fix code style issues
This commit is contained in:
parent
7542f4a65f
commit
46a11460d4
54 changed files with 5113 additions and 417 deletions
120
Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs
Normal file
120
Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
using System.IO;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
||||
{
|
||||
public enum CV
|
||||
{
|
||||
None,
|
||||
Const,
|
||||
Volatile,
|
||||
Restricted = 4
|
||||
}
|
||||
|
||||
public enum Reference
|
||||
{
|
||||
None,
|
||||
RValue,
|
||||
LValue
|
||||
}
|
||||
|
||||
public class CVType : ParentNode
|
||||
{
|
||||
public CV Qualifier;
|
||||
|
||||
public CVType(CV Qualifier, BaseNode Child) : base(NodeType.CVQualifierType, Child)
|
||||
{
|
||||
this.Qualifier = Qualifier;
|
||||
}
|
||||
|
||||
public void PrintQualifier(TextWriter Writer)
|
||||
{
|
||||
if ((Qualifier & CV.Const) != 0)
|
||||
{
|
||||
Writer.Write(" const");
|
||||
}
|
||||
|
||||
if ((Qualifier & CV.Volatile) != 0)
|
||||
{
|
||||
Writer.Write(" volatile");
|
||||
}
|
||||
|
||||
if ((Qualifier & CV.Restricted) != 0)
|
||||
{
|
||||
Writer.Write(" restrict");
|
||||
}
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter Writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintLeft(Writer);
|
||||
}
|
||||
|
||||
PrintQualifier(Writer);
|
||||
}
|
||||
|
||||
public override bool HasRightPart()
|
||||
{
|
||||
return Child != null && Child.HasRightPart();
|
||||
}
|
||||
|
||||
public override void PrintRight(TextWriter Writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintRight(Writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleReferenceType : ParentNode
|
||||
{
|
||||
public Reference Qualifier;
|
||||
|
||||
public SimpleReferenceType(Reference Qualifier, BaseNode Child) : base(NodeType.SimpleReferenceType, Child)
|
||||
{
|
||||
this.Qualifier = Qualifier;
|
||||
}
|
||||
|
||||
public void PrintQualifier(TextWriter Writer)
|
||||
{
|
||||
if ((Qualifier & Reference.LValue) != 0)
|
||||
{
|
||||
Writer.Write("&");
|
||||
}
|
||||
|
||||
if ((Qualifier & Reference.RValue) != 0)
|
||||
{
|
||||
Writer.Write("&&");
|
||||
}
|
||||
}
|
||||
|
||||
public override void PrintLeft(TextWriter Writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintLeft(Writer);
|
||||
}
|
||||
else if (Qualifier != Reference.None)
|
||||
{
|
||||
Writer.Write(" ");
|
||||
}
|
||||
|
||||
PrintQualifier(Writer);
|
||||
}
|
||||
|
||||
public override bool HasRightPart()
|
||||
{
|
||||
return Child != null && Child.HasRightPart();
|
||||
}
|
||||
|
||||
public override void PrintRight(TextWriter Writer)
|
||||
{
|
||||
if (Child != null)
|
||||
{
|
||||
Child.PrintRight(Writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue