summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-05-18 22:46:30 +0000
committerReid Kleckner <reid@kleckner.net>2015-05-18 22:46:30 +0000
commitac385068f9c93d0c3dcc65f000d194e8bfc67473 (patch)
tree86f6d5c1be9ccc15f45cd666e708459da9c7b848 /clang/lib
parentad07f98ffe30cabf3308d7418f744522f330484b (diff)
downloadbcm5719-llvm-ac385068f9c93d0c3dcc65f000d194e8bfc67473.tar.gz
bcm5719-llvm-ac385068f9c93d0c3dcc65f000d194e8bfc67473.zip
Revert changes to DefaultABIInfo accidentally introduced in r208733
Also add trivial handling of transparent unions. PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This should worry you, because DefaultABIInfo is not implementing the rules of any particular ABI. Fixes PR23097, patch by Andy Gibbs. llvm-svn: 237630
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 9d2871649c8..b6a53c9f45b 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -406,8 +406,16 @@ llvm::Value *DefaultABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
}
ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty) const {
- if (isAggregateTypeForABI(Ty))
+ Ty = useFirstFieldIfTransparentUnion(Ty);
+
+ if (isAggregateTypeForABI(Ty)) {
+ // Records with non-trivial destructors/copy-constructors should not be
+ // passed by value.
+ if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI()))
+ return ABIArgInfo::getIndirect(0, RAA == CGCXXABI::RAA_DirectInMemory);
+
return ABIArgInfo::getIndirect(0);
+ }
// Treat an enum type as its underlying type.
if (const EnumType *EnumTy = Ty->getAs<EnumType>())
OpenPOWER on IntegriCloud