[Patch] Mangle C __stdcall and __fastcall in clang

Reid Kleckner rnk at google.com
Tue Oct 15 18:13:53 PDT 2013


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

> > 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.


True.


> > 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.


I don't feel strongly.


> > +  // 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.
>

Looks good.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131015/afe44071/attachment.html>


More information about the cfe-commits mailing list