diff options
Diffstat (limited to 'test/CodeGen/designated-initializers.c')
-rw-r--r-- | test/CodeGen/designated-initializers.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/test/CodeGen/designated-initializers.c b/test/CodeGen/designated-initializers.c index 652238f..49f57ad 100644 --- a/test/CodeGen/designated-initializers.c +++ b/test/CodeGen/designated-initializers.c @@ -1,22 +1,37 @@ -// 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: @u3 = global %1 zeroinitializer +union { double f; int i; } u3 = { }; + +// 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 +} |