[cfe-commits] r68132 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/x86_32-arguments.c
Daniel Dunbar
daniel at zuster.org
Tue Mar 31 12:01:40 PDT 2009
Author: ddunbar
Date: Tue Mar 31 14:01:39 2009
New Revision: 68132
URL: http://llvm.org/viewvc/llvm-project?rev=68132&view=rev
Log:
x86_32 Darwin ABI: Treat empty unions like empty structures.
- Current return-arguments-32 status: 15/1000 failures
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/test/CodeGen/x86_32-arguments.c
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=68132&r1=68131&r2=68132&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Mar 31 14:01:39 2009
@@ -140,11 +140,11 @@
/***/
-/// isEmptyStruct - Return true iff a structure has no non-empty
+/// isEmptyRecord - Return true iff a structure has no non-empty
/// members. Note that a structure with a flexible array member is not
/// considered empty.
-static bool isEmptyStruct(QualType T) {
- const RecordType *RT = T->getAsStructureType();
+static bool isEmptyRecord(QualType T) {
+ const RecordType *RT = T->getAsRecordType();
if (!RT)
return 0;
const RecordDecl *RD = RT->getDecl();
@@ -153,7 +153,7 @@
for (RecordDecl::field_iterator i = RD->field_begin(),
e = RD->field_end(); i != e; ++i) {
const FieldDecl *FD = *i;
- if (!isEmptyStruct(FD->getType()))
+ if (!isEmptyRecord(FD->getType()))
return false;
}
return true;
@@ -182,7 +182,7 @@
const FieldDecl *FD = *i;
QualType FT = FD->getType();
- if (isEmptyStruct(FT)) {
+ if (isEmptyRecord(FT)) {
// Ignore
} else if (Found) {
return 0;
Modified: cfe/trunk/test/CodeGen/x86_32-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments.c?rev=68132&r1=68131&r2=68132&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments.c Tue Mar 31 14:01:39 2009
@@ -15,8 +15,6 @@
// tests. This should be the same as @f8_2.
// RUN: grep 'define void @f9_2(%.truct.s9\* byval %a0)' %t &&
-// RUN: true
-
char f0(void) {
}
@@ -65,3 +63,13 @@
void f9_2(struct s9 a0) {
}
+// Return of small structures and unions...
+
+// RUN: grep 'float @f10()' %t &&
+struct s10 {
+ union { };
+ float f;
+} f10(void) {}
+
+// RUN: true
+
More information about the cfe-commits
mailing list