[cfe-dev] "byval" when there is a non-trivial Destructor or Copy Constructor

John McCall rjmccall at apple.com
Wed Nov 2 15:14:27 PDT 2011


On Nov 2, 2011, at 2:33 PM, Jan Voung wrote:
> re: passing c++ objects with copy constructors/destructors, there are multiple ABIs for doing this (e.g., the gcc way, msvc way).

There are?  How does MSVC do it that's not just passing a pointer to a temporary?  Is the callee responsible for copying into a temporary or something?  I can't imagine how that would work.

>  Is there a reason that the DefaultABIInfo's classifyArgumentType doesn't match either of the existing ABIs? It both makes a temp copy the gcc way, AND marks pointers as "byval". All of the other ABIs (x86, arm, mips) which would check and do:
> 
>     if (isRecordWithNonTrivialDestructorOrCopyConstructor(Ty))
>       return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
> 
> to only have one temp copy. So, should the default not mark "byval"?

Yes, you're right, the default should not mark byval.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111102/dd083c23/attachment.html>


More information about the cfe-dev mailing list