x86_64: Structures with no fields but which have padding should be classified as

integer.
 - This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
 - PR5831.

llvm-svn: 91874
This commit is contained in:
Daniel Dunbar 2009-12-22 01:19:25 +00:00
parent 18d8b7575e
commit 3780f0b680
3 changed files with 9 additions and 2 deletions

View File

@ -805,6 +805,10 @@ void X86_64ABIInfo::classify(QualType Ty,
if (Lo == Memory || Hi == Memory)
break;
}
// If this record has no fields but isn't empty, classify as INTEGER.
if (RD->field_empty() && Size)
Current = Integer;
}
// Classify the fields one at a time, merging the results.

View File

@ -58,6 +58,6 @@ struct T {
void test3() {
T t1, t2;
// RUN: grep "call void @_ZN1TpsERKS_" %t
// RUN: grep "call i64 @_ZN1TpsERKS_" %t
T result = t1 + t2;
}

View File

@ -21,4 +21,7 @@ struct f2_s1 : public f2_s0 { char d;};
// CHECK: define void @_Z2f25f2_s1([[i64_i64_ty]])
void f2(f2_s1 a0) { }
// PR5831
struct s3_0 {};
struct s3_1 { struct s3_0 a; long b; };
void f3(struct s3_1 x) {}