[cfe-commits] [Windows] Properly mangle templates

João Matos ripzonetriton at gmail.com
Thu May 24 13:22:03 PDT 2012


By the way, Timur, how are you testing the symbol mangling?

I did not find an easy to dump the mangling from cl.exe compiled
object files. I tried DUMPBIN.exe, but it outputs a lot of unrelated
stuff, I tried different parameters but did not find much a clean way
to do it.

I'm thinking of a way to make a simple test tool so I can more easily
mangle a lot of declarations and test them automatically, to ensure
Clang is doing the right thing. This is important to me, since for my
needs, Clang must match Microsoft compiler's name exactly. Any
thoughts on a simple way to do this? It could even be used to generate
Clang test cases.

Also I noticed it outputs the mangled name with a "\1" marker as the
first character. I suggest we don't do that in the mangler, since it's
a specific thing for LLVM. That can be done by the code generator
instead of the mangler, just makes it cleaner for those who need to
get the mangled name. If it's okay to change, I'll send a patch for
it.

On Thu, May 24, 2012 at 12:53 PM, John McCall <rjmccall at apple.com> wrote:
> On May 24, 2012, at 4:35 AM, Timur Iskhodzhanov wrote:
>> On Thu, May 24, 2012 at 2:44 PM, João Matos <ripzonetriton at gmail.com> wrote:
>>>>> Attached is a patch that introduces template mangling (at least in the
>>>>> simple cases) as well as some tests for the code.
>>>>>
>>>>> Can you please review it?
>>> I'm only wondering if there is any other template argument kind we need to handle.
>> We'll find out as we compile more code with Clang.
>> Currently, even simple programs with templates are miscompiled, the
>> suggested patch should cover most of the cases.
>> I hope all other cases will hit the assertion and then we can deal
>> with minimized test cases.
>>
>> The current patch (plus one more patch to handle back referenes)
>> mangles templates from googletest and iostream just fine (at least
>> without obvious problems).
>>
>>> The patch looks fine to me.
>> Can I commit or should I wait for John's review?
>
> Please wait for my review;  I'll get to it before the end of the week.
>
> John.



-- 
João Matos




More information about the cfe-commits mailing list