tango.core.tools.Demangler

D symbol name demangling
Attempts to demangle D symbols generated by the DMD frontend. (Which is not always technically possible)

A sample program demangling the names passed as arguments {{{ module demangle; import tango.core.tools.Demangler; import tango.io.Stdout;

void usage(){ Stdout("demangle [--help] [--level 0-9] mangledName1 [mangledName2...]").newline; }

int main(char[][]args){ uint start=1; if (args.length>1) { if (args[start]=="--help"){ usage(); ++start; } if (args[start]=="--level"){ ++start; if (args.length==start || args[start].length!=1 || args[start][0]<'0' || args[start][0]>'9') { Stdout("invalid level '")((args.length==start)?"*missing*":args[start]) ("' (must be 0-9)").newline; usage(); return 2; } demangler.verbosity=args[start+1][0]-'0'; ++start; } } else { usage(); return 0; } foreach (n;args[start..$]){ Stdout(demangler.demangle(n)).newline; } return 0; } }}}

License:

tango license, apache 2.0

Authors:

Zygfryd (aka Hxal), Fawzi
char[] decompressSymbol(char[] func, char[]* buf) #
decompresses a symbol and returns the full symbol, and possibly a reduced buffer space (does something only on windows with DMD)
class Demangler [public] #
Flexible demangler Attempts to demangle D symbols generated by the DMD frontend. (Which is not always technically possible)
uint templateExpansionDepth #
How deeply to recurse printing template parameters, for depths greater than this, an ellipsis is used
bool foldDefaults #
Skip default members of templates (sole members named after the template)
bool expandFunctionTypes #
Print types of functions being part of the main symbol
bool printTypeKind #
For composite types, print the kind (class|struct|etc.) of the type
void verbosity(uint level) [public] #
sets the verbosity level of the demangler (template expansion level,...)
this() #
creates a demangler
this(uint verbosityLevel) #
creates a demangler with the given verbosity level
char[] demangle(char[] input) [public] #
demangles the given string
char[] demangle(char[] input, char[] output) [public] #
demangles the given string using output to hold the result
struct DemangleInstance #
this represents a single demangling request, and is the place where the real work is done some more cleanup would probably be in order (maybe remove Buffer)
Demangler demangler [static] #
the default demangler