Do not add "byval" attribute to records with non-trivial copy constructors

and destructors in the DefaultABIInfo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143601 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jan Wen Voung 2011-11-03 00:59:44 +00:00
Родитель 25270b6e6a
Коммит 90306934bc
1 изменённых файлов: 7 добавлений и 1 удалений
lib/CodeGen

Просмотреть файл

@ -339,8 +339,14 @@ llvm::Value *DefaultABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
}
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>())