summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorJan Wen Voung <jvoung@google.com>2011-11-03 00:59:44 +0000
committerJan Wen Voung <jvoung@google.com>2011-11-03 00:59:44 +0000
commit180319f72df952cb0d84fd5f45d52890881e0b2b (patch)
treeeb3e0dc5dd7c400dc14e5c4eb3804b84f4a2895a /clang/lib/CodeGen/TargetInfo.cpp
parente6173d81ae3a4db5c306c3b494f70817a3d4aafc (diff)
downloadbcm5719-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.cpp8
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>())
OpenPOWER on IntegriCloud