diff options
| author | Nuno Lopes <nunoplopes@sapo.pt> | 2010-04-16 20:56:35 +0000 |
|---|---|---|
| committer | Nuno Lopes <nunoplopes@sapo.pt> | 2010-04-16 20:56:35 +0000 |
| commit | 5863c999e7a0488cca94786bf62e7b4c69fd82c2 (patch) | |
| tree | 1e5fc592b3b052cca263d0afc1a40d19ccbb3e6b /clang/test/CodeGen/designated-initializers.c | |
| parent | 4d273f451900f678ef17330969cb817523a23db0 (diff) | |
| download | bcm5719-llvm-5863c999e7a0488cca94786bf62e7b4c69fd82c2.tar.gz bcm5719-llvm-5863c999e7a0488cca94786bf62e7b4c69fd82c2.zip | |
emit padding as undef values, take 2
merge also a few tests I had here for this feature, and FileCheck'ize one file
llvm-svn: 101535
Diffstat (limited to 'clang/test/CodeGen/designated-initializers.c')
| -rw-r--r-- | clang/test/CodeGen/designated-initializers.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/clang/test/CodeGen/designated-initializers.c b/clang/test/CodeGen/designated-initializers.c index 652238f06d5..1ad5e6c028a 100644 --- a/clang/test/CodeGen/designated-initializers.c +++ b/clang/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 +} |

