[cfe-dev] Constructor & destructor name mangling for MS ABI.

Michael Spencer bigcheesegs at gmail.com
Thu Dec 1 01:58:12 PST 2011


On Thu, Dec 1, 2011 at 12:28 AM, r4start <r4start at gmail.com> wrote:
> On 01/12/2011 09:49, Michael Spencer wrote:
>>
>> On Mon, Nov 7, 2011 at 1:42 AM, r4start<r4start at gmail.com>  wrote:
>>>
>>> Here is a patch with test cases.
>>>
>>>  - Dmitry.
>>
>> This patch breaks with the following test case:
>>
>> struct A {
>>   A();
>> };
>>
>> A::A() {}
>
> Yes, I know about this problem.
>>
>> The reason is that the Itanium ABI has different manglings for the
>> different types of constructors (base, complete, and some other weird
>> one). This patch mangles both the same way, thus later in the code
>> clang gets a GlobalAlias when it expects a Function.
>>
>> I have looked into properly handling this, but it requires changing
>> how CGCXX generates constructors. It also requires that we figure out
>> exactly how the ms-abi handles base vs complete constructors. I
>> believe that when a base constructor is possibly different from the
>> complete constructor, you add an argument to the constructor which
>> specifies if it should construct everything.
>>
>> - Michael Spencer
>
> At now in my code I just have a stub for this.
> I treat all constructors as ctor base(same for destructors) for MS ABI.
> If you need I can publish these stubs for you, but I think these stubs
> shouldn't be in clang tree.
> I will start resolve this problem only after implementing RTTI for MS(maybe
> not full, but working on some test cases).
>
>  - Dmitry.

I'd like the stubs, but this patch is fine to commit as is.

committed as r145581.

- Michael Spencer




More information about the cfe-dev mailing list