demangling (Ubuntu 64bit 12.04, dmd 64bit 2.060)

Carl Sturtivant sturtivant at gmail.com
Sun Aug 26 12:24:01 PDT 2012


>> Here are some examples that are not demangled by 
>> std.demangle.demangle :
>> 
>> _D13libd_demangle12__ModuleInfoZ
>> _D15TypeInfo_Struct6__vtblZ
>> _D3std5stdio12__ModuleInfoZ
>> _D3std6traits15__T8DemangleTkZ8Demangle6__initZ
>> _D47TypeInfo_S3std6traits15__T8DemangleTkZ8Demangle6__initZ
>
> demangle is currently designed to demangle functions names, 
> while the strings above are types.  During parsing, demangle 
> sees the string as a qualified name and then expects a type, 
> and when it doesn't find one it figures the symbol isn't valid.
>  It sounds like we either need a separate function for 
> demangling types or if the demangle function encounters a 'Z' 
> when it expects a type name it should realize it's demangling a 
> type name, back up, and try again according to that logic.

OK, so as a practical matter, I'd like to be able to demangle 
these types that appear as symbols in object &c. files. Is there 
a simple way I can modify a mangled type such as

_D47TypeInfo_S3std6traits15__T8DemangleTkZ8Demangle6__initZ

into a mangled qualified name so it can be demangled by the 
existing demangle function and the result then modified into a 
string representing a type?



More information about the Digitalmars-d-learn mailing list