aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/designated-initializers.c
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2010-04-16 20:56:35 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2010-04-16 20:56:35 +0000
commitcdb30b41590bf9e20d1d46a866fce071ebadf21a (patch)
tree0ba6645bdf019dd47fe9847de9c75c3ee78b528a /test/CodeGen/designated-initializers.c
parentf0e43e5c4634870b8ac7bf65d5ffa5f292d4c8a5 (diff)
emit padding as undef values, take 2
merge also a few tests I had here for this feature, and FileCheck'ize one file git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/designated-initializers.c')
-rw-r--r--test/CodeGen/designated-initializers.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/test/CodeGen/designated-initializers.c b/test/CodeGen/designated-initializers.c
index 652238f06d..1ad5e6c028 100644
--- a/test/CodeGen/designated-initializers.c
+++ b/test/CodeGen/designated-initializers.c
@@ -1,22 +1,34 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t
-// RUN: grep "{ i8\* null, i32 1024 }" %t
-// RUN: grep "i32 0, i32 22" %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
struct foo {
void *a;
int b;
};
+// CHECK: @u = global %union.anon zeroinitializer
union { int i; float f; } u = { };
-int main(int argc, char **argv)
-{
- union { int i; float f; } u2 = { };
- static struct foo foo = {
- .b = 1024,
- };
-}
+// CHECK: @u2 = global %0 { i32 0, [4 x i8] undef }
+union { int i; double f; } u2 = { };
+// CHECK: @b = global [2 x i32] [i32 0, i32 22]
int b[2] = {
- [1] 22
+ [1] = 22
};
+
+int main(int argc, char **argv)
+{
+ // CHECK: internal global %struct.foo { i8* null, i32 1024 }
+ static struct foo foo = {
+ .b = 1024,
+ };
+
+ // CHECK: bitcast %union.anon* %u2
+ // CHECK: call void @llvm.memset
+ union { int i; float f; } u2 = { };
+
+ // CHECK-NOT: call void @llvm.memset
+ union { int i; float f; } u3;
+
+ // CHECK: ret i32
+}