aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetABIInfo.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-10-20 22:07:59 +0000
committerAnders Carlsson <andersca@mac.com>2009-10-20 22:07:59 +0000
commit40092972b591646b47037d2b46b695a4014df413 (patch)
treed3589f1f3a4fb30cf78aa55ac3d0c4d270b08e7f /lib/CodeGen/TargetABIInfo.cpp
parent58f5ec7d56b1ebf5f90ee11226ebe7663f2821ea (diff)
Fix the 32-bit ABI to return structures with non-trivial copy ctors or dtors indirectly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetABIInfo.cpp')
-rw-r--r--lib/CodeGen/TargetABIInfo.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp
index ea1426277d..ad5dbd2276 100644
--- a/lib/CodeGen/TargetABIInfo.cpp
+++ b/lib/CodeGen/TargetABIInfo.cpp
@@ -353,11 +353,17 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy,
return ABIArgInfo::getDirect();
} else if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {
- // Structures with flexible arrays are always indirect.
- if (const RecordType *RT = RetTy->getAsStructureType())
+ if (const RecordType *RT = RetTy->getAsStructureType()) {
+ // Structures with either a non-trivial destructor or a non-trivial
+ // copy constructor are always indirect.
+ if (hasNonTrivialDestructorOrCopyConstructor(RT))
+ return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
+
+ // Structures with flexible arrays are always indirect.
if (RT->getDecl()->hasFlexibleArrayMember())
return ABIArgInfo::getIndirect(0);
-
+ }
+
// If specified, structs and unions are always indirect.
if (!IsSmallStructInRegABI && !RetTy->isAnyComplexType())
return ABIArgInfo::getIndirect(0);