[PATCH] Don't copy objects with trivial, deleted copy ctors
Reid Kleckner
rnk at google.com
Thu May 8 14:01:26 PDT 2014
Richard, you had concerns that this loop over ctors was incorrect, and that
I should really be making some change to CXXRecordDecl::DefinitionData.
Can you imagine some test cases that might be problematic?
If so, do you think it's worth pursuing a more complete fix that updates
the flags, or is it OK to accept this as an incremental fix?
On Wed, May 7, 2014 at 5:52 PM, Reid Kleckner <rnk at google.com> wrote:
> Hi rsmith, majnemer,
>
> This affects both the Itanium and Microsoft C++ ABIs.
>
> Our C++ ABI code was checking if the object had a non-trivial copy ctor
> or non-trivial dtor. Now we check if there are any trivial, non-deleted
> copy or move ctors before passing an argument in registers.
>
> On x86 Windows, we can mostly use the same logic, where we use inalloca
> instead of passing by address. However, on Win64, there are register
> parameters, and we have to do what MSVC does. MSVC ignores the presence
> of non-trivial move constructors and only considers the presence of
> non-trivial or deleted copy constructors. If a non-trivial or deleted
> copy ctor is present, it passes the argument indirectly.
>
> This change fixes bugs and makes us more ABI compatible with both GCC
> and MSVC.
>
> Fixes PR19668.
>
> http://reviews.llvm.org/D3660
>
> Files:
> lib/CodeGen/CGCXXABI.cpp
> lib/CodeGen/CGCXXABI.h
> lib/CodeGen/ItaniumCXXABI.cpp
> lib/CodeGen/MicrosoftCXXABI.cpp
> test/CodeGenCXX/uncopyable-args.cpp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140508/5b29ef31/attachment.html>
More information about the cfe-commits
mailing list