diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-12-22 01:19:25 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-12-22 01:19:25 +0000 |
commit | 4971ff8eea7800bd2a73652add6dcf7a4adf5f74 (patch) | |
tree | be1221cb8e0badb31acb15275fc11493f3a62a18 | |
parent | 1c7c3fb2641812fdf31b3f80f995116b02ac7863 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91874 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/TargetABIInfo.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/member-functions.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/x86_64-arguments.cpp | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp index 7be1eadfd9..863a297cc6 100644 --- a/lib/CodeGen/TargetABIInfo.cpp +++ b/lib/CodeGen/TargetABIInfo.cpp @@ -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. diff --git a/test/CodeGenCXX/member-functions.cpp b/test/CodeGenCXX/member-functions.cpp index 67038d65d6..ebc9ed758b 100644 --- a/test/CodeGenCXX/member-functions.cpp +++ b/test/CodeGenCXX/member-functions.cpp @@ -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; } diff --git a/test/CodeGenCXX/x86_64-arguments.cpp b/test/CodeGenCXX/x86_64-arguments.cpp index bdee1bc252..7ebbedc998 100644 --- a/test/CodeGenCXX/x86_64-arguments.cpp +++ b/test/CodeGenCXX/x86_64-arguments.cpp @@ -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) {} |