diff options
author | Jan Wen Voung <jvoung@google.com> | 2011-11-03 00:59:44 +0000 |
---|---|---|
committer | Jan Wen Voung <jvoung@google.com> | 2011-11-03 00:59:44 +0000 |
commit | 180319f72df952cb0d84fd5f45d52890881e0b2b (patch) | |
tree | eb3e0dc5dd7c400dc14e5c4eb3804b84f4a2895a /clang/lib/CodeGen/TargetInfo.cpp | |
parent | e6173d81ae3a4db5c306c3b494f70817a3d4aafc (diff) | |
download | bcm5719-llvm-180319f72df952cb0d84fd5f45d52890881e0b2b.tar.gz bcm5719-llvm-180319f72df952cb0d84fd5f45d52890881e0b2b.zip |
Do not add "byval" attribute to records with non-trivial copy constructors
and destructors in the DefaultABIInfo.
llvm-svn: 143601
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 2bd341ce218..2c93249e3b6 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -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>()) |