[Patch] Mangle C __stdcall and __fastcall in clang
Rafael EspĂndola
rafael.espindola at gmail.com
Tue Oct 15 17:57:50 PDT 2013
> Oh, I see, mingw does the opposite. :( I was hoping it would be the same,
> but I guess it makes sense because we don't mangle calling conventions under
> Itanium. We might want actually want to add a mangling, seeing as you can
> overload based on CC in clang.
Well, we have to follow what gcc does on mingw.
> I think John would tell you to sink this logic into the MangleContext
> subclasses.
That would require exposing getStdOrFastCallMangling to the
subclasses. I doesn't look worth it.
> + // Variadic functions do not receive @0 suffix.
> + const FunctionDecl *FD = cast<FunctionDecl>(D);
> + const FunctionType *FT = FD->getType()->castAs<FunctionType>();
> + const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FT);
> + if (Proto && Proto->isVariadic())
> + return;
> + if (!Proto) {
> + Out << '0';
> + return;
> + }
>
> Can this be tested? I thought we removed fastcall and cdecl from variadic
> functions, and I have no idea what happens for K&R functions.
True. I started working on the patch while they were still allowed and
forgot to simplify it after that. The new attached patch uses an
assert.
Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 15041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131015/c98f6bff/attachment.obj>
More information about the cfe-commits
mailing list