aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-06-08 02:42:08 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-06-08 02:42:08 +0000
commitbbd44ef67330cd43b4097209ac7f4e484b0441cd (patch)
tree20158b2140a2d2030d38cf59a16e3193383db826
parent0271c5928e5320587f5994616b4b3cc9ea07f9a4 (diff)
downloadllvm-bbd44ef67330cd43b4097209ac7f4e484b0441cd.zip
llvm-bbd44ef67330cd43b4097209ac7f4e484b0441cd.tar.gz
llvm-bbd44ef67330cd43b4097209ac7f4e484b0441cd.tar.bz2
Fix passing and returning of objects with non trivial copy constructors on
ARM. Fixes PR7310. llvm-svn: 105592
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index b29d3cb0..ad024bd 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -1808,6 +1808,11 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
if (isEmptyRecord(Context, Ty, true))
return ABIArgInfo::getIgnore();
+ // Structures with either a non-trivial destructor or a non-trivial
+ // copy constructor are always indirect.
+ if (isRecordWithNonTrivialDestructorOrCopyConstructor(Ty))
+ return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
+
// FIXME: This is kind of nasty... but there isn't much choice because the ARM
// backend doesn't support byval.
// FIXME: This doesn't handle alignment > 64 bits.
@@ -1927,6 +1932,11 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
}
+ // Structures with either a non-trivial destructor or a non-trivial
+ // copy constructor are always indirect.
+ if (isRecordWithNonTrivialDestructorOrCopyConstructor(RetTy))
+ return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
+
// Are we following APCS?
if (getABIKind() == APCS) {
if (isEmptyRecord(Context, RetTy, false))