Constructor & destructor name mangling for MS ABI.

Hi all.
This patch adds support ctor/dtor name mangling for MS ABI.
I also have question, in what test folder is the best to add test case?

  - Dmitry.

MicrosoftMangle.cpp.patch (1.62 KB)

This patch adds support ctor/dtor name mangling for MS ABI.

I have no way of verifying the correctness of this, but the code looks okay.

I also have question, in what test folder is the best to add test case?

test/CodeGenCXX/mangle-ms.cpp

John.

Here is a patch with test cases.

  - Dmitry.

mangle-ms.patch (2.16 KB)

Hi!
Ping.
What's about my patch for mangling ctors and dtors?

  - Dmitry.

I recommend you send it to the cfe-commits list for more attention. I believe that's where patches are usually submitted. Don't worry if you don't get a response for a while, though. Just send reminders every week or so.

- John

Ok, thanks.

  - Dmitry.

Here is a patch with test cases.

- Dmitry.

This patch breaks with the following test case:

struct A {
  A();
};

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

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

This patch contains 2 simple stubs as you can see.

  - Dmitry.