]> granicus.if.org Git - clang/commitdiff
Fix passing and returning of objects with non trivial copy constructors on
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 8 Jun 2010 02:42:08 +0000 (02:42 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 8 Jun 2010 02:42:08 +0000 (02:42 +0000)
ARM.

Fixes PR7310.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105592 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp

index b29d3cb00c4a0830adedaa909d70d06377d7096b..ad024bd85c34c5b31afaff1a2dfa87f4119d2c2c 100644 (file)
@@ -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))