[PATCH] D35056: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 18:30:28 PDT 2017


rsmith updated this revision to Diff 110115.
rsmith edited the summary of this revision.
rsmith added a comment.
Herald added a subscriber: klimek.

Remove added calls to `DeclareImplicit*`  and `ShouldDeleteSpecialMember`. In their place, figure out whether an implicit special member would be deleted or not by querying the AST.

This requires teaching `CXXRecordDecl` to track whether an implicit copy constructor for a class would be deleted, in the same way we do for the move constructor and move assignment operator; as with those other two cases, we fall back to an "ask Sema" state if the computation is not simple, and in that case `Sema` eagerly declares the special member in question to compute the answer. As a result, this can cause us to declare some copy constructors that we didn't declare previously, but in the important common cases we will still declare them lazily.

I also removed some incorrect assumptions from the Win64 ABI code; this changed the behavior of one testcase from uncopyable-args.cpp (`implicitly_deleted_copy_ctor::A` is now passed indirect).


Repository:
  rL LLVM

https://reviews.llvm.org/D35056

Files:
  include/clang/AST/DeclCXX.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclCXX.cpp
  lib/CodeGen/CGCXXABI.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenCXX/uncopyable-args.cpp
  unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35056.110115.patch
Type: text/x-patch
Size: 37642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170808/24ac7ccf/attachment-0001.bin>


More information about the cfe-commits mailing list