[llvm-branch-commits] [cfe-branch] r85156 - in /cfe/branches/Apple/Dib: lib/CodeGen/CGCall.cpp test/CodeGen/x86_32-arguments.c
Daniel Dunbar
daniel at zuster.org
Mon Oct 26 14:37:28 PDT 2009
Author: ddunbar
Date: Mon Oct 26 16:37:27 2009
New Revision: 85156
URL: http://llvm.org/viewvc/llvm-project?rev=85156&view=rev
Log:
Merge fix for <rdar://problem/7255309> Function arguments incorrect when
function returns a struct on i386 w/ llvm-g++ and clang.
Modified:
cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp
cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c
Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp?rev=85156&r1=85155&r2=85156&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGCall.cpp Mon Oct 26 16:37:27 2009
@@ -242,7 +242,9 @@
}
static bool is32Or64BitBasicType(QualType Ty, ASTContext &Context) {
- if (!Ty->getAsBuiltinType() && !Ty->isPointerType())
+ if (!Ty->getAsBuiltinType() && !Ty->isPointerType() &&
+ !Ty->isAnyComplexType() && !Ty->isEnumeralType() &&
+ !Ty->isBlockPointerType())
return false;
uint64_t Size = Context.getTypeSize(Ty);
@@ -345,8 +347,10 @@
return true;
}
- // If this is a builtin, pointer, or complex type, it is ok.
- if (Ty->getAsBuiltinType() || Ty->isPointerType() || Ty->isAnyComplexType())
+ // If this is a builtin, pointer, enum, or complex type, it is ok.
+ if (Ty->getAsBuiltinType() || Ty->isPointerType() ||
+ Ty->isAnyComplexType() || Ty->isEnumeralType() ||
+ Ty->isBlockPointerType())
return true;
// Arrays are treated like records.
Modified: cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c?rev=85156&r1=85155&r2=85156&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c (original)
+++ cfe/branches/Apple/Dib/test/CodeGen/x86_32-arguments.c Mon Oct 26 16:37:27 2009
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -o %t %s &&
+// RUN: clang-cc -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s &&
// RUN: grep 'define signext i8 @f0()' %t &&
// RUN: grep 'define signext i16 @f1()' %t &&
// RUN: grep 'define i32 @f2()' %t &&
@@ -154,4 +154,47 @@
// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t &&
struct s38 { char a[3]; short b; } f38(void) {}
+// <rdar://problem/7247671>
+// RUN: grep 'define i32 @f40()' %t &&
+enum e40 { ec0 = 0 };
+enum e40 f40(void) { }
+
+// RUN: grep 'define void ()\* @f41()' %t &&
+typedef void (^vvbp)(void);
+vvbp f41(void) { }
+
+// RUN: grep 'define i32 @f42()' %t &&
+struct s42 { enum e40 f0; } f42(void) { }
+
+// RUN: grep 'define i64 @f43()' %t &&
+struct s43 { enum e40 f0; int f1; } f43(void) { }
+
+// RUN: grep 'define i32 @f44()' %t &&
+struct s44 { vvbp f0; } f44(void) { }
+
+// RUN: grep 'define i64 @f45()' %t &&
+struct s45 { vvbp f0; int f1; } f45(void) { }
+
+// RUN: grep 'define void @f46(i32 %a0)' %t &&
+void f46(enum e40 a0) { }
+
+// RUN: grep 'define void @f47(void ()\* %a1)' %t &&
+void f47(vvbp a1) { }
+
+// RUN: grep 'define void @f48(i32 %a0.0)' %t &&
+struct s48 { enum e40 f0; };
+void f48(struct s48 a0) { }
+
+// RUN: grep 'define void @f49(i32 %a0.0, i32 %a0.1)' %t &&
+struct s49 { enum e40 f0; int f1; };
+void f49(struct s49 a0) { }
+
+// RUN: grep 'define void @f50(void ()\* %a0.0)' %t &&
+struct s50 { vvbp f0; };
+void f50(struct s50 a0) { }
+
+// RUN: grep 'define void @f51(void ()\* %a0.0, i32 %a0.1)' %t &&
+struct s51 { vvbp f0; int f1; };
+void f51(struct s51 a0) { }
+
// RUN: true
More information about the llvm-branch-commits
mailing list