[cfe-commits] r84686 - in /cfe/trunk: lib/CodeGen/TargetABIInfo.cpp test/CodeGenCXX/references.cpp
Anders Carlsson
andersca at mac.com
Tue Oct 20 15:07:59 PDT 2009
Author: andersca
Date: Tue Oct 20 17:07:59 2009
New Revision: 84686
URL: http://llvm.org/viewvc/llvm-project?rev=84686&view=rev
Log:
Fix the 32-bit ABI to return structures with non-trivial copy ctors or dtors indirectly.
Modified:
cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
cfe/trunk/test/CodeGenCXX/references.cpp
Modified: cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetABIInfo.cpp?rev=84686&r1=84685&r2=84686&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Tue Oct 20 17:07:59 2009
@@ -353,11 +353,17 @@
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);
Modified: cfe/trunk/test/CodeGenCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/references.cpp?rev=84686&r1=84685&r2=84686&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/references.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/references.cpp Tue Oct 20 17:07:59 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple x86_64-apple-darwin -verify -emit-llvm -o - %s | FileCheck %s
+// RUN: clang-cc -verify -emit-llvm -o - %s | FileCheck %s
void t1() {
extern int& a;
More information about the cfe-commits
mailing list