www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.demangle.demangle()

Hi,

I tried posting this to the Phobos list but it failed!

I've been writing a tool that requires me to demangle D mangled 
names.  To check it I've been running the tool on its self 
including its mangled names (that I get from the profiler).  I've 
discovered that std.demangle.demangle() cannot demangle these 
mangled names:

_Dmain

_D3std5array18__T8AppenderTAAyaZ8Appender12__T3putTAyaZ3putMFAyaZ9__lambda2MFNaNbNiNeZAAya
    
_D4hash115__T4hashTAaTS17indexing_postings56__T17indexing_postingsVE17indexing_postings9attributei7Z17indexing_postingsVii24Z4hash6__ctorMFNbNiC9allocator9allocatorZC4hash115__T4hashTAaTS17indexing_postings56__T17indexing_postingsVE17indexing_postings9attributei7Z17indexing_postingsVii24Z4hash

_D4hash115__T4hashTAaTS17indexing_postings56__T17indexing_postingsVE17indexing_postings9attributei7Z17indexing_postingsVii24Z4hash7opIndexMFNcKxAaZS17indexing_postings56__T17indexing_postingsVE17indexing_postings9attributei7Z17indexing_postings

The first one is obvious (_Dmain is not mangled).

To verify these were correctly mangled I wrote a name demangler 
based on the grammar on the D web site (that grammar appears to 
be incorrect for structs, and does not include cent and ucent).

Based on my new-found knowledge of how name mangling and 
demangling works I'm about to try and debug 
std.demangle.demangle().

If someone can tell me that this bug has been fixed it'll save me 
a day of work.  If not then I'll post a patch once (if?) I've 
found the bug.

Andrew.
Mar 10 2016