summaryrefslogtreecommitdiffstats
path: root/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
commitfde5f97ad7d92d5939b772b074991f169cbd7bf5 (patch)
treec49837ec0a5600baad399fbe9b97888375246856 /lib/CodeGen/CGCXXABI.cpp
parent8454a4b9373bca5d2a8f596ef1c33826171729bd (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208836 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXXABI.cpp')
-rw-r--r--lib/CodeGen/CGCXXABI.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/CGCXXABI.cpp b/lib/CodeGen/CGCXXABI.cpp
index 933fe2db20..d1904ec7c4 100644
--- a/lib/CodeGen/CGCXXABI.cpp
+++ b/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) {