[Patch] Mangle C __stdcall and __fastcall in clang

Reid Kleckner rnk at google.com
Tue Oct 15 13:16:17 PDT 2013


On Tue, Oct 15, 2013 at 12:58 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> > shouldMangleDeclNameImpl can be shouldMangleCXXName, following the same
> > logic as mangleName.
>
> Done.
>
> > This AttributedType handling isn't necessary, use
> T->castAs<FunctionType>()
> > instead of cast<>() to look through the type sugar.
>
> This is awesome. Done.
>
> > +  return mangleCXXName(D, Out);
> >
> > We shouldn't apply the stdcall or fastcall manglings to C++ symbols.  You
> > should check if we should mangle this as a C++ name first, and after that
> > see if we need to apply C manglings.
>
> Thanks. I noticed that we were not quoting the mingw case. I have
> fixed the logic and added a c++ testcase.
>

Almost right.  Don't try to mangle non-extern C C++ symbols, as in things
that return true for shouldMangleCXXName().  This test case gives the
symbol ?foo at Foo@@QAGXXZ, which demangles to (public: void __stdcall
Foo::foo(void)), which already includes the calling convention anyway.

struct Foo {
  void __stdcall foo();
};
void Foo::foo() {}

Feel free to commit with that fixed.

At this point it's not clear to me that you need the StdOrFastCC enum
anymore, but I don't feel strongly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131015/6f82f101/attachment.html>


More information about the cfe-commits mailing list