summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXXABI.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-05-15 01:26:32 +0000
committerReid Kleckner <reid@kleckner.net>2014-05-15 01:26:32 +0000
commitd355ca77a95e8e0266c8d26c23d2b0e8e2fdd8e5 (patch)
tree2f78e5b39dd323812650871893ce87c9ca6af5db /clang/lib/CodeGen/CGCXXABI.cpp
parente8c785439dc8effe976b2a3207cb7dd67f6734cc (diff)
downloadbcm5719-llvm-d355ca77a95e8e0266c8d26c23d2b0e8e2fdd8e5.tar.gz
bcm5719-llvm-d355ca77a95e8e0266c8d26c23d2b0e8e2fdd8e5.zip
Revert Itanium parts of "Don't copy objects with trivial, deleted copy ctors"
This undoes half of r208786. It had problems with lazily declared special members in cases like this: struct A { A(); A &operator=(A &&o); void *p; }; void foo(A); void bar() { foo({}); } In this case, the copy and move constructors are implicitly deleted. However, Clang doesn't eagerly declare the copy ctor in the AST, so we pass the struct in registers. Furthermore, GCC passes this in registers even though this class should be uncopyable. Revert this for now until the dust settles. llvm-svn: 208836
Diffstat (limited to 'clang/lib/CodeGen/CGCXXABI.cpp')
-rw-r--r--clang/lib/CodeGen/CGCXXABI.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCXXABI.cpp b/clang/lib/CodeGen/CGCXXABI.cpp
index 933fe2db208..d1904ec7c4f 100644
--- a/clang/lib/CodeGen/CGCXXABI.cpp
+++ b/clang/lib/CodeGen/CGCXXABI.cpp
@@ -42,7 +42,8 @@ bool CGCXXABI::canCopyArgument(const CXXRecordDecl *RD) const {
// non-deleted copy or move constructor.
// FIXME: This assumes that all lazily declared copy and move constructors are
// not deleted. This assumption might not be true in some corner cases.
- bool CopyOrMoveDeleted = false;
+ bool CopyDeleted = false;
+ bool MoveDeleted = false;
for (const CXXConstructorDecl *CD : RD->ctors()) {
if (CD->isCopyConstructor() || CD->isMoveConstructor()) {
assert(CD->isTrivial());
@@ -50,13 +51,16 @@ bool CGCXXABI::canCopyArgument(const CXXRecordDecl *RD) const {
// directly.
if (!CD->isDeleted())
return true;
- CopyOrMoveDeleted = true;
+ if (CD->isCopyConstructor())
+ CopyDeleted = true;
+ else
+ MoveDeleted = true;
}
}
// If all trivial copy and move constructors are deleted, we cannot copy the
// argument.
- return !CopyOrMoveDeleted;
+ return !(CopyDeleted && MoveDeleted);
}
llvm::Constant *CGCXXABI::GetBogusMemberPointer(QualType T) {
OpenPOWER on IntegriCloud