[cfe-commits] r143601 - /cfe/trunk/lib/CodeGen/TargetInfo.cpp
Jan Wen Voung
jvoung at google.com
Wed Nov 2 17:59:45 PDT 2011
Author: jvoung
Date: Wed Nov 2 19:59:44 2011
New Revision: 143601
URL: http://llvm.org/viewvc/llvm-project?rev=143601&view=rev
Log:
Do not add "byval" attribute to records with non-trivial copy constructors
and destructors in the DefaultABIInfo.
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=143601&r1=143600&r2=143601&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Nov 2 19:59:44 2011
@@ -339,8 +339,14 @@
}
ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty) const {
- if (isAggregateTypeForABI(Ty))
+ if (isAggregateTypeForABI(Ty)) {
+ // Records with non trivial destructors/constructors should not be passed
+ // by value.
+ if (isRecordWithNonTrivialDestructorOrCopyConstructor(Ty))
+ return ABIArgInfo::getIndirect(0, /*ByVal=*/false);
+
return ABIArgInfo::getIndirect(0);
+ }
// Treat an enum type as its underlying type.
if (const EnumType *EnumTy = Ty->getAs<EnumType>())
More information about the cfe-commits
mailing list