[PATCH] Don't copy objects with trivial, deleted copy ctors

Reid Kleckner rnk at google.com
Wed May 7 17:52:41 PDT 2014


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 --------------
A non-text attachment was scrubbed...
Name: D3660.9197.patch
Type: text/x-patch
Size: 8421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140508/66830815/attachment.bin>


More information about the cfe-commits mailing list