digitalmars.D.bugs - [Issue 4852] New: core.demangle cannot demangle functions with class/struct return types
- d-bugmail puremagic.com (67/67) Sep 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4852
- d-bugmail puremagic.com (21/21) Sep 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4852
- d-bugmail puremagic.com (11/11) Sep 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4852
- d-bugmail puremagic.com (12/12) Nov 02 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4852
- d-bugmail puremagic.com (13/13) Feb 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4852
http://d.puremagic.com/issues/show_bug.cgi?id=4852 Summary: core.demangle cannot demangle functions with class/struct return types Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: patch Severity: normal Priority: P2 Component: druntime AssignedTo: sean invisibleduck.org ReportedBy: r.sagitario gmx.de PDT --- There are similar bug reports regarding std.demangle, but as it is reimplemented in core.demangle, I've created this new bug report. for example: _D3dmd6Parser6Parser15parsePrimaryExpMFZC3dmd10Expression10Expression if demangled to dmd dmd.Parser.Parser.parsePrimaryExp() but it should be dmd.Expression.Expression dmd.Parser.Parser.parsePrimaryExp() This is caused by parseLName() not continue reading after eating the first identifier of the fully qualified class name. Index: demangle.d =================================================================== --- demangle.d (revision 390) +++ demangle.d (working copy) -378,20 +378,26 debug(trace) printf( "parseLName+\n" ); debug(trace) scope(success) printf( "parseLName-\n" ); - auto n = decodeNumber(); + while( true ) + { + auto n = decodeNumber(); - if( !n || n > buf.length || n > buf.length - pos ) - error( "LName must be at least 1 character" ); - if( '_' != tok() && !isAlpha( tok() ) ) - error( "Invalid character in LName" ); - foreach( e; buf[pos + 1 .. pos + n] ) - { - if( '_' != e && !isAlpha( e ) && !isDigit( e ) ) + if( !n || n > buf.length || n > buf.length - pos ) + error( "LName must be at least 1 character" ); + if( '_' != tok() && !isAlpha( tok() ) ) error( "Invalid character in LName" ); + foreach( e; buf[pos + 1 .. pos + n] ) + { + if( '_' != e && !isAlpha( e ) && !isDigit( e ) ) + error( "Invalid character in LName" ); + } + + put( buf[pos .. pos + n] ); + pos += n; + if( !isDigit( tok() ) ) + break; + put( "." ); } - - put( buf[pos .. pos + n] ); - pos += n; } /* -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4852 PDT --- Created an attachment (id=774) corrected patch including some additions Please ignore the previous patch, it is flawed and breaks demangling other symbols. What is actually necessary is to call parseQualifiedName instead of parseLName to get the full qualified name, but this involves a call to a function declared later which does not work with local functions, so I placed the local functions into a struct. Included is also a bug fix decoding string literals in template arguments (line 1064). This allows to reenable the 2 failing unittest symbols. I'm proposing to add an argument to demangle() whether the full type is requested or just the qualified name. I've added a function "decodeDmdString" to decompress symbols that are emitted compressed by dmd on windows. I think it is very much related to demangling, so it should have its place in this module, but a better name would be much appreciated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4852 Rainer Schuetze <r.sagitario gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- mime type| | patch| | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4852 Sean Kelly <sean invisibleduck.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- I've applied the patch and made a few tweaks. Still not sure exactly how I want to expose the AddType feature though. For now I just wanted to get the patch in. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 02 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4852 PST --- In my version of druntime I've exposed a version with AddType support by adding a function like this: char[] demangle( const(char)[] buf, bool addType_, char[] dst = null ) { auto d = Demangle(buf, addType_ ? Demangle.AddType.yes : Demangle.AddType.no, dst); return d(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 14 2011