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

John McCall rjmccall at apple.com
Wed Nov 2 16:07:57 PDT 2011


On Nov 2, 2011, at 3:52 PM, Eli Friedman wrote:
> On Wed, Nov 2, 2011 at 3:14 PM, John McCall <rjmccall at apple.com> wrote:
>> 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.
> 
> On MSVC, returning an class is roughly the same, but passing in a
> class essentially does byval using the copy constructor instead of
> memcpy.  I think there's a PR open about the fact that there isn't any
> way to represent this construct in IR at the moment.

Ah, interesting.  Thanks.

John.



More information about the cfe-dev mailing list