mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 18:46:04 +00:00
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
This commit is contained in:
parent
ad07f98ffe
commit
ac385068f9
@ -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>())
|
||||
|
12
clang/test/CodeGenCXX/powerpc-byval.cpp
Normal file
12
clang/test/CodeGenCXX/powerpc-byval.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=powerpc-unknown-linux | FileCheck %s
|
||||
|
||||
struct S {
|
||||
S();
|
||||
~S();
|
||||
};
|
||||
|
||||
void byval(S one, S two) {
|
||||
one = two;
|
||||
}
|
||||
|
||||
// CHECK: define void @_Z5byval1SS_(%struct.S* %one, %struct.S* %two)
|
Loading…
x
Reference in New Issue
Block a user