[cfe-dev] "byval" when there is a non-trivial Destructor or Copy Constructor
Jan Voung
jvoung at google.com
Wed Nov 2 15:53:22 PDT 2011
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.
>
>
I don't have good documentation on it, but there is a description of it:
http://llvm.org/bugs/show_bug.cgi?id=5064. The temp copy is part of the
argument stack, and the constructors are run with that arg stack slot as
"this".
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.
>
Change to default attached.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111102/cf0aab28/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_default_cpp.patch
Type: text/x-patch
Size: 736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111102/cf0aab28/attachment.bin>
More information about the cfe-dev
mailing list