-
-
Notifications
You must be signed in to change notification settings - Fork 426
Issue 11192 - std.demangle doesn't demangle alias template arguments #906
Conversation
There is already a parseMangledName function. Is it possible to use that instead of re-implementing it in the switch case? |
OK, done. |
Thanks. Something still doesn't really sit well with me regarding this fix. I don't like that the ABI now has two conditions with the same prefix. That indicates an ambiguity, and while there are others, I want to check into this a bit more. I'm hoping we can always just call parseMangledName here have that take care of both cases. And either way, the ABI will have to be corrected. |
Okay, yep this is ambiguous. Both start with a Number, then in the LName case alphanumeric characters (which allows "_D"), and in the MangledName case "_D" followed by a Number, etc. I guess we have to do as you've done here and just assume that anything starting with "_D" is a MangledName, but I'd like to call out the ambiguity in the code if possible. Suggestions forthcoming. |
Emitting "_D" for alias template arguments looks like a compiler bug. It isn't mentioned by the ABI http://dlang.org/abi.html. |
I found this issue page: Issue 5957 - Ambiguous mangling of module and template in template symbol args |
There are a bunch of ambiguities. In fact, templates in general are ambiguous (see mayBeTemplateInstanceName). They should all be fixed, and probably all at once, since it will break binary compatibility with existing compiled code. |
Here's what I'm thinking: http://www.invisibleduck.org/sean/tmp/11192.patch Then it's pretty obvious in code that there's an ambiguity and if for some reason the symbol is a qualifiedName starting with "_D" then it should recover and handle that instead (though it's worth a test case). |
Thanks, updated. |
See also: #725 |
In general, I think demangle should properly demangle all symbols generated by the compiler. Then if there are issues where the mangling seems wrong for some reason, a bug should be filed against DMD. When that is fixed, the change can be removed from demangle. The only exception is particularly egregious mangling issues for which there isn't a clean solution in demangle, but I haven't encountered any of these yet. In short, I think this change should be merged and then a bug filed. |
Agreed, we should demangle all symbols produced by the compiler. Not doing so is frustrating when you're trying to use a debugger. (Or debug a stacktrace, disassemble an executable, etc..) |
Issue 11192 - std.demangle doesn't demangle alias template arguments
https://issues.dlang.org/show_bug.cgi?id=11192
Support demangling of alias template arguments.