From f27e5a09a0d815b8a4814152954ff87dadfdefc0 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 2 Jun 2009 17:58:47 +0000 Subject: Import Clang, at r72732. --- test/CodeGen/init.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/CodeGen/init.c (limited to 'test/CodeGen/init.c') diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c new file mode 100644 index 0000000..2e239cf --- /dev/null +++ b/test/CodeGen/init.c @@ -0,0 +1,31 @@ +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t && + +void f1() { + // Scalars in braces. + int a = { 1 }; +} + +void f2() { + int a[2][2] = { { 1, 2 }, { 3, 4 } }; + int b[3][3] = { { 1, 2 }, { 3, 4 } }; + int *c[2] = { &a[1][1], &b[2][2] }; + int *d[2][2] = { {&a[1][1], &b[2][2]}, {&a[0][0], &b[1][1]} }; + int *e[3][3] = { {&a[1][1], &b[2][2]}, {&a[0][0], &b[1][1]} }; + char ext[3][3] = {".Y",".U",".V"}; +} + +typedef void (* F)(void); +extern void foo(void); +struct S { F f; }; +void f3() { + struct S a[1] = { { foo } }; +} + +// Constants +// RUN: grep '@g3 = constant i32 10' %t && +// RUN: grep '@f4.g4 = internal constant i32 12' %t +const int g3 = 10; +int f4() { + static const int g4 = 12; + return g4; +} -- cgit v1.1