<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Courier New";
        mso-fareast-language:EN-US;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>A long time ago, when I devised the grammar and structure of the Microsoft C++ name mangling scheme (decorated names), the document describing the object model and the name decoration scheme were made publically available.  Perhaps this is still available publically, or perhaps Microsoft might be willing to share an up to date definition of the name-decoration grammar, especially in light of the integration of CodeView debugging information into LLVM, which somewhat ties in with this.<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>This was expressed as a regular BNF grammar, so it should be possible to create a clean-room implementation of both the “mangler” and “de-mangler” from that BNF definition if it still exists in that form.  Does the recently added CodeView debug information not provide this description (I admit I haven’t looked)?<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>Certainly tools like ‘</span><span style='font-size:12.0pt'>c++filt</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ do not know about the Microsoft name decoration scheme, but LLVM does know how to mangle the names using the VC++ ABI, and since the mangling follows a regular grammar, the de-mangling should be relatively straight-forward to implement.<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>All the best,<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>            MartinO<o:p></o:p></span></p><p class=MsoPlainText><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoPlainText><span lang=EN-US style='mso-fareast-language:EN-IE'>-----Original Message-----<br>From: llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org] On Behalf Of Davide Italiano via llvm-dev<br>Sent: 19 June 2017 19:00<br>To: Rui Ueyama <ruiu@google.com><br>Cc: llvm-dev <llvm-dev@lists.llvm.org><br>Subject: Re: [llvm-dev] VC C++ demangler</span></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>On Mon, Jun 19, 2017 at 10:53 AM, Rui Ueyama via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org"><span style='color:windowtext;text-decoration:none'>llvm-dev@lists.llvm.org</span></a>> wrote:<o:p></o:p></p><p class=MsoPlainText>> Hi,<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> We have a demangler for the Itanium ABI, but looks like we don't have <o:p></o:p></p><p class=MsoPlainText>> one for the MSVC-style symbols. Is there any good demangler we can <o:p></o:p></p><p class=MsoPlainText>> import to LLVM?<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText>> If there's no suitable demangler, I'd like to write one. Currently, we <o:p></o:p></p><p class=MsoPlainText>> are using `UnDecorateSymbolName` function, but the function is <o:p></o:p></p><p class=MsoPlainText>> available only on Windows (which is problematic when you are doing a <o:p></o:p></p><p class=MsoPlainText>> cross-build), and the function is not thread-safe. These two seem to <o:p></o:p></p><p class=MsoPlainText>> be an enough reason to have our own demanler.<o:p></o:p></p><p class=MsoPlainText>><o:p> </o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>I'm not aware of a suitable one, currently. I agree it would be very useful to have.<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>--<o:p></o:p></p><p class=MsoPlainText>Davide<o:p></o:p></p><p class=MsoPlainText><o:p> </o:p></p><p class=MsoPlainText>"There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare _______________________________________________<o:p></o:p></p><p class=MsoPlainText>LLVM Developers mailing list<o:p></o:p></p><p class=MsoPlainText><a href="mailto:llvm-dev@lists.llvm.org"><span style='color:windowtext;text-decoration:none'>llvm-dev@lists.llvm.org</span></a><o:p></o:p></p><p class=MsoPlainText><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"><span style='color:windowtext;text-decoration:none'>http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</span></a><o:p></o:p></p></div></body></html>